summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/statements')
-rw-r--r--js/src/tests/test262/language/statements/async-function/array-destructuring-param-strict-body.js110
-rw-r--r--js/src/tests/test262/language/statements/async-function/await-as-binding-identifier-escaped.js31
-rw-r--r--js/src/tests/test262/language/statements/async-function/await-as-binding-identifier.js31
-rw-r--r--js/src/tests/test262/language/statements/async-function/await-as-identifier-reference-escaped.js31
-rw-r--r--js/src/tests/test262/language/statements/async-function/await-as-identifier-reference.js31
-rw-r--r--js/src/tests/test262/language/statements/async-function/await-as-label-identifier-escaped.js31
-rw-r--r--js/src/tests/test262/language/statements/async-function/await-as-label-identifier.js31
-rw-r--r--js/src/tests/test262/language/statements/async-function/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/async-function/cptn-decl.js15
-rw-r--r--js/src/tests/test262/language/statements/async-function/declaration-returns-promise.js15
-rw-r--r--js/src/tests/test262/language/statements/async-function/dflt-params-abrupt.js43
-rw-r--r--js/src/tests/test262/language/statements/async-function/dflt-params-arg-val-not-undefined.js63
-rw-r--r--js/src/tests/test262/language/statements/async-function/dflt-params-arg-val-undefined.js46
-rw-r--r--js/src/tests/test262/language/statements/async-function/dflt-params-duplicates.js39
-rw-r--r--js/src/tests/test262/language/statements/async-function/dflt-params-ref-later.js44
-rw-r--r--js/src/tests/test262/language/statements/async-function/dflt-params-ref-prior.js43
-rw-r--r--js/src/tests/test262/language/statements/async-function/dflt-params-ref-self.js44
-rw-r--r--js/src/tests/test262/language/statements/async-function/dflt-params-rest.js43
-rw-r--r--js/src/tests/test262/language/statements/async-function/dflt-params-trailing-comma.js38
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-NSPL-with-USD.js17
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-arguments-in-formal-parameters-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-await-in-formals-default.js15
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-await-in-formals.js15
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-binding-identifier-arguments-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-binding-identifier-eval-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-body-contains-super-call.js16
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-body-contains-super-property.js16
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-duplicate-parameters-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-eval-in-formal-parameters-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-body-duplicate.js16
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-contains-super-call.js16
-rw-r--r--js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-contains-super-property.js16
-rw-r--r--js/src/tests/test262/language/statements/async-function/escaped-async.js25
-rw-r--r--js/src/tests/test262/language/statements/async-function/eval-var-scope-syntax-err.js39
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-body-that-returns-after-await.js22
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-body-that-returns.js20
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-body-that-throws-after-await.js25
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-body-that-throws.js23
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-body.js20
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-default-that-throws.js21
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-mapped-arguments.js23
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-this-value-global.js19
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-this-value-passed.js19
-rw-r--r--js/src/tests/test262/language/statements/async-function/evaluation-unmapped-arguments.js24
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/async-func-decl-forbidden-ext-direct-access-prop-arguments.js38
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/async-func-decl-forbidden-ext-direct-access-prop-caller.js38
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js64
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js64
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-prop-caller.js64
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/async-function/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/async-function/let-newline-await-in-async-function.js25
-rw-r--r--js/src/tests/test262/language/statements/async-function/object-destructuring-param-strict-body.js110
-rw-r--r--js/src/tests/test262/language/statements/async-function/params-trailing-comma-multiple.js38
-rw-r--r--js/src/tests/test262/language/statements/async-function/params-trailing-comma-single.js37
-rw-r--r--js/src/tests/test262/language/statements/async-function/rest-param-strict-body.js110
-rw-r--r--js/src/tests/test262/language/statements/async-function/rest-params-trailing-comma-early-error.js36
-rw-r--r--js/src/tests/test262/language/statements/async-function/returns-async-arrow-returns-arguments-from-parent-function.js31
-rw-r--r--js/src/tests/test262/language/statements/async-function/returns-async-arrow-returns-newtarget.js30
-rw-r--r--js/src/tests/test262/language/statements/async-function/returns-async-arrow.js30
-rw-r--r--js/src/tests/test262/language/statements/async-function/returns-async-function-returns-arguments-from-own-function.js31
-rw-r--r--js/src/tests/test262/language/statements/async-function/returns-async-function-returns-newtarget.js30
-rw-r--r--js/src/tests/test262/language/statements/async-function/returns-async-function.js30
-rw-r--r--js/src/tests/test262/language/statements/async-function/shell.js113
-rw-r--r--js/src/tests/test262/language/statements/async-function/syntax-declaration-line-terminators-allowed.js19
-rw-r--r--js/src/tests/test262/language/statements/async-function/syntax-declaration-no-line-terminator.js15
-rw-r--r--js/src/tests/test262/language/statements/async-function/syntax-declaration.js16
-rw-r--r--js/src/tests/test262/language/statements/async-function/try-reject-finally-reject.js28
-rw-r--r--js/src/tests/test262/language/statements/async-function/try-reject-finally-return.js26
-rw-r--r--js/src/tests/test262/language/statements/async-function/try-reject-finally-throw.js26
-rw-r--r--js/src/tests/test262/language/statements/async-function/try-return-finally-reject.js26
-rw-r--r--js/src/tests/test262/language/statements/async-function/try-return-finally-return.js26
-rw-r--r--js/src/tests/test262/language/statements/async-function/try-return-finally-throw.js24
-rw-r--r--js/src/tests/test262/language/statements/async-function/try-throw-finally-reject.js26
-rw-r--r--js/src/tests/test262/language/statements/async-function/try-throw-finally-return.js26
-rw-r--r--js/src/tests/test262/language/statements/async-function/try-throw-finally-throw.js24
-rw-r--r--js/src/tests/test262/language/statements/async-function/unscopables-with-in-nested-fn.js80
-rw-r--r--js/src/tests/test262/language/statements/async-function/unscopables-with.js74
-rw-r--r--js/src/tests/test262/language/statements/async-generator/array-destructuring-param-strict-body.js113
-rw-r--r--js/src/tests/test262/language/statements/async-generator/await-as-binding-identifier-escaped.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/await-as-binding-identifier.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/await-as-identifier-reference-escaped.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/await-as-identifier-reference.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/await-as-label-identifier-escaped.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/await-as-label-identifier.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dflt-params-abrupt.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dflt-params-arg-val-not-undefined.js65
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dflt-params-arg-val-undefined.js48
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dflt-params-duplicates.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dflt-params-ref-later.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dflt-params-ref-prior.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dflt-params-ref-self.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dflt-params-rest.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dflt-params-trailing-comma.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-close.js52
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-get-err-array-prototype.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-get-err.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-no-close.js52
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-name-iter-val.js51
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elem-init.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elem-iter.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elision-init.js50
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elision-iter.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-empty-init.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-empty-iter.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-rest-init.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-rest-iter.js50
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-val-null.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-exhausted.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-class.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-cover.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-fn.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-gen.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-hole.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-skipped.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-throws.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-undef.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-unresolvable.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-complete.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-done.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-step-err.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js61
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val-err.js58
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val.js51
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-id-init.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-id.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-prop-id-init.js53
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-prop-id.js53
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-val-null.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-val-undef.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision-exhausted.js48
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision-step-err.js54
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision.js57
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-empty.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-elem.js64
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-elision.js70
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-empty.js53
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-rest.js49
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-direct.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-elision-next-err.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-elision.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-exhausted.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-iter-step-err.js51
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-iter-val-err.js53
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-ary.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-id.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-obj.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-ary.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-id.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-obj.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-obj-id.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-obj-prop-id.js49
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-close.js52
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-get-err-array-prototype.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-get-err.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-no-close.js52
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-name-iter-val.js51
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-init.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-init.js50
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-init.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-init.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js50
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-val-null.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-hole.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-skipped.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-throws.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-undef.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-complete.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-done.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js61
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js58
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val.js51
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-id-init.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-id.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js53
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id.js53
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-null.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-undef.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision-exhausted.js48
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision-step-err.js54
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision.js57
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-empty.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-elem.js64
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-elision.js70
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-empty.js53
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-rest.js49
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-elision.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-exhausted.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js51
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js53
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-ary.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-id.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-obj.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-ary.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-id.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-obj.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-obj-id.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-obj-prop-id.js49
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-init-null.js34
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-init-undefined.js34
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-empty.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-get-value-err.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-class.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-skipped.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-throws.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-unresolvable.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-trailing-comma.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-list-err.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-init.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-value-null.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-eval-err.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-get-value-err.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-skipped.js58
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-throws.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-init.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-null.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-undef.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-getter.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-val-obj.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-init-null.js34
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-init-undefined.js34
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-empty.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-get-value-err.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-arrow.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-class.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-cover.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-fn.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-gen.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-skipped.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-throws.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-unresolvable.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-trailing-comma.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-list-err.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-init.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-trailing-comma.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-value-null.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-eval-err.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-get-value-err.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-skipped.js58
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-throws.js41
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-unresolvable.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-trailing-comma.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-init.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-value-null.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-value-undef.js36
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj.js43
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-getter.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-skip-non-enumerable.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-val-obj.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/escaped-async.js25
-rw-r--r--js/src/tests/test262/language/statements/async-generator/eval-var-scope-syntax-err.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/async-gen-func-decl-forbidden-ext-direct-access-prop-arguments.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/async-gen-func-decl-forbidden-ext-direct-access-prop-caller.js38
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js64
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js64
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-prop-caller.js64
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/generator-created-after-decl-inst.js26
-rw-r--r--js/src/tests/test262/language/statements/async-generator/object-destructuring-param-strict-body.js113
-rw-r--r--js/src/tests/test262/language/statements/async-generator/params-trailing-comma-multiple.js40
-rw-r--r--js/src/tests/test262/language/statements/async-generator/params-trailing-comma-single.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/rest-param-strict-body.js113
-rw-r--r--js/src/tests/test262/language/statements/async-generator/rest-params-trailing-comma-early-error.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/return-undefined-implicit-and-explicit.js81
-rw-r--r--js/src/tests/test262/language/statements/async-generator/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/async-generator/unscopables-with-in-nested-fn.js82
-rw-r--r--js/src/tests/test262/language/statements/async-generator/unscopables-with.js76
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-as-binding-identifier-escaped.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-as-binding-identifier.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-as-identifier-reference-escaped.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-as-identifier-reference.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-as-label-identifier-escaped.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-as-label-identifier.js32
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-identifier-non-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-identifier-spread-non-strict.js64
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-identifier-spread-strict-strict.js48
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-identifier-strict-strict.js39
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-catch.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js50
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-for-await-of-sync-iterator.js49
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-yield-star-async-iterator.js48
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-yield-star-sync-iterator.js47
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next.js44
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-return-then-getter-ticks.js105
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-spread-arr-multiple.js50
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-spread-arr-single.js49
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-spread-obj.js52
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-async-from-sync-iterator-inaccessible.js56
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-async-next.js219
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-async-return.js235
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-async-throw.js243
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-expr-abrupt.js54
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-get-abrupt.js74
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-boolean-throw.js73
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-number-throw.js73
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-object-throw.js73
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-string-throw.js73
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-symbol-throw.js73
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-null-sync-get-abrupt.js79
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-abrupt.js70
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-boolean-throw.js70
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-null-throw.js70
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-number-throw.js70
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-string-throw.js70
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-symbol-throw.js70
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-undefined-throw.js70
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-undefined-sync-get-abrupt.js79
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-get-abrupt.js73
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-boolean-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-number-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-object-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-string-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-symbol-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-abrupt.js67
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-boolean-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-null-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-number-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-string-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-symbol-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-undefined-throw.js72
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-call-done-get-abrupt.js73
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-call-returns-abrupt.js65
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-call-value-get-abrupt.js75
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-get-abrupt.js65
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-non-object-ignores-then.js85
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-boolean-throw.js62
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-null-throw.js62
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-number-throw.js62
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-object-throw.js62
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-string-throw.js62
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-symbol-throw.js62
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-undefined-throw.js62
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-then-get-abrupt.js89
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-boolean-fulfillpromise.js83
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-null-fulfillpromise.js83
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-number-fulfillpromise.js83
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-object-fulfillpromise.js83
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-string-fulfillpromise.js83
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-symbol-fulfillpromise.js83
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-undefined-fulfillpromise.js83
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-next-then-returns-abrupt.js89
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-normal-notdone-iter-value-throws.js54
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-promise-not-unwrapped.js42
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-return-missing-value-is-awaited.js45
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-return-notdone-iter-value-throws.js64
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-return-then-getter-ticks.js145
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-sync-next.js222
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-sync-return.js197
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-sync-throw.js203
-rw-r--r--js/src/tests/test262/language/statements/async-generator/yield-star-throw-notdone-iter-value-throws.js65
-rw-r--r--js/src/tests/test262/language/statements/block/12.1-1.js15
-rw-r--r--js/src/tests/test262/language/statements/block/12.1-2.js17
-rw-r--r--js/src/tests/test262/language/statements/block/12.1-3.js15
-rw-r--r--js/src/tests/test262/language/statements/block/12.1-4.js15
-rw-r--r--js/src/tests/test262/language/statements/block/12.1-5.js15
-rw-r--r--js/src/tests/test262/language/statements/block/12.1-6.js17
-rw-r--r--js/src/tests/test262/language/statements/block/12.1-7.js15
-rw-r--r--js/src/tests/test262/language/statements/block/S12.1_A2.js38
-rw-r--r--js/src/tests/test262/language/statements/block/S12.1_A4_T1.js22
-rw-r--r--js/src/tests/test262/language/statements/block/S12.1_A4_T2.js22
-rw-r--r--js/src/tests/test262/language/statements/block/S12.1_A5.js58
-rw-r--r--js/src/tests/test262/language/statements/block/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/block/early-errors/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/block/early-errors/invalid-names-call-expression-bad-reference.js41
-rw-r--r--js/src/tests/test262/language/statements/block/early-errors/invalid-names-call-expression-this.js41
-rw-r--r--js/src/tests/test262/language/statements/block/early-errors/invalid-names-member-expression-bad-reference.js41
-rw-r--r--js/src/tests/test262/language/statements/block/early-errors/invalid-names-member-expression-this.js41
-rw-r--r--js/src/tests/test262/language/statements/block/early-errors/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/block/labeled-continue.js25
-rw-r--r--js/src/tests/test262/language/statements/block/scope-lex-close.js29
-rw-r--r--js/src/tests/test262/language/statements/block/scope-lex-open.js28
-rw-r--r--js/src/tests/test262/language/statements/block/scope-var-none.js29
-rw-r--r--js/src/tests/test262/language/statements/block/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/block/tco-stmt-list-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/block/tco-stmt-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/break/12.8-1.js22
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A1_T1.js22
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A1_T2.js24
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A1_T3.js26
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A1_T4.js28
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A3.js34
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A4_T1.js37
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A4_T2.js43
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A4_T3.js43
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A5_T1.js34
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A5_T2.js36
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A5_T3.js39
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A6.js26
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A7.js31
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A8_T1.js23
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A8_T2.js23
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A9_T1.js34
-rw-r--r--js/src/tests/test262/language/statements/break/S12.8_A9_T2.js34
-rw-r--r--js/src/tests/test262/language/statements/break/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/break/line-terminators.js47
-rw-r--r--js/src/tests/test262/language/statements/break/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/break/static-init-without-label.js28
-rw-r--r--js/src/tests/test262/language/statements/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst-computed-yield-expr.js45
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-evaluation.js41
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-to-prop-key.js57
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-unresolvable.js39
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/computed.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-binary.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-exponent.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-hex.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-leading-decimal.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-non-canonical.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-octal.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-zero.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-char-escape.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped-ext.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-double-quote.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-empty.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-hex-escape.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-line-continuation.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-single-quote.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-unicode-escape.js40
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-inst/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static-computed-yield-expr.js47
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-evaluation.js43
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-to-prop-key.js59
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/computed.js44
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-binary.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-exponent.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-hex.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-leading-decimal.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-non-canonical.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-octal.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-zero.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-char-escape.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped-ext.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-double-quote.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-empty.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-hex-escape.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-line-continuation.js44
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-single-quote.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-unicode-escape.js42
-rw-r--r--js/src/tests/test262/language/statements/class/accessor-name-static/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/arguments/access.js56
-rw-r--r--js/src/tests/test262/language/statements/class/arguments/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/arguments/default-constructor.js32
-rw-r--r--js/src/tests/test262/language/statements/class/arguments/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-meth-escaped-async.js27
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/array-destructuring-param-strict-body.js138
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-abrupt.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-arg-val-not-undefined.js92
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-arg-val-undefined.js75
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-duplicates.js67
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-later.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-prior.js72
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-self.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-rest.js71
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-trailing-comma.js67
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/cls-decl-async-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/cls-decl-async-gen-meth-static-forbidden-ext-direct-access-prop-caller.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/object-destructuring-param-strict-body.js138
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/params-trailing-comma-multiple.js67
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/params-trailing-comma-single.js66
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/rest-param-strict-body.js138
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/rest-params-trailing-comma-early-error.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-identifier-spread-strict-strict.js55
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-identifier-strict-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-catch.js51
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js57
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js56
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-yield-star-async-iterator.js55
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-yield-star-sync-iterator.js54
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next.js51
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-arr-multiple.js57
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-arr-single.js56
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-obj.js59
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-next.js226
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-return.js242
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-throw.js250
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-expr-abrupt.js61
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-get-abrupt.js81
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-boolean-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-number-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-object-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-string-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-symbol-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-null-sync-get-abrupt.js86
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-abrupt.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-boolean-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-null-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-number-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-string-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-symbol-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-undefined-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js86
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-get-abrupt.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-number-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-object-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-string-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-abrupt.js74
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-boolean-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-null-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-number-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-string-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-symbol-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-undefined-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-done-get-abrupt.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-returns-abrupt.js72
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-value-get-abrupt.js82
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-get-abrupt.js72
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-non-object-ignores-then.js92
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-boolean-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-null-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-number-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-object-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-string-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-symbol-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-undefined-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-get-abrupt.js96
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-returns-abrupt.js96
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-next.js229
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-return.js204
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-throw.js210
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/array-destructuring-param-strict-body.js137
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-abrupt.js67
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-not-undefined.js91
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-undefined.js74
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-duplicates.js66
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-later.js68
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-prior.js71
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-self.js68
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-rest.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js38
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-caller.js38
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/object-destructuring-param-strict-body.js137
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-multiple.js66
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-single.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/rest-param-strict-body.js137
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/rest-params-trailing-comma-early-error.js63
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-spread-strict-strict.js55
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-strict-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-catch.js51
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js57
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js56
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js55
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js54
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next.js51
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-multiple.js57
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-single.js56
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-obj.js59
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-next.js226
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-return.js242
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-throw.js250
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-expr-abrupt.js61
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-get-abrupt.js81
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js86
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js86
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js74
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-done-get-abrupt.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-returns-abrupt.js72
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-value-get-abrupt.js82
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-get-abrupt.js72
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-non-object-ignores-then.js92
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-null-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-number-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-object-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-string-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-get-abrupt.js96
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-returns-abrupt.js96
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-next.js229
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-return.js204
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-throw.js210
-rw-r--r--js/src/tests/test262/language/statements/class/async-meth-escaped-async.js27
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/array-destructuring-param-strict-body.js135
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/await-as-binding-identifier-escaped.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/await-as-binding-identifier.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/await-as-identifier-reference-escaped.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/await-as-identifier-reference.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/await-as-label-identifier-escaped.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/await-as-label-identifier.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/dflt-params-abrupt.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/dflt-params-arg-val-not-undefined.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/dflt-params-arg-val-undefined.js73
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/dflt-params-duplicates.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-later.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-prior.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-self.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/dflt-params-rest.js68
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/dflt-params-trailing-comma.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/cls-decl-async-meth-static-forbidden-ext-direct-access-prop-arguments.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/cls-decl-async-meth-static-forbidden-ext-direct-access-prop-caller.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-prop-caller.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/object-destructuring-param-strict-body.js135
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/params-trailing-comma-multiple.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/params-trailing-comma-single.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/rest-param-strict-body.js135
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/rest-params-trailing-comma-early-error.js60
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow-returns-arguments-from-parent-function.js41
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow-returns-newtarget.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/returns-async-function-returns-arguments-from-own-function.js41
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/returns-async-function-returns-newtarget.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/returns-async-function.js40
-rw-r--r--js/src/tests/test262/language/statements/class/async-method-static/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/array-destructuring-param-strict-body.js136
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/await-as-binding-identifier-escaped.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/await-as-binding-identifier.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/await-as-identifier-reference-escaped.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/await-as-identifier-reference.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/await-as-label-identifier-escaped.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/await-as-label-identifier.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/dflt-params-abrupt.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/dflt-params-arg-val-not-undefined.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/dflt-params-arg-val-undefined.js73
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/dflt-params-duplicates.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-later.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-prior.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-self.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/dflt-params-rest.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/dflt-params-trailing-comma.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/cls-decl-async-meth-forbidden-ext-direct-access-prop-arguments.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/cls-decl-async-meth-forbidden-ext-direct-access-prop-caller.js39
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-prop-caller.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/object-destructuring-param-strict-body.js136
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/params-trailing-comma-multiple.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/params-trailing-comma-single.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/rest-param-strict-body.js136
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/rest-params-trailing-comma-early-error.js61
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/returns-async-arrow-returns-arguments-from-parent-function.js42
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/returns-async-arrow-returns-newtarget.js41
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/returns-async-arrow.js41
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/returns-async-function-returns-arguments-from-own-function.js42
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/returns-async-function-returns-newtarget.js41
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/returns-async-function.js41
-rw-r--r--js/src/tests/test262/language/statements/class/async-method/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-await-escaped-module.js24
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-await-escaped.js19
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-await-module.js23
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-await.js18
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-let-escaped.js28
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-let.js28
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-static-escaped.js28
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-static.js28
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-yield-escaped.js28
-rw-r--r--js/src/tests/test262/language/statements/class/class-name-ident-yield.js26
-rw-r--r--js/src/tests/test262/language/statements/class/classelementname-abrupt-completion.js44
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-additive-expression-add.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-additive-expression-subtract.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-arrow-function-expression.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-assignment.js96
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-bitwise-or.js96
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-coalesce.js96
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-logical-and.js96
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-logical-or.js96
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-async-arrow-function-expression.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-await-expression.js98
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-condition-expression-false.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-condition-expression-true.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-decimal-e-notational-literal.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-decimal-literal.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-exponetiation-expression.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-coalesce.js96
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-logical-and.js96
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-logical-or.js96
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-function-declaration.js94
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-function-expression.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-generator-function-declaration.js94
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-identifier.js95
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-integer-e-notational-literal.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-integer-separators.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-math.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-multiplicative-expression-div.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-multiplicative-expression-mult.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-null.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-numeric-literal.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-string-literal.js93
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-yield-expression.js98
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-additive-expression-add.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-additive-expression-subtract.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-arrow-function-expression.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-assignment.js69
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-bitwise-or.js69
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-coalesce.js69
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-logical-and.js69
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-logical-or.js69
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-async-arrow-function-expression.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-await-expression.js71
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-condition-expression-false.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-condition-expression-true.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-decimal-e-notational-literal.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-decimal-literal.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-exponetiation-expression.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-coalesce.js69
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-logical-and.js69
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-logical-or.js69
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-function-declaration.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-function-expression.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-generator-function-declaration.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-identifier.js68
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-integer-e-notational-literal.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-integer-separators.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-math.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-multiplicative-expression-div.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-multiplicative-expression-mult.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-null.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-numeric-literal.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-string-literal.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-yield-expression.js71
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-additive-expression-add.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-additive-expression-subtract.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-arrow-function-expression.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-assignment.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-bitwise-or.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-coalesce.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-logical-and.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-logical-or.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-async-arrow-function-expression.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-await-expression.js68
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-condition-expression-false.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-condition-expression-true.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-decimal-e-notational-literal.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-decimal-literal.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-exponetiation-expression.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-coalesce.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-logical-and.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-logical-or.js66
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-function-declaration.js64
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-function-expression.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-generator-function-declaration.js64
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-identifier.js65
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-integer-e-notational-literal.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-integer-separators.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-math.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-multiplicative-expression-div.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-multiplicative-expression-mult.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-null.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-numeric-literal.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-string-literal.js63
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-yield-expression.js68
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-additive-expression-add.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-additive-expression-subtract.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-arrow-function-expression.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-assignment.js70
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-bitwise-or.js70
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-coalesce.js70
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-logical-and.js70
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-logical-or.js70
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-async-arrow-function-expression.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-await-expression.js72
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-condition-expression-false.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-condition-expression-true.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-decimal-e-notational-literal.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-decimal-literal.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-exponetiation-expression.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-coalesce.js70
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-logical-and.js70
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-logical-or.js70
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-function-declaration.js68
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-function-expression.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-generator-function-declaration.js68
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-identifier.js69
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-integer-e-notational-literal.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-integer-separators.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-math.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-multiplicative-expression-div.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-multiplicative-expression-mult.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-null.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-numeric-literal.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-string-literal.js67
-rw-r--r--js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-yield-expression.js72
-rw-r--r--js/src/tests/test262/language/statements/class/cptn-decl.js16
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/decorator-member-expr-private-identifier.js57
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-call-expr-identifier-reference.js88
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-member-expr-decorator-member-expr.js84
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-member-expr-identifier-reference.js77
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-parenthesized-expr-identifier-reference.js90
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-call-expr-identifier-reference-yield.js48
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-call-expr-identifier-reference.js61
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-decorator-member-expr.js54
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-identifier-reference-yield.js37
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-identifier-reference.js50
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference-yield.js55
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference.js63
-rw-r--r--js/src/tests/test262/language/statements/class/decorator/syntax/valid/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/definition/accessors.js54
-rw-r--r--js/src/tests/test262/language/statements/class/definition/basics.js45
-rw-r--r--js/src/tests/test262/language/statements/class/definition/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/definition/class-method-returns-promise.js17
-rw-r--r--js/src/tests/test262/language/statements/class/definition/constructable-but-no-prototype.js13
-rw-r--r--js/src/tests/test262/language/statements/class/definition/constructor-property.js19
-rw-r--r--js/src/tests/test262/language/statements/class/definition/constructor-strict-by-default.js17
-rw-r--r--js/src/tests/test262/language/statements/class/definition/constructor.js37
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-async-method-duplicate-parameters.js30
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-method-NSPL-with-USD.js18
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-method-arguments-in-formal-parameters.js17
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-method-await-in-formals-default.js18
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-method-await-in-formals.js17
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-method-body-contains-super-call.js17
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-method-duplicate-parameters.js29
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-method-eval-in-formal-parameters.js17
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-method-formals-body-duplicate.js19
-rw-r--r--js/src/tests/test262/language/statements/class/definition/early-errors-class-method-formals-contains-super-call.js17
-rw-r--r--js/src/tests/test262/language/statements/class/definition/fn-length-static-precedence-order.js74
-rw-r--r--js/src/tests/test262/language/statements/class/definition/fn-length-static-precedence.js78
-rw-r--r--js/src/tests/test262/language/statements/class/definition/fn-name-accessor-get.js65
-rw-r--r--js/src/tests/test262/language/statements/class/definition/fn-name-accessor-set.js66
-rw-r--r--js/src/tests/test262/language/statements/class/definition/fn-name-gen-method.js60
-rw-r--r--js/src/tests/test262/language/statements/class/definition/fn-name-method.js59
-rw-r--r--js/src/tests/test262/language/statements/class/definition/fn-name-static-precedence-order.js71
-rw-r--r--js/src/tests/test262/language/statements/class/definition/fn-name-static-precedence.js75
-rw-r--r--js/src/tests/test262/language/statements/class/definition/getters-non-configurable-err.js19
-rw-r--r--js/src/tests/test262/language/statements/class/definition/getters-prop-desc.js36
-rw-r--r--js/src/tests/test262/language/statements/class/definition/getters-restricted-ids.js28
-rw-r--r--js/src/tests/test262/language/statements/class/definition/implicit-constructor.js16
-rw-r--r--js/src/tests/test262/language/statements/class/definition/invalid-extends.js23
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-async-super-call-body.js27
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-async-super-call-param.js26
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-no-yield.js22
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-return.js25
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-expression-with-rhs.js120
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-expression-without-rhs.js130
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-function-expression-binding-identifier.js22
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-generator-method-binding-identifier.js31
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-identifier-in-nested-function.js24
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-literal-property-name.js23
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-logical-or-expression.js21
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-parameter.js20
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-property-name.js23
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-statement.js49
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-yield-operand.js33
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-newline.js29
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-star-after-newline.js22
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-star-before-newline.js24
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-gen-yield-weak-binding.js19
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-named-eval-arguments.js28
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods-restricted-properties.js106
-rw-r--r--js/src/tests/test262/language/statements/class/definition/methods.js34
-rw-r--r--js/src/tests/test262/language/statements/class/definition/numeric-property-names.js65
-rw-r--r--js/src/tests/test262/language/statements/class/definition/prototype-getter.js33
-rw-r--r--js/src/tests/test262/language/statements/class/definition/prototype-property.js14
-rw-r--r--js/src/tests/test262/language/statements/class/definition/prototype-setter.js18
-rw-r--r--js/src/tests/test262/language/statements/class/definition/prototype-wiring.js75
-rw-r--r--js/src/tests/test262/language/statements/class/definition/setters-non-configurable-err.js19
-rw-r--r--js/src/tests/test262/language/statements/class/definition/setters-prop-desc.js41
-rw-r--r--js/src/tests/test262/language/statements/class/definition/setters-restricted-ids.js33
-rw-r--r--js/src/tests/test262/language/statements/class/definition/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/definition/side-effects-in-extends.js20
-rw-r--r--js/src/tests/test262/language/statements/class/definition/side-effects-in-property-define.js22
-rw-r--r--js/src/tests/test262/language/statements/class/definition/this-access-restriction-2.js90
-rw-r--r--js/src/tests/test262/language/statements/class/definition/this-access-restriction.js100
-rw-r--r--js/src/tests/test262/language/statements/class/definition/this-check-ordering.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-get-err.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-name-iter-val.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision-step-err.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-name-iter-val.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-init-null.js61
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-init-undefined.js61
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js64
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-init-null.js61
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-init-undefined.js61
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-throws.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-list-err.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-getter.js64
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-get-err-array-prototype.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-get-err.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-name-iter-val.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-val-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-throws.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-step-err.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-undef.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision-step-err.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elem.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-direct.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision-next-err.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-step-err.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-val-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-name-iter-val.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-step-err.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-init-null.js61
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-init-undefined.js61
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-get-value-err.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-throws.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-list-err.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-eval-err.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-getter.js64
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-init-null.js61
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-init-undefined.js61
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-get-value-err.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-throws.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-list-err.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-init.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-value-null.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-eval-err.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-get-value-err.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-throws.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-init.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-null.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-undef.js63
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-getter.js64
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-init-iter-close.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-name-iter-val.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-empty.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-direct.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-direct.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-empty.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-direct.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js71
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js72
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js70
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js73
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js68
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js75
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-close.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-get-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-no-close.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-name-iter-val.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js105
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-id.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision-exhausted.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision-step-err.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-empty.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-elem.js108
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-elision.js114
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-empty.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-rest.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-direct.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-elision.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-ary.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-id.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-obj.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-id.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-obj-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-close.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-get-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-no-close.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-name-iter-val.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js105
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-empty.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js108
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js114
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-init-null.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-init-undefined.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-empty.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-list-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js102
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-init-null.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-init-undefined.js77
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-empty.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-get-value-err.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-skipped.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-throws.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-trailing-comma.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-list-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-eval-err.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js102
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js79
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-getter.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-val-obj.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-close.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-get-err-array-prototype.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-get-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-no-close.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-name-iter-val.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-iter.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-init.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-iter.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-init.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-iter.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-iter.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-val-null.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-exhausted.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-hole.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-skipped.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-throws.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-undef.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-complete.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-done.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-step-err.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js105
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-err.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-null.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-undef.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision-exhausted.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision-step-err.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-empty.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elem.js108
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elision.js114
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-empty.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-rest.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-direct.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision-next-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-exhausted.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-step-err.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-val-err.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-ary.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-id.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-obj.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-ary.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-id.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-obj.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-obj-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-obj-prop-id.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-close.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-no-close.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-name-iter-val.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js105
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-exhausted.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-step-err.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-empty.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js108
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js114
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-direct.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-ary.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-id.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-obj.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-init-null.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-init-undefined.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-empty.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-get-value-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-skipped.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-throws.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-list-err.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-eval-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js102
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-getter.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-val-obj.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-init-null.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-init-undefined.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-empty.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-get-value-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-class.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-cover.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-fn.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-gen.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-skipped.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-throws.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-trailing-comma.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-list-err.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-value-null.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-eval-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-get-value-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-skipped.js102
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-throws.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-null.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-undef.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-getter.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-val-obj.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-close.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-get-err-array-prototype.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-get-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-no-close.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-name-iter-val.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elem-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elem-iter.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elision-init.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elision-iter.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-empty-init.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-empty-iter.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-rest-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-rest-iter.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-val-null.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-exhausted.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-hole.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-skipped.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-throws.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-undef.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-complete.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-done.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-step-err.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js103
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val-err.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-id-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-id.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-prop-id.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-val-null.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-val-undef.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision-exhausted.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision-step-err.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-empty.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-elem.js106
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-elision.js112
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-empty.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-rest.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-direct.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-elision-next-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-elision.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-exhausted.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-iter-step-err.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-iter-val-err.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-ary.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-id.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-obj.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-ary.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-id.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-obj.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-obj-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-obj-prop-id.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-close.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-get-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-no-close.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-name-iter-val.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js103
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-id.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision-exhausted.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision-step-err.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-empty.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js106
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js112
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-direct.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-elision.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-ary.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-id.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-obj.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-obj-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-init-null.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-init-undefined.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-empty.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-get-value-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-skipped.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-throws.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-list-err.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-eval-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-getter.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-val-obj.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-init-null.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-init-undefined.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-empty.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-get-value-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-class.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-cover.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-fn.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-gen.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-skipped.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-throws.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-trailing-comma.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-list-err.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-value-null.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-eval-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-get-value-err.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-skipped.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-throws.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-value-null.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-value-undef.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-getter.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-val-obj.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-close.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-get-err-array-prototype.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-get-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-no-close.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-name-iter-val.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elem-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elem-iter.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elision-init.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elision-iter.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-empty-init.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-empty-iter.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-rest-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-rest-iter.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-val-null.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-exhausted.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-class.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-cover.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-fn.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-gen.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-hole.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-skipped.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-throws.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-undef.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-unresolvable.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-complete.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-done.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-step-err.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js103
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-err.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-id-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-id.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id-init.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-val-null.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-val-undef.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision-exhausted.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision-step-err.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-empty.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-elem.js106
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-elision.js112
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-empty.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-rest.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-direct.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-elision-next-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-elision.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-exhausted.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-iter-step-err.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-iter-val-err.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-ary.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-id.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-obj.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-ary.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-id.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-obj.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-obj-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-obj-prop-id.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-close.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-get-err-array-prototype.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-get-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-no-close.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-name-iter-val.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-init.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-init.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-val-null.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-hole.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-skipped.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-throws.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-undef.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-complete.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-done.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js103
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-null.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-undef.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision-exhausted.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision-step-err.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-empty.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elem.js106
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elision.js112
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-empty.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-rest.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-direct.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-exhausted.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-ary.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-id.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-obj.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-ary.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-id.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-obj.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-prop-id.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-init-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-init-undefined.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-empty.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-get-value-err.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-class.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-skipped.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-throws.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-unresolvable.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-trailing-comma.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-list-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-value-null.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-eval-err.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-get-value-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-skipped.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-throws.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-null.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-undef.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-getter.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-val-obj.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-init-null.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-init-undefined.js74
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-empty.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-get-value-err.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-arrow.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-class.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-cover.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-fn.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-gen.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-skipped.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-throws.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-unresolvable.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-trailing-comma.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-list-err.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-trailing-comma.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-value-null.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-eval-err.js78
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-get-value-err.js83
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-skipped.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-throws.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-unresolvable.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id.js81
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-value-null.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-value-undef.js76
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-getter.js80
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-skip-non-enumerable.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-val-obj.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-init-iter-close.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-init-iter-no-close.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-name-iter-val.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js109
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elision.js105
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-empty.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js112
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js118
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-direct.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-ary.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-obj.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-ary.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-obj.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js109
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js105
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js112
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js118
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-direct.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-ary.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-obj.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js106
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-empty.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js106
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-init-iter-close.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-name-iter-val.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js109
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision.js105
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-empty.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js112
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js118
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-direct.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-ary.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-obj.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-ary.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-obj.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js100
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js109
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js105
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js112
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js118
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js101
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js106
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-empty.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js106
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-init-iter-close.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-init-iter-no-close.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-name-iter-val.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val-array-prototype.js107
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elision-exhausted.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elision.js103
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-empty.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js110
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js116
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-direct.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-elision.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-ary.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-obj.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-ary.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-obj.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-id.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-init-iter-close.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-init-iter-no-close.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-name-iter-val.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js107
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision.js103
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-empty.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js110
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js116
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-direct.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-ary.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-obj.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-ary.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-obj.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-empty.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js104
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-empty.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-skipped.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js104
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-obj-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-obj.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-getter.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-val-obj.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-init-iter-close.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-init-iter-no-close.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-name-iter-val.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js107
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elision.js103
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-empty.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js110
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js116
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-direct.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-ary.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-obj.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-ary.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-obj.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-close.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js98
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-name-iter-val.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js96
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js93
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js107
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js97
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js94
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js103
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js110
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js116
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js99
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-direct.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-ary.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-id.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-obj.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js95
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js104
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-empty.js87
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js88
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js90
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js82
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js104
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js86
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id.js85
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj.js89
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-getter.js84
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js92
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js91
-rw-r--r--js/src/tests/test262/language/statements/class/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/abrupt-completition-on-field-initializer.js55
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-computed-names.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-computed-symbol-names.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-literal-names-asi.js77
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-literal-names.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-field-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-method-getter-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-method-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-names.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-field-identifier-initializer.js87
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-field-identifier.js94
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-getter-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-getter.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-method-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-method.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-setter-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-setter.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-alt.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-initializer-alt.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-initializer.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js124
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt-by-classname.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-by-classname.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-fields.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-methods-with-fields.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-methods.js75
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-gen-string-literal-names.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-computed-names.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-computed-symbol-names.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-grammar-privatename-identifier-semantics-stringvalue.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-literal-names-asi.js77
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-literal-names.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-field-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-method-getter-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-method-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-names.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-field-identifier-initializer.js87
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-field-identifier.js94
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-getter-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-getter.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-method-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-method.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-setter-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-setter.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-alt.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-initializer-alt.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-initializer.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js124
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-alt-by-classname.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-alt.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-by-classname.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-fields.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-methods-with-fields.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-methods.js75
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-method-string-literal-names.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-computed-names.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-computed-symbol-names.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names-asi.js93
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-field-usage.js65
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-method-getter-usage.js65
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-method-usage.js65
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-names.js87
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-field-identifier-initializer.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-field-identifier.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-getter-alt.js144
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-getter.js144
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js143
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-method.js143
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-setter-alt.js143
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-setter.js143
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-alt.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js119
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer.js119
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js151
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js152
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js151
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js152
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js140
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js141
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js138
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js138
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js120
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js120
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js120
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-fields.js87
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-methods.js91
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-string-literal-names.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-computed-names.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-computed-symbol-names.js120
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js124
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-literal-names-asi.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-literal-names.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-field-usage.js64
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-method-getter-usage.js64
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-method-usage.js64
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-names.js86
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-field-identifier-initializer.js102
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-field-identifier.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-getter-alt.js143
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-getter.js143
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-method-alt.js142
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-method.js142
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-setter-alt.js142
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-setter.js142
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-alt.js124
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js118
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer.js118
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier.js124
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js150
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js151
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js150
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js151
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js139
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js140
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js137
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js137
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js119
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js119
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js119
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-fields.js86
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-methods.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-string-literal-names.js124
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-computed-names.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-computed-symbol-names.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-grammar-privatename-identifier-semantics-stringvalue.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-literal-names-asi.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-literal-names.js99
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-field-usage.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-method-getter-usage.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-method-usage.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-names.js74
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-field-identifier-initializer.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-field-identifier.js97
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-getter-alt.js131
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-getter.js131
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-method-alt.js130
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-method.js130
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-setter-alt.js130
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-setter.js130
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-alt.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer-alt.js106
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer.js106
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js137
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js138
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js137
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js138
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt-by-classname.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-by-classname.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-fields.js74
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js91
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-methods.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-string-literal-names.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-computed-names.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-computed-symbol-names.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-grammar-privatename-identifier-semantics-stringvalue.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-literal-names-asi.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-literal-names.js99
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-field-usage.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-method-getter-usage.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-method-usage.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-names.js74
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-field-identifier-initializer.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-field-identifier.js97
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-getter-alt.js131
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-getter.js131
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-method-alt.js130
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-method.js130
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-setter-alt.js130
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-setter.js130
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-alt.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer-alt.js106
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer.js106
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js137
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js138
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js137
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js138
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt-by-classname.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-by-classname.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt-by-classname.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-fields.js74
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-methods-with-fields.js91
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-methods.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-string-literal-names.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-1.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-2.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-1.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-2.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-1.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-2.js29
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-direct-eval-err-contains-arguments.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-direct-eval-err-contains-newtarget.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-indirect-eval-err-contains-newtarget.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-1.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-2.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-1.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-2.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-1.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-2.js29
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-direct-eval-err-contains-arguments.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-body-private-indirect-eval-err-contains-newtarget.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-fnc-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/arrow-fnc-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-identifier-spread-strict-strict.js76
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-identifier-strict-strict.js67
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js77
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js76
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js75
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-single.js77
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-obj.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-next.js247
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-return.js263
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-throw.js271
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js82
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js102
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js101
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js101
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js101
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js101
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js101
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js101
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js95
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js101
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js93
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js93
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js117
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js117
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-next.js250
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-return.js225
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-throw.js231
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-identifier-spread-strict-strict.js86
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-identifier-strict-strict.js77
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js82
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js87
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js86
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js85
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next.js82
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-arr-single.js87
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-obj.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-next.js257
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-return.js273
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-throw.js281
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-expr-abrupt.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js117
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js117
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-next.js260
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-return.js235
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-throw.js241
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-binding-identifier-escaped.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-binding-identifier.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-identifier-reference-escaped.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-identifier-reference.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-label-identifier-escaped.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-label-identifier.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow-returns-arguments-from-parent-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow-returns-newtarget.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function-returns-arguments-from-own-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function-returns-newtarget.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method-static/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-binding-identifier-escaped.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-binding-identifier.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-identifier-reference-escaped.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-identifier-reference.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-label-identifier-escaped.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-label-identifier.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow-returns-arguments-from-parent-function.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow-returns-newtarget.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function-returns-arguments-from-own-function.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function-returns-newtarget.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/async-private-method/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/class-field-is-observable-by-proxy.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/class-field-on-frozen-objects-strict.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/comp-name-init-err-contains-arguments.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/comp-name-init-err-contains-super.js29
-rw-r--r--js/src/tests/test262/language/statements/class/elements/computed-name-toprimitive-symbol.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/computed-name-toprimitive.js120
-rw-r--r--js/src/tests/test262/language/statements/class/elements/computed-property-abrupt-completition.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/ctor-called-after-fields-init.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-contains-superproperty-1.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-contains-superproperty-2.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-contains-superproperty-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-contains-superproperty-2.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/direct-eval-err-contains-arguments.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/direct-eval-err-contains-newtarget.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/equality-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/equality-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/evaluation-error/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-referenceerror.js58
-rw-r--r--js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-err.js60
-rw-r--r--js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-returns-noncallable.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-returns-nonobject.js58
-rw-r--r--js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-tostring-err.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-valueof-err.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/evaluation-error/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/field-declaration.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/field-definition-accessor-no-line-terminator.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fielddefinition-initializer-abrupt-completion.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-anonymous-function-length.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-asi-1.js21
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-asi-2.js19
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-asi-3.js19
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-asi-4.js19
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-asi-5.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-asi-same-line-1.js18
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-asi-same-line-2.js18
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-computed-name-propname-constructor.js54
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-computed-var-propname-constructor.js82
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-computed-var-propname-prototype.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-propname-constructor.js81
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-propname-prototype.js32
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-duplicate-privatenames.js25
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-hash-constructor-is-a-valid-name.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-literal-name-propname-constructor.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-literal-name-static-propname-constructor.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-literal-name-static-propname-prototype.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-string-name-propname-constructor.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-string-name-static-propname-constructor.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/fields-string-name-static-propname-prototype.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-binding-identifier-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-binding-identifier.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-identifier-reference-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-identifier-reference.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-label-identifier-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-label-identifier.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-identifier-spread-strict-strict.js75
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-identifier-strict-strict.js66
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js73
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-arr-single.js75
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-obj.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-binding-identifier-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-binding-identifier.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-identifier-reference-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-identifier-reference.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-label-identifier-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-label-identifier.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-identifier-spread-strict-strict.js85
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-identifier-strict-strict.js76
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js83
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-arr-single.js85
-rw-r--r--js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-obj.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/get-access-of-missing-private-getter.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/get-access-of-missing-private-static-getter.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/get-access-of-missing-shadowed-private-getter.js91
-rw-r--r--js/src/tests/test262/language/statements/class/elements/grammar-private-field-optional-chaining.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/indirect-eval-contains-arguments.js23
-rw-r--r--js/src/tests/test262/language/statements/class/elements/indirect-eval-err-contains-newtarget.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/init-err-evaluation.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/init-value-defined-after-class.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/init-value-incremental.js70
-rw-r--r--js/src/tests/test262/language/statements/class/elements/intercalated-static-non-static-computed-fields.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/literal-name-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/literal-name-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-computed-names.js158
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-computed-symbol-names.js156
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-grammar-privatename-identifier-semantics-stringvalue.js160
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-literal-names-asi.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-literal-names.js147
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-field-usage.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-method-getter-usage.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-method-usage.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-names.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-field-identifier-initializer.js138
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-field-identifier.js145
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-getter-alt.js179
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-getter.js179
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-method-alt.js178
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-method.js178
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-setter-alt.js178
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-setter.js178
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-alt.js160
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-initializer-alt.js154
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-initializer.js154
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier.js160
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js185
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js186
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js185
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js186
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js175
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js176
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js173
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js173
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-alt-by-classname.js161
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-alt.js161
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-by-classname.js161
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js155
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js155
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer.js155
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier.js161
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-fields.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-methods-with-fields.js139
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-methods.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-definitions-string-literal-names.js160
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-computed-names.js130
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-computed-symbol-names.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-grammar-privatename-identifier-semantics-stringvalue.js132
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-literal-names-asi.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-literal-names.js119
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-field-usage.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-method-getter-usage.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-method-usage.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-names.js94
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier.js117
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-getter-alt.js151
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-getter.js151
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-method-alt.js150
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-method.js150
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-setter-alt.js150
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-setter.js150
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-alt.js132
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer-alt.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier.js132
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js157
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js158
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js157
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js158
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js147
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js148
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js145
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js145
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt-by-classname.js133
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt.js133
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-by-classname.js133
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier.js133
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-fields.js94
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-methods.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-string-literal-names.js132
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-arrow-fnc-init-err-contains-arguments.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-arrow-fnc-init-err-contains-super.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-comp-name-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-comp-name-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-contains-superproperty-1.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-contains-superproperty-2.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-2.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-direct-eval-err-contains-arguments.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-direct-eval-err-contains-newtarget.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-equality-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-equality-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-indirect-eval-contains-arguments.js25
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-indirect-eval-err-contains-newtarget.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-literal-name-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-literal-name-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-arrow-fnc-init-err-contains-arguments.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-arrow-fnc-init-err-contains-super.js32
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-1.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-2.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-2.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-direct-eval-err-contains-arguments.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-direct-eval-err-contains-newtarget.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-indirect-eval-contains-arguments.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-indirect-eval-err-contains-newtarget.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-literal-name-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-literal-name-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-ternary-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-ternary-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-typeof-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-private-typeof-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-static-comp-name-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-static-comp-name-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-static-literal-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-static-literal-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-static-private-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-static-private-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-static-string-literal-name-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-static-string-literal-name-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-string-literal-name-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-string-literal-name-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-ternary-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-ternary-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-typeof-init-err-contains-arguments.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/nested-typeof-init-err-contains-super.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-computed-names.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-computed-symbol-names.js106
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-literal-names-asi.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-literal-names.js97
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-field-usage.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-method-getter-usage.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-method-usage.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-names.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier.js95
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-getter-alt.js129
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-getter.js129
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-method-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-method.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-setter-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-setter.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-alt.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer-alt.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js136
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js136
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-by-classname.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-fields.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js89
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-methods.js76
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-string-literal-names.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-computed-names.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-computed-symbol-names.js106
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-grammar-privatename-identifier-semantics-stringvalue.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-literal-names-asi.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-literal-names.js97
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-field-usage.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-method-getter-usage.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-method-usage.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-names.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-field-identifier-initializer.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-field-identifier.js95
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-getter-alt.js129
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-getter.js129
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-method-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-method.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-setter-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-setter.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-alt.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer-alt.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js136
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js136
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt-by-classname.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-by-classname.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-fields.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-methods-with-fields.js89
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-methods.js76
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-string-literal-names.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-computed-names.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-computed-symbol-names.js106
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-literal-names-asi.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-literal-names.js97
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-field-usage.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-method-getter-usage.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-method-usage.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-names.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-field-identifier-initializer.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-field-identifier.js95
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-getter-alt.js129
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-getter.js129
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-method-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-method.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-setter-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-setter.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-alt.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-initializer-alt.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-initializer.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js136
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js136
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-by-classname.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-fields.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-methods-with-fields.js89
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-methods.js76
-rw-r--r--js/src/tests/test262/language/statements/class/elements/new-sc-line-method-string-literal-names.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-is-visible-in-computed-properties.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-ZWJ.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-ZWNJ.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-u2118.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-u6F.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-ZWJ.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-ZWNJ.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-common.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-dollar.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-u2118.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-underscore.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-ZWJ.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-ZWNJ.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-u2118.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-u6F.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-ZWJ.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-ZWNJ.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-common.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-dollar.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-u2118.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-underscore.js79
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-arrow-fnc-init-err-contains-arguments.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-arrow-fnc-init-err-contains-super.js29
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-async-generator-method-name.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-async-method-name.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-class-field-on-frozen-objects-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-contains-superproperty-1.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-contains-superproperty-2.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-contains-superproperty-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-contains-superproperty-2.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-direct-eval-err-contains-arguments.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-direct-eval-err-contains-newtarget.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-access-on-inner-arrow-function.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-access-on-inner-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-after-optional-chain.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-as-arrow-function.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-as-async-arrow-function.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-as-async-function.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-as-function.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-is-not-clobbered-by-computed-property.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-is-visible-in-computed-properties.js51
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-on-nested-class.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-visible-to-direct-eval-on-initializer.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-visible-to-direct-eval.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-field-with-initialized-id-is-visible-in-computed-properties.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-generator-method-name.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-access-on-inner-arrow-function.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-access-on-inner-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-brand-check-multiple-evaluations-of-class.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-brand-check-super-class.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-brand-check.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-is-not-a-own-property.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-is-not-clobbered-by-computed-property.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-on-nested-class.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-field-on-nested-class.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-getter-on-nested-class.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-method-on-nested-class.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-setter-on-nested-class.js51
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-visible-to-direct-eval-on-initializer.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-getter-visible-to-direct-eval.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-indirect-eval-contains-arguments.js25
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-indirect-eval-err-contains-newtarget.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-literal-name-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-literal-name-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-access-on-inner-arrow-function.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-access-on-inner-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-brand-check-multiple-evaluations-of-class.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-brand-check-super-class.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-brand-check.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-comparison-multiple-evaluations-of-class.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-comparison.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-get-and-set.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-get.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-set.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-get-and-call.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-is-not-a-own-property.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-is-not-clobbered-by-computed-property.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-is-visible-in-computed-properties.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-length.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-not-writable.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-on-nested-class.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-referenced-from-static-method.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-field-on-nested-class.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-getter-on-nested-class.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-setter-on-nested-class.js51
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-shadowed-on-nested-class.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-visible-to-direct-eval-on-initializer.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-method-visible-to-direct-eval.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-methods/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-async-generator.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-async-method.js129
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-generator.js126
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-method-initialize-order.js141
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-method.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-methods/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-access-on-inner-arrow-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-access-on-inner-function.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-brand-check-multiple-evaluations-of-class.js51
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-brand-check-super-class.js55
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-brand-check.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-is-not-a-own-property.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-is-not-clobbered-by-computed-property.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-on-nested-class.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-field-on-nested-class.js53
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-getter-on-nested-class.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-method-on-nested-class.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-setter-on-nested-class.js51
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-visible-to-direct-eval-on-initializer.js50
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-setter-visible-to-direct-eval.js63
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-async-generator-method-name.js62
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-async-method-name.js62
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-field-on-nested-class.js91
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-getter-on-nested-class.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-method-on-nested-class.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-setter-on-nested-class.js93
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-field-usage-inside-nested-class.js81
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-field-visible-to-direct-eval.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-generator-method-name.js62
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-getter-abrupt-completition.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-getter-visible-to-direct-eval.js63
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-method-length.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-method-name.js73
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-method-not-writable.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-field-on-nested-class.js91
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-getter-on-nested-class.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-method-on-nested-class.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-setter-on-nested-class.js93
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-method-usage-inside-nested-class.js83
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-method-visible-to-direct-eval.js63
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-setter-abrupt-completition.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-static-setter-visible-to-direct-eval.js64
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-ternary-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-ternary-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-typeof-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/private-typeof-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefield-on-proxy.js55
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldadd-typeerror.js63
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-primitive-receiver.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-success-1.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-success-2.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-success-3.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-success-4.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-success-5.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-1.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-2.js57
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-3.js55
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-4.js55
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-5.js60
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldput-primitive-receiver.js78
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-1.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-2.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-3.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-1.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-10.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-11.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-2.js57
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-3.js66
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-4.js55
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-5.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-6.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-7.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-8.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-9.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privategetter-on-proxy.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatemethods-on-proxy.js57
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-1.js25
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-2.js25
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-3.js23
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-4.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-5.js25
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-6.js23
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-7.js23
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-8.js23
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-1.js29
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-2.js29
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-3.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-4.js32
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-5.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-6.js24
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-7.js24
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-8.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/privatename-valid-no-earlyerr.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/prod-private-getter-before-super-return-in-constructor.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/prod-private-getter-before-super-return-in-field-initializer.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/prod-private-method-before-super-return-in-constructor.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/prod-private-method-before-super-return-in-field-initializer.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/prod-private-setter-before-super-return-in-constructor.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/prod-private-setter-before-super-return-in-field-initializer.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/public-class-field-initialization-is-visible-to-proxy.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/public-class-field-initialization-on-super-class-with-setter.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/redeclaration-symbol.js63
-rw-r--r--js/src/tests/test262/language/statements/class/elements/redeclaration.js63
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-computed-names.js94
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-computed-symbol-names.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-grammar-privatename-identifier-semantics-stringvalue.js95
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-literal-names-asi.js64
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-literal-names.js83
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-private-field-usage.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-private-method-getter-usage.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-private-method-usage.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-private-names.js57
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-field-identifier-initializer.js73
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-field-identifier.js80
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-getter-alt.js114
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-getter.js114
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-method-alt.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-method.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-setter-alt.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-setter.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-alt.js95
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-initializer-alt.js89
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-initializer.js89
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier.js95
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js120
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js120
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js111
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-alt-by-classname.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-alt.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-by-classname.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-fields.js57
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-methods-with-fields.js74
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-methods.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/regular-definitions-string-literal-names.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-computed-names.js120
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-computed-symbol-names.js118
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-literal-names-asi.js90
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-literal-names.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-field-usage.js62
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-method-getter-usage.js62
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-method-usage.js62
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-names.js84
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-field-identifier-initializer.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-field-identifier.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-getter-alt.js141
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-getter.js141
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-method-alt.js140
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-method.js140
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-setter-alt.js140
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-setter.js140
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-alt.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-initializer-alt.js116
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-initializer.js116
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js148
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js149
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js148
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js149
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js137
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js138
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-by-classname.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js117
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js117
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer.js117
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-fields.js84
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-methods-with-fields.js101
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-methods.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-gen-string-literal-names.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-computed-names.js119
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-computed-symbol-names.js117
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-literal-names-asi.js89
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-literal-names.js108
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-field-usage.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-method-getter-usage.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-method-usage.js61
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-names.js83
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-field-identifier-initializer.js99
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-field-identifier.js106
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-getter-alt.js140
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-getter.js140
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-method-alt.js139
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-method.js139
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-setter-alt.js139
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-setter.js139
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-alt.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-initializer-alt.js115
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-initializer.js115
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js147
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js148
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js147
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js148
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js136
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js137
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-alt.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-by-classname.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js116
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt.js116
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer.js116
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-fields.js83
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-methods-with-fields.js100
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-methods.js87
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-async-method-string-literal-names.js121
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-computed-names.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-computed-symbol-names.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-literal-names-asi.js77
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-literal-names.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-private-field-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-private-method-getter-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-private-method-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-private-names.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-field-identifier-initializer.js87
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-field-identifier.js94
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-getter-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-getter.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-method-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-method.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-setter-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-setter.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-alt.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-initializer-alt.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-initializer.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js124
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-alt-by-classname.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-alt.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-by-classname.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-fields.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-methods-with-fields.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-methods.js75
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-gen-string-literal-names.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-computed-names.js107
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-computed-symbol-names.js105
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-grammar-privatename-identifier-semantics-stringvalue.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-literal-names-asi.js77
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-literal-names.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-private-field-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-private-method-getter-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-private-method-usage.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-private-names.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-field-identifier-initializer.js87
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-field-identifier.js94
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-getter-alt.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-getter.js128
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-method-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-method.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-setter-alt.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-setter.js127
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-alt.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-initializer-alt.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-initializer.js103
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js134
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js135
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js124
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js125
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-alt-by-classname.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-alt.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-by-classname.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer.js104
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-fields.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-methods-with-fields.js88
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-methods.js75
-rw-r--r--js/src/tests/test262/language/statements/class/elements/same-line-method-string-literal-names.js109
-rw-r--r--js/src/tests/test262/language/statements/class/elements/set-access-of-missing-private-setter.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/set-access-of-missing-private-static-setter.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/set-access-of-missing-shadowed-private-setter.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/set-access-of-private-method.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/set-access-of-shadowed-private-method.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-as-valid-instance-field-assigned.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-as-valid-instance-field.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-as-valid-static-field-assigned.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-as-valid-static-field.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-comp-name-init-err-contains-arguments.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-comp-name-init-err-contains-super.js29
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-field-anonymous-function-length.js63
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-field-anonymous-function-name.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-field-declaration.js132
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-field-init-this-inside-arrow-function.js65
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-field-init-with-this.js69
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-field-initializer-error.js60
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-field-redeclaration.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-fielddefinition-initializer-abrupt-completion.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-literal-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-literal-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-fields-proxy-default-handler-throws.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-arrow-function.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-class.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-function.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-getter.js57
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-method-access-on-inner-arrow-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-method-access-on-inner-function.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-method-and-instance-method-brand-check.js66
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-method-referenced-from-instance-method.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-method-subclass-receiver.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-arrow-function.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-class.js46
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-function.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-private-setter.js58
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-string-literal-name-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/static-string-literal-name-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/string-literal-name-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/string-literal-name-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/super-access-from-arrow-func-on-field.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-method.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-setter.js52
-rw-r--r--js/src/tests/test262/language/statements/class/elements/super-fielddefinition-initializer-abrupt-completion.js58
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-get.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-set.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async-gen.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-gen.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-no-reference.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-privatename.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-get.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-set.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async-gen.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-gen.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-no-reference.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-privatename.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-get.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-set.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async-gen.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-gen.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-no-reference.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-privatename.js39
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-get.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-set.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async-gen.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-gen.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method.js38
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-no-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-privatename.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-gen.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-no-reference.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-privatename.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-gen.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-no-reference.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-privatename.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-get.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-set.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async-gen.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-gen.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-no-reference.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-privatename.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-get.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-set.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async-gen.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-gen.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-no-reference.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-privatename.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-get.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-set.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async-gen.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-gen.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-no-reference.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-privatename.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-get.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-set.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async-gen.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-gen.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method.js42
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-no-reference.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-privatename.js41
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-gen.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-no-reference.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-privatename.js49
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-gen.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method.js48
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-no-reference.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-privatename.js47
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-class-body-ctor-duplicate.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-ues-error.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js71
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-fields-same-line-error.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-array-literal.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-obj-literal.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js33
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-field-super-access.js36
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async-gen.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-gen.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-constructor.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-error.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-ues.js65
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js66
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js66
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js53
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-get-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-set-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-gen-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-call-expr.js40
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field-init.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-gen-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-member-expr.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-meth.case.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-get-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-set-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-gen-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field-init.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-gen-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-meth.js30
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatenames-same-line-error.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async-gen.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-gen.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-get.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-method.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async-gen.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-gen.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-method.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-set.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-meth-prototype.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-constructor.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-meth-constructor.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-gen-meth-constructor.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-gen-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-meth-constructor.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-privatename-constructor.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js58
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js58
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js58
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js58
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js45
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js43
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-async-generator-cannot-escape-token.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-async-method-cannot-escape-token.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-call-exp-cannot-escape-token.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-field-cannot-escape-token.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-generator-cannot-escape-token.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-member-exp-cannot-escape-token.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-method-cannot-escape-token.js26
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/early-errors/super-private-access-invalid.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js24
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-accessor.js27
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier-alt.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier.js72
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-fields-multi-line.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js23
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js69
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js69
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-identifier.js66
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatenames-multi-line.js34
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js58
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js51
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js51
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js51
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js51
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js32
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js31
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js22
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js22
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js22
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-meth-prototype.js22
-rw-r--r--js/src/tests/test262/language/statements/class/elements/syntax/valid/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/elements/ternary-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/ternary-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/typeof-init-err-contains-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/class/elements/typeof-init-err-contains-super.js28
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-computed-names.js96
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-computed-symbol-names.js94
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-grammar-privatename-identifier-semantics-stringvalue.js97
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-literal-names-asi.js66
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-literal-names.js85
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-field-usage.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-method-getter-usage.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-method-usage.js37
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-names.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-field-identifier-initializer.js75
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-field-identifier.js82
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-getter-alt.js116
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-getter.js116
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-method-alt.js115
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-method.js115
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-setter-alt.js115
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-setter.js115
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-alt.js97
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer-alt.js91
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer.js91
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier.js97
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js122
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js123
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js112
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js113
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js110
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt-by-classname.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-by-classname.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt-by-classname.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer.js92
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier.js98
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-fields.js59
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-methods-with-fields.js76
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-methods.js63
-rw-r--r--js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-string-literal-names.js98
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-length-dflt.js69
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-param-dflt-yield.js28
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/array-destructuring-param-strict-body.js157
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-abrupt.js88
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-arg-val-not-undefined.js112
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-arg-val-undefined.js95
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-duplicates.js86
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-later.js89
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-prior.js92
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-self.js89
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-rest.js90
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-trailing-comma.js87
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/cls-decl-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js38
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/cls-decl-gen-meth-static-forbidden-ext-direct-access-prop-caller.js38
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js64
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js64
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js64
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/object-destructuring-param-strict-body.js157
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/params-trailing-comma-multiple.js87
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/params-trailing-comma-single.js86
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/rest-param-strict-body.js157
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/rest-params-trailing-comma-early-error.js83
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-as-binding-identifier-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-as-binding-identifier.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-as-identifier-reference-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-as-identifier-reference.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-as-label-identifier-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-as-label-identifier.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-identifier-spread-strict-strict.js54
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-identifier-strict-strict.js45
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-arr-multiple.js52
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-arr-single.js54
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-obj.js57
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/array-destructuring-param-strict-body.js157
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/dflt-params-abrupt.js87
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/dflt-params-arg-val-not-undefined.js112
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/dflt-params-arg-val-undefined.js95
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/dflt-params-duplicates.js86
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-later.js88
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-prior.js92
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-self.js88
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/dflt-params-rest.js90
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/dflt-params-trailing-comma.js87
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/cls-decl-gen-meth-forbidden-ext-direct-access-prop-arguments.js37
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/cls-decl-gen-meth-forbidden-ext-direct-access-prop-caller.js37
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js63
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js63
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-prop-caller.js63
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/object-destructuring-param-strict-body.js157
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/params-trailing-comma-multiple.js87
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/params-trailing-comma-single.js86
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/rest-param-strict-body.js157
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/rest-params-trailing-comma-early-error.js83
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-as-binding-identifier-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-as-binding-identifier.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-as-identifier-reference-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-as-identifier-reference.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-as-label-identifier-escaped.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-as-label-identifier.js36
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-identifier-spread-strict-strict.js54
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-identifier-strict-strict.js45
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-spread-arr-multiple.js52
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-spread-arr-single.js54
-rw-r--r--js/src/tests/test262/language/statements/class/gen-method/yield-spread-obj.js57
-rw-r--r--js/src/tests/test262/language/statements/class/getter-param-dflt.js24
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-break-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-case-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-catch-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-class-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-const-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-continue-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-debugger-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-default-escaped-ext.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-default-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-default.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-delete-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-do-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-else-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-enum-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-export-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-extends-escaped-ext.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-extends-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-extends.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-finally-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-for-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-function-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-if-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-implements-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-import-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-in-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-instanceof-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-interface-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-let-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-new-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-package-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-private-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-protected-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-public-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-return-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-static-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-super-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-switch-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-this-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-throw-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-try-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-typeof-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-var-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-void-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-while-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/ident-name-method-def-with-escaped.js48
-rw-r--r--js/src/tests/test262/language/statements/class/method-length-dflt.js69
-rw-r--r--js/src/tests/test262/language/statements/class/method-param-yield.js23
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/array-destructuring-param-strict-body.js154
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/dflt-params-abrupt.js84
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/dflt-params-arg-val-not-undefined.js109
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/dflt-params-arg-val-undefined.js92
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/dflt-params-duplicates.js83
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-later.js85
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-prior.js89
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-self.js85
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/dflt-params-rest.js87
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/dflt-params-trailing-comma.js83
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/cls-decl-meth-static-forbidden-ext-direct-access-prop-arguments.js37
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/cls-decl-meth-static-forbidden-ext-direct-access-prop-caller.js37
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js63
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js63
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-prop-caller.js63
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/object-destructuring-param-strict-body.js154
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/params-trailing-comma-multiple.js83
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/params-trailing-comma-single.js82
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/rest-param-strict-body.js154
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/rest-params-trailing-comma-early-error.js79
-rw-r--r--js/src/tests/test262/language/statements/class/method-static/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method/array-destructuring-param-strict-body.js154
-rw-r--r--js/src/tests/test262/language/statements/class/method/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method/dflt-params-abrupt.js84
-rw-r--r--js/src/tests/test262/language/statements/class/method/dflt-params-arg-val-not-undefined.js109
-rw-r--r--js/src/tests/test262/language/statements/class/method/dflt-params-arg-val-undefined.js92
-rw-r--r--js/src/tests/test262/language/statements/class/method/dflt-params-duplicates.js83
-rw-r--r--js/src/tests/test262/language/statements/class/method/dflt-params-ref-later.js85
-rw-r--r--js/src/tests/test262/language/statements/class/method/dflt-params-ref-prior.js89
-rw-r--r--js/src/tests/test262/language/statements/class/method/dflt-params-ref-self.js85
-rw-r--r--js/src/tests/test262/language/statements/class/method/dflt-params-rest.js87
-rw-r--r--js/src/tests/test262/language/statements/class/method/dflt-params-trailing-comma.js83
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/cls-decl-meth-forbidden-ext-direct-access-prop-arguments.js37
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/cls-decl-meth-forbidden-ext-direct-access-prop-caller.js37
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-own-prop-caller-get.js63
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-own-prop-caller-value.js63
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-prop-caller.js63
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/method/object-destructuring-param-strict-body.js154
-rw-r--r--js/src/tests/test262/language/statements/class/method/params-trailing-comma-multiple.js83
-rw-r--r--js/src/tests/test262/language/statements/class/method/params-trailing-comma-single.js82
-rw-r--r--js/src/tests/test262/language/statements/class/method/rest-param-strict-body.js154
-rw-r--r--js/src/tests/test262/language/statements/class/method/rest-params-trailing-comma-early-error.js79
-rw-r--r--js/src/tests/test262/language/statements/class/method/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/name-binding/basic.js38
-rw-r--r--js/src/tests/test262/language/statements/class/name-binding/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/name-binding/const.js33
-rw-r--r--js/src/tests/test262/language/statements/class/name-binding/expression.js43
-rw-r--r--js/src/tests/test262/language/statements/class/name-binding/in-extends-expression-assigned.js12
-rw-r--r--js/src/tests/test262/language/statements/class/name-binding/in-extends-expression-grouped.js13
-rw-r--r--js/src/tests/test262/language/statements/class/name-binding/in-extends-expression.js12
-rw-r--r--js/src/tests/test262/language/statements/class/name-binding/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/name.js23
-rw-r--r--js/src/tests/test262/language/statements/class/params-dflt-gen-meth-args-unmapped.js106
-rw-r--r--js/src/tests/test262/language/statements/class/params-dflt-gen-meth-ref-arguments.js85
-rw-r--r--js/src/tests/test262/language/statements/class/params-dflt-gen-meth-static-args-unmapped.js106
-rw-r--r--js/src/tests/test262/language/statements/class/params-dflt-gen-meth-static-ref-arguments.js85
-rw-r--r--js/src/tests/test262/language/statements/class/params-dflt-meth-args-unmapped.js104
-rw-r--r--js/src/tests/test262/language/statements/class/params-dflt-meth-ref-arguments.js83
-rw-r--r--js/src/tests/test262/language/statements/class/params-dflt-meth-static-args-unmapped.js104
-rw-r--r--js/src/tests/test262/language/statements/class/params-dflt-meth-static-ref-arguments.js83
-rw-r--r--js/src/tests/test262/language/statements/class/poisoned-underscore-proto.js30
-rw-r--r--js/src/tests/test262/language/statements/class/private-non-static-getter-static-setter-early-error.js20
-rw-r--r--js/src/tests/test262/language/statements/class/private-non-static-setter-static-getter-early-error.js20
-rw-r--r--js/src/tests/test262/language/statements/class/private-static-getter-non-static-setter-early-error.js20
-rw-r--r--js/src/tests/test262/language/statements/class/private-static-setter-non-static-getter-early-error.js20
-rw-r--r--js/src/tests/test262/language/statements/class/restricted-properties.js62
-rw-r--r--js/src/tests/test262/language/statements/class/scope-gen-meth-paramsbody-var-close.js40
-rw-r--r--js/src/tests/test262/language/statements/class/scope-gen-meth-paramsbody-var-open.js38
-rw-r--r--js/src/tests/test262/language/statements/class/scope-meth-paramsbody-var-close.js39
-rw-r--r--js/src/tests/test262/language/statements/class/scope-meth-paramsbody-var-open.js37
-rw-r--r--js/src/tests/test262/language/statements/class/scope-name-lex-close.js24
-rw-r--r--js/src/tests/test262/language/statements/class/scope-name-lex-open-heritage.js48
-rw-r--r--js/src/tests/test262/language/statements/class/scope-name-lex-open-no-heritage.js47
-rw-r--r--js/src/tests/test262/language/statements/class/scope-setter-paramsbody-var-close.js39
-rw-r--r--js/src/tests/test262/language/statements/class/scope-setter-paramsbody-var-open.js37
-rw-r--r--js/src/tests/test262/language/statements/class/scope-static-gen-meth-paramsbody-var-close.js40
-rw-r--r--js/src/tests/test262/language/statements/class/scope-static-gen-meth-paramsbody-var-open.js38
-rw-r--r--js/src/tests/test262/language/statements/class/scope-static-meth-paramsbody-var-close.js39
-rw-r--r--js/src/tests/test262/language/statements/class/scope-static-meth-paramsbody-var-open.js37
-rw-r--r--js/src/tests/test262/language/statements/class/scope-static-setter-paramsbody-var-close.js39
-rw-r--r--js/src/tests/test262/language/statements/class/scope-static-setter-paramsbody-var-open.js37
-rw-r--r--js/src/tests/test262/language/statements/class/setter-length-dflt.js41
-rw-r--r--js/src/tests/test262/language/statements/class/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/static-classelementname-abrupt-completion.js35
-rw-r--r--js/src/tests/test262/language/statements/class/static-gen-method-param-dflt-yield.js28
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-abrupt.js48
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-arguments-functions.js42
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-arguments-methods.js60
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-await-binding-invalid.js27
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-await-binding-valid.js20
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-expr-new-target.js25
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-expr-this.js25
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-arguments.js24
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-await.js34
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-label-dup.js25
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-lex-dup.js25
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-lex-var.js26
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-return.js28
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-super-call.js23
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-undefined-break-target.js26
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-undefined-continue-target.js26
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-invalid-yield.js28
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-scope-lex-close.js29
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-scope-lex-derived.js25
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-scope-lex-open.js33
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-scope-private.js27
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-scope-var-close.js29
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-scope-var-derived.js26
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-scope-var-open.js33
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-sequence.js40
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-statement-list-optional.js20
-rw-r--r--js/src/tests/test262/language/statements/class/static-init-super-property.js26
-rw-r--r--js/src/tests/test262/language/statements/class/static-method-gen-non-configurable-err.js19
-rw-r--r--js/src/tests/test262/language/statements/class/static-method-length-dflt.js69
-rw-r--r--js/src/tests/test262/language/statements/class/static-method-non-configurable-err.js18
-rw-r--r--js/src/tests/test262/language/statements/class/static-method-param-yield.js23
-rw-r--r--js/src/tests/test262/language/statements/class/strict-mode/arguments-callee.js18
-rw-r--r--js/src/tests/test262/language/statements/class/strict-mode/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/strict-mode/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/strict-mode/with.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-AggregateError.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Array.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-ArrayBuffer.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-BigInt64Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-BigUint64Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Boolean.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-DataView.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Date.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Error.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-EvalError.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Float32Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Float64Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Function.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int16Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int32Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int8Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Map.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Number.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Object.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Promise.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-RangeError.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-ReferenceError.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-RegExp.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Set.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-SharedArrayBuffer.js18
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-String.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-SyntaxError.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-TypeError.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-URIError.js16
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint16Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint32Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint8Array.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint8ClampedArray.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakMap.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakRef.js18
-rw-r--r--js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakSet.js17
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/binding.js54
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-single-argument.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js38
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js35
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/super-must-be-called.js35
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/regular-subclassing.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/super-must-be-called.js33
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/regular-subclassing.js30
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/super-must-be-called.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/regular-subclassing.js39
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/super-must-be-called.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/message-property-assignment.js38
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/regular-subclassing.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/super-must-be-called.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-length.js29
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-name.js41
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/regular-subclassing.js22
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/super-must-be-called.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-length.js33
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-name.js48
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-prototype.js40
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/regular-subclassing.js31
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.js40
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-message.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-name.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-super.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/regular-subclassing.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-return-undefined-throws.js47
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js42
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/regular-subclassing.js22
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/replacing-prototype.js23
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/regular-subclassing.js38
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/super-must-be-called.js35
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/no-prototype-throws.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/lastIndex.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/regular-subclassing.js25
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/regular-subclassing.js28
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/super-must-be-called.js34
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/length.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/regular-subclassing.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/super-must-be-called.js33
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/new-symbol-with-super-throws.js38
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/symbol-valid-as-extends-value.js19
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/regular-subclassing.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/super-must-be-called.js47
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/regular-subclassing.js31
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/super-must-be-called.js36
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js30
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.js36
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtin-objects/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/builtins.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-evaluation-empty-constructor-heritage-present.js37
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-contains-return-override.js35
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js41
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-super.js54
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-this.js41
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto.js31
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/class-definition-parent-proto-null.js26
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/default-constructor-2.js65
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/default-constructor-spread-override.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/default-constructor.js22
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally-arrow.js29
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally.js26
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super-arrow.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch.js26
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super-arrow.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of-arrow.js40
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of.js39
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-boolean.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-empty.js42
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-null.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-number.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-object.js42
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-string.js32
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-symbol.js33
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-this.js43
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-undefined.js43
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-arrow-function.js53
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-async-function.js53
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-async-generator-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-bound-function.js27
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-generator-function.js44
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-constructor.js20
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-method-override.js24
-rw-r--r--js/src/tests/test262/language/statements/class/subclass/superclass-static-method-override.js23
-rw-r--r--js/src/tests/test262/language/statements/class/super/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-constructor-superproperty-evaluation.js19
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-constructor.js23
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-getter.js24
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-methods.js24
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-setter.js25
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-static-getter.js24
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-static-methods.js24
-rw-r--r--js/src/tests/test262/language/statements/class/super/in-static-setter.js25
-rw-r--r--js/src/tests/test262/language/statements/class/super/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-body-has-direct-super-class-heritage.js25
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-body-method-definition-super-property.js25
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-declaration-binding-identifier-class-element-list.js37
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-declaration-computed-method-definition.js32
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-declaration-computed-method-generator-definition.js32
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-declaration-heritage-identifier-reference-class-element-list.js56
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-expression-binding-identifier-opt-class-element-list.js41
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-expression-heritage-identifier-reference.js18
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-expression.js12
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/class-method-propname-constructor.js19
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/early-errors/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js19
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js17
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/early-errors/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/escaped-static.js26
-rw-r--r--js/src/tests/test262/language/statements/class/syntax/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/const/block-local-closure-get-before-initialization.js20
-rw-r--r--js/src/tests/test262/language/statements/const/block-local-use-before-initialization-in-declaration-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/block-local-use-before-initialization-in-prior-statement.js16
-rw-r--r--js/src/tests/test262/language/statements/const/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/const/cptn-value.js27
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-init-iter-close.js47
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-init-iter-get-err-array-prototype.js42
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-init-iter-get-err.js36
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-init-iter-no-close.js47
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-name-iter-val.js46
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elem-init.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elem-iter.js39
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elision-init.js45
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elision-iter.js42
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-empty-init.js41
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-empty-iter.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-rest-init.js42
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-rest-iter.js45
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-val-null.js43
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-exhausted.js37
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-class.js40
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-cover.js39
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-fn.js39
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-gen.js40
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-hole.js33
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-skipped.js42
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-throws.js34
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-undef.js36
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-complete.js40
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-done.js35
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-step-err.js43
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js56
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val-err.js54
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val.js46
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-id-init.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-id.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-prop-id-init.js48
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-prop-id.js48
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-val-null.js43
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-val-undef.js43
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision-exhausted.js43
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision-step-err.js50
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision.js52
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-empty.js35
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-elem.js59
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-elision.js65
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-empty.js48
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-rest.js44
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-direct.js39
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-elision-next-err.js36
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-elision.js40
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-exhausted.js36
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-iter-step-err.js47
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-iter-val-err.js49
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id.js37
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-ary.js33
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-id.js33
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-obj.js33
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-ary.js33
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-id.js33
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-obj.js33
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-obj-id.js37
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-obj-prop-id.js44
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-init-null.js30
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-init-undefined.js30
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-empty.js36
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-get-value-err.js37
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-arrow.js37
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-class.js39
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-cover.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-fn.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-gen.js39
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-skipped.js41
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-throws.js37
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-trailing-comma.js31
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-list-err.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-init.js40
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-trailing-comma.js31
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-value-null.js32
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-eval-err.js34
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-get-value-err.js39
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-skipped.js53
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-throws.js37
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init.js34
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-trailing-comma.js35
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id.js34
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-init.js40
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-value-null.js32
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-value-undef.js32
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj.js38
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-getter.js33
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-skip-non-enumerable.js41
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-val-obj.js40
-rw-r--r--js/src/tests/test262/language/statements/const/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/const/fn-name-arrow.js26
-rw-r--r--js/src/tests/test262/language/statements/const/fn-name-class.js32
-rw-r--r--js/src/tests/test262/language/statements/const/fn-name-cover.js30
-rw-r--r--js/src/tests/test262/language/statements/const/fn-name-fn.js29
-rw-r--r--js/src/tests/test262/language/statements/const/fn-name-gen.js30
-rw-r--r--js/src/tests/test262/language/statements/const/function-local-closure-get-before-initialization.js19
-rw-r--r--js/src/tests/test262/language/statements/const/function-local-use-before-initialization-in-declaration-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/function-local-use-before-initialization-in-prior-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/global-closure-get-before-initialization.js18
-rw-r--r--js/src/tests/test262/language/statements/const/global-use-before-initialization-in-declaration-statement.js13
-rw-r--r--js/src/tests/test262/language/statements/const/global-use-before-initialization-in-prior-statement.js13
-rw-r--r--js/src/tests/test262/language/statements/const/redeclaration-error-from-within-strict-mode-function-const.js16
-rw-r--r--js/src/tests/test262/language/statements/const/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/const/static-init-await-binding-invalid.js27
-rw-r--r--js/src/tests/test262/language/statements/const/static-init-await-binding-valid.js20
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-without-initialiser.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/const-declaring-let-split-across-two-lines.js20
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-next-expression-for.js13
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-statement-body-for-in.js13
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-statement-body-for-of.js13
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/const-outer-inner-let-bindings.js24
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/const.js23
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/with-initializer-case-expression-statement-list.js11
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/with-initializer-default-statement-list.js11
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/with-initializer-do-statement-while-expression.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/with-initializer-for-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/with-initializer-if-expression-statement-else-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/with-initializer-if-expression-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/with-initializer-label-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/with-initializer-while-expression-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/without-initializer-case-expression-statement-list.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/without-initializer-default-statement-list.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/without-initializer-do-statement-while-expression.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/without-initializer-for-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/without-initializer-if-expression-statement-else-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/without-initializer-if-expression-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/without-initializer-label-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/const/syntax/without-initializer-while-expression-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/continue/12.7-1.js20
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A1_T1.js24
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A1_T2.js26
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A1_T3.js28
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A1_T4.js26
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A5_T1.js32
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A5_T2.js32
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A5_T3.js33
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A6.js24
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A7.js31
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A8_T1.js23
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A8_T2.js19
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A9_T1.js34
-rw-r--r--js/src/tests/test262/language/statements/continue/S12.7_A9_T2.js32
-rw-r--r--js/src/tests/test262/language/statements/continue/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/continue/labeled-continue.js18
-rw-r--r--js/src/tests/test262/language/statements/continue/line-terminators.js46
-rw-r--r--js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-inner-continue.js19
-rw-r--r--js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-labeled-continue.js19
-rw-r--r--js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-outer-continue.js19
-rw-r--r--js/src/tests/test262/language/statements/continue/no-label-continue.js17
-rw-r--r--js/src/tests/test262/language/statements/continue/shadowing-loop-variable-in-same-scope-as-continue.js19
-rw-r--r--js/src/tests/test262/language/statements/continue/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/continue/simple-and-labeled.js17
-rw-r--r--js/src/tests/test262/language/statements/continue/static-init-with-label.js29
-rw-r--r--js/src/tests/test262/language/statements/continue/static-init-without-label.js29
-rw-r--r--js/src/tests/test262/language/statements/debugger/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/debugger/expression.js15
-rw-r--r--js/src/tests/test262/language/statements/debugger/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/debugger/statement.js14
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A1.js44
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A10.js31
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A11.js23
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A12.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T1.js29
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T2.js29
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A15.js22
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A2.js29
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A3.js32
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T1.js36
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T2.js30
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T3.js30
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T4.js30
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T5.js25
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A5.js38
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T1.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T2.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T3.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T4.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T5.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T6.js20
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A7.js33
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A8.js31
-rw-r--r--js/src/tests/test262/language/statements/do-while/S12.6.1_A9.js29
-rw-r--r--js/src/tests/test262/language/statements/do-while/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/do-while/cptn-abrupt-empty.js23
-rw-r--r--js/src/tests/test262/language/statements/do-while/cptn-normal.js25
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-async-fun.js21
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-async-gen.js21
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-cls.js15
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-const.js15
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-fun.js15
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-gen.js16
-rw-r--r--js/src/tests/test262/language/statements/do-while/decl-let.js15
-rw-r--r--js/src/tests/test262/language/statements/do-while/labelled-fn-stmt.js19
-rw-r--r--js/src/tests/test262/language/statements/do-while/let-array-with-newline.js23
-rw-r--r--js/src/tests/test262/language/statements/do-while/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/do-while/tco-body-strict.js25
-rw-r--r--js/src/tests/test262/language/statements/empty/S12.3_A1.js20
-rw-r--r--js/src/tests/test262/language/statements/empty/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/empty/cptn-value.js15
-rw-r--r--js/src/tests/test262/language/statements/empty/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/expression/S12.4_A1.js22
-rw-r--r--js/src/tests/test262/language/statements/expression/S12.4_A2_T1.js38
-rw-r--r--js/src/tests/test262/language/statements/expression/S12.4_A2_T2.js38
-rw-r--r--js/src/tests/test262/language/statements/expression/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/expression/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-from-sync-iterator-continuation-abrupt-completion-get-constructor.js55
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-assignment.js48
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-evaluation.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-arrow.js57
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-class.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-cover.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-fn.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-gen.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-in.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-order.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-simple-no-strict.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-yield-ident-invalid-strict.js36
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-yield-ident-valid.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-iter-nrml-close.js82
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-invalid.js35
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-null.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined-hole.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined-own.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-yield-ident-invalid-strict.js36
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-yield-ident-valid.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-invalid.js35
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-null.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined-hole.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined-own.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-yield-ident-invalid-strict.js36
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-yield-ident-valid.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-const.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref-no-get.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref-user-err.js48
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-unresolvable-no-strict.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-unresolvable-strict-strict.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-identifier.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-simple-strict-strict.js36
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-yield-invalid-strict.js36
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-yield-valid.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-null.js85
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elision-val-array.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elision-val-string.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-empty-val-array.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-empty-val-string.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-after-element.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-after-elision.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-elision.js48
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-iteration.js53
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-null.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined-hole.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined-own.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-yield-ident-valid.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-null.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined-hole.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined-own.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-yield-ident-valid.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-prop-ref-no-get.js53
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-prop-ref.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-unresolvable-no-strict.js41
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-yield-ident-valid.js48
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-bool.js41
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-num.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-obj.js41
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-string.js41
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-symbol.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-first.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-last.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-lone.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-middle.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-trlng.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-missing.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-null.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-truthy.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-undef.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-evaluation.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-arrow.js58
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-class.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-cover.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-fn.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-gen.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-in.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-order.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-simple-no-strict.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-yield-ident-valid.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-put-unresolvable-no-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-simple-no-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-missing.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-null.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-truthy.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-undef.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-evaluation.js48
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-arrow.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-class.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-cover.js58
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-fn.js58
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-gen.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-in.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-yield-ident-valid.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-target-yield-ident-valid.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-first.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-last.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-lone.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-middle.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-trlng.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-name-evaluation.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-array-yield-ident-valid.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-array.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-obj-yield-ident-valid.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-obj.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-order.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-prop-ref-no-get.js50
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-prop-ref.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-unresolvable-no-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-descriptors.js58
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-empty-obj.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-getter.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-number.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-same-name.js57
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-skip-non-enumerable.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-str-val.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-symbol-val.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-to-property-with-setter.js55
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-to-property.js51
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-valid-object.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-close.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-get-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-no-close.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-name-iter-val.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-iter.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-val-null.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-exhausted.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-hole.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-skipped.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-throws.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-undef.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-unresolvable.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-complete.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-done.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-step-err.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val-err.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id-init.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-val-null.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-val-undef.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-exhausted.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-iter-close.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-step-err.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision.js80
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-empty.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elem.js86
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elision.js93
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-empty.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-rest.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision-next-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-exhausted.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-close.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-step-err.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-val-err.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-ary.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-obj.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-ary.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-obj.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-prop-id.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-name-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-elem.js89
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-obj-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-getter.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-skip-non-enumerable.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-init-null.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-init-undefined.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-empty.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-get-value-err.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-arrow.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-class.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-cover.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-fn.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-gen.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-skipped.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-throws.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-unresolvable.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-trailing-comma.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-list-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-trailing-comma.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-value-null.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-eval-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-get-value-err.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-skipped.js81
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-throws.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-unresolvable.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-trailing-comma.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-value-null.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-value-undef.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-getter.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-skip-non-enumerable.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-val-obj.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-close.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-get-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-no-close.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-name-iter-val.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-iter.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-init.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-iter.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-init.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-iter.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-val-null.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-exhausted.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-hole.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-skipped.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-throws.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-undef.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-unresolvable.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-complete.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-done.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-step-err.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val-err.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id-init.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-val-null.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-val-undef.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-exhausted.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-iter-close.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-step-err.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision.js81
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-empty.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elem.js87
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elision.js94
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-empty.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-rest.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision-next-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-exhausted.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-close.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-step-err.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-val-err.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-id.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-prop-id.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-name-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-elem.js89
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-obj-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-getter.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-skip-non-enumerable.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-init-null.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-init-undefined.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-empty.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-get-value-err.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-arrow.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-class.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-cover.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-fn.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-gen.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-skipped.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-throws.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-unresolvable.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-list-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-init.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-value-null.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-eval-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-get-value-err.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-skipped.js82
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-throws.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-unresolvable.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-trailing-comma.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-init.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-value-null.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-value-undef.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-getter.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-skip-non-enumerable.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-val-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-close.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-get-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-no-close.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-name-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-init.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-iter.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-init.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-iter.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-init.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-iter.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-val-null.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-exhausted.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-hole.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-skipped.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-throws.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-undef.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-unresolvable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-complete.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-done.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-step-err.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val-err.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id-init.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id-init.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-val-null.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-val-undef.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-exhausted.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-iter-close.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-step-err.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elem.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elision.js91
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-empty.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-rest.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision-next-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-close.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-step-err.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-val-err.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-ary.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-id.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-obj.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-ary.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-id.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-obj.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-prop-id.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-name-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-elem.js89
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-obj-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-getter.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-skip-non-enumerable.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-init-null.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-init-undefined.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-empty.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-get-value-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-throws.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-unresolvable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-trailing-comma.js57
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-list-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-trailing-comma.js57
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-value-null.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-eval-err.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-get-value-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-skipped.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-throws.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-unresolvable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-trailing-comma.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-value-null.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-value-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-getter.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-skip-non-enumerable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-val-obj.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-assignment.js48
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-evaluation.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-arrow.js57
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-class.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-cover.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-fn.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-gen.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-in.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-order.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-simple-no-strict.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-yield-expr.js51
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-get-err.js54
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-err.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-null.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-skip.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close.js82
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-rtrn-close-null.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-thrw-close-skip.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-null.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined-hole.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined-own.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-yield-expr.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-null.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined-hole.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined-own.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-yield-expr.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-const.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref-no-get.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref-user-err.js48
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-unresolvable-no-strict.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-unresolvable-strict-strict.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-target-simple-no-strict.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-target-yield-expr.js55
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-err.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-null.js85
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-skip.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close.js94
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close-err.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close-skip.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close.js90
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-thrw-close-skip.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-rest-nrml-close-skip.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-iter-nrml-close-skip.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-iter-nrml-close.js87
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-val-array.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-val-string.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-iter-close.js81
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-val-array.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-val-string.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-after-element.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-after-elision.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-elision.js48
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-iter-nrml-close-skip.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-iteration.js53
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-lref.js81
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-null.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined-hole.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined-own.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-yield-expr.js51
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-null.js44
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined-hole.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined-own.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-yield-expr.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-prop-ref-no-get.js53
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-prop-ref.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-unresolvable-no-strict.js41
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-yield-expr.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-bool.js41
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-num.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-obj.js41
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-string.js41
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-symbol.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-first.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-last.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-lone.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-middle.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-trlng.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-missing.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-null.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-truthy.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-undef.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-evaluation.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-arrow.js58
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-class.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-cover.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-fn.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-gen.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-in.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-order.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-simple-no-strict.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-yield-expr.js51
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-put-unresolvable-no-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-simple-no-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-missing.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-null.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-truthy.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-undef.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-evaluation.js48
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-arrow.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-class.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-cover.js58
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-fn.js58
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-gen.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-in.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-yield-expr.js50
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-target-yield-expr.js50
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-first.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-last.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-lone.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-middle.js43
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-trlng.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-name-evaluation.js45
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-array-yield-expr.js51
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-array.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-obj-yield-expr.js51
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-obj.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-order.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-prop-ref-no-get.js50
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-prop-ref.js42
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-unresolvable-no-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-descriptors.js58
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-empty-obj.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-getter.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-number.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-same-name.js57
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-skip-non-enumerable.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-str-val.js47
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-symbol-val.js46
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-to-property-with-setter.js55
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-to-property.js51
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-valid-object.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-close.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-get-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-no-close.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-name-iter-val.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-iter.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-val-null.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-exhausted.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-hole.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-skipped.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-throws.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-undef.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-unresolvable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-complete.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-done.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-step-err.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val-err.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id-init.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-val-null.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-val-undef.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-exhausted.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-iter-close.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-step-err.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision.js80
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-empty.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-init-err.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elem.js86
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elision.js93
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-empty.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-rest.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision-next-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-exhausted.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-close.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-step-err.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-val-err.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-ary.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-obj.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-ary.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-obj.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-prop-id.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-name-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-elem.js89
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-obj-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-getter.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-skip-non-enumerable.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-init-null.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-init-undefined.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-empty.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-get-value-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-arrow.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-class.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-cover.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-fn.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-gen.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-skipped.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-throws.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-unresolvable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-trailing-comma.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-init-err.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-list-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-trailing-comma.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-value-null.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-eval-err.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-get-value-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-skipped.js81
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-throws.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-unresolvable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-trailing-comma.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-value-null.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-value-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-getter.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-skip-non-enumerable.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-val-obj.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-close.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-get-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-no-close.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-name-iter-val.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-iter.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-init.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-iter.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-init.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-iter.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-val-null.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-exhausted.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-hole.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-skipped.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-throws.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-undef.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-unresolvable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-complete.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-done.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-step-err.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val-err.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id-init.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-val-null.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-val-undef.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-exhausted.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-iter-close.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-step-err.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision.js81
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-empty.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-init-err.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elem.js87
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elision.js94
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-empty.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-rest.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision-next-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-exhausted.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-close.js56
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-step-err.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-val-err.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-id.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-prop-id.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-name-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-elem.js89
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-obj-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-getter.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-skip-non-enumerable.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-init-null.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-init-undefined.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-empty.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-get-value-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-arrow.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-class.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-cover.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-fn.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-gen.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-skipped.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-throws.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-unresolvable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-init-err.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-list-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-init.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-value-null.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-eval-err.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-get-value-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-skipped.js82
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-throws.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-unresolvable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-trailing-comma.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-init.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-value-null.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-value-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-getter.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-skip-non-enumerable.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-val-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-close.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-get-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-no-close.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-name-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-init.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-iter.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-init.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-iter.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-init.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-iter.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-val-null.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-exhausted.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-hole.js59
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-skipped.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-throws.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-undef.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-unresolvable.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-complete.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-done.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-step-err.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val-err.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id-init.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id-init.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-val-null.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-val-undef.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-exhausted.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-iter-close.js53
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-step-err.js77
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-init-err.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elem.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elision.js91
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-empty.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-rest.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision-next-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-close.js53
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-step-err.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-val-err.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-ary.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-id.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-obj.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-ary.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-id.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-obj.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-prop-id.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-init-iter-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-init-iter-no-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-name-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elem-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elem-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elision-init.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elision-iter.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-empty-init.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-empty-iter.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-rest-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-rest-iter.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-hole.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-skipped.js73
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-complete.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-done.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-val.js76
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-id-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-prop-id-init.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-prop-id.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elision-exhausted.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-elem.js89
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-elision.js96
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-empty.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-rest.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id-elision.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id-exhausted.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-ary.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-obj-id.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-arrow.js68
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-class.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-cover.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-fn.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-gen.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-skipped.js72
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-init-skipped.js84
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-obj-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-obj.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-getter.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-skip-non-enumerable.js74
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-val-obj.js71
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-init-null.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-init-undefined.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-empty.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-get-value-err.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-throws.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-unresolvable.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-trailing-comma.js57
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-init-err.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-list-err.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-trailing-comma.js57
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-value-null.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-eval-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-get-value-err.js67
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-skipped.js79
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-throws.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-unresolvable.js70
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-trailing-comma.js61
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-value-null.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-value-undef.js62
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj.js64
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-getter.js60
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-skip-non-enumerable.js69
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-val-obj.js66
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/escaped-of.js27
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/head-const-init.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/head-let-init.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/head-lhs-async.js24
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/head-var-init.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-abrupt.js54
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-is-null.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-non-callable.js53
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/iterator-close-throw-get-method-abrupt.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/iterator-close-throw-get-method-non-callable.js52
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/let-array-with-newline.js25
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/let-block-with-newline.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/let-identifier-with-newline.js21
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/shell.js113
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/ticks-with-async-iter-resolved-promise-and-constructor-lookup-two.js92
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/ticks-with-async-iter-resolved-promise-and-constructor-lookup.js78
-rw-r--r--js/src/tests/test262/language/statements/for-await-of/ticks-with-sync-iter-resolved-promise-and-constructor-lookup.js93
-rw-r--r--js/src/tests/test262/language/statements/for-in/12.6.4-1.js35
-rw-r--r--js/src/tests/test262/language/statements/for-in/12.6.4-2.js36
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A1.js31
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A14_T2.js28
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A15.js24
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A2.js30
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A3.1.js35
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A3.js35
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A4.1.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A4.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A5.1.js45
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A5.js45
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js44
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A6.js44
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T1.js55
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T2.js45
-rw-r--r--js/src/tests/test262/language/statements/for-in/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/for-in/cptn-decl-abrupt-empty.js43
-rw-r--r--js/src/tests/test262/language/statements/for-in/cptn-decl-itr.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/cptn-decl-skip-itr.js27
-rw-r--r--js/src/tests/test262/language/statements/for-in/cptn-decl-zero-itr.js29
-rw-r--r--js/src/tests/test262/language/statements/for-in/cptn-expr-abrupt-empty.js43
-rw-r--r--js/src/tests/test262/language/statements/for-in/cptn-expr-itr.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/cptn-expr-skip-itr.js27
-rw-r--r--js/src/tests/test262/language/statements/for-in/cptn-expr-zero-itr.js29
-rw-r--r--js/src/tests/test262/language/statements/for-in/decl-async-fun.js21
-rw-r--r--js/src/tests/test262/language/statements/for-in/decl-async-gen.js21
-rw-r--r--js/src/tests/test262/language/statements/for-in/decl-cls.js15
-rw-r--r--js/src/tests/test262/language/statements/for-in/decl-const.js15
-rw-r--r--js/src/tests/test262/language/statements/for-in/decl-fun.js15
-rw-r--r--js/src/tests/test262/language/statements/for-in/decl-gen.js16
-rw-r--r--js/src/tests/test262/language/statements/for-in/decl-let.js15
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-elem-init-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-array-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-array-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-obj-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-elem-target-simple-strict-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-elem-target-yield-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-element.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-elision.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-rest.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-elision-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-init.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-array-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-array-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-obj-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/array-rest-yield-ident-invalid-strict.js35
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-id-identifier-yield-expr.js36
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-id-identifier-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-id-init-simple-strict-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-id-init-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-id-simple-strict-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-array-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-obj-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/obj-rest-not-last-element-invalid.js35
-rw-r--r--js/src/tests/test262/language/statements/for-in/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-const-bound-names-dup.js18
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-const-bound-names-fordecl-tdz.js14
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-const-bound-names-in-stmt.js20
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-const-bound-names-let.js18
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-const-fresh-binding-per-iteration.js17
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-decl-expr.js27
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-expr-expr.js28
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-let-bound-names-dup.js18
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-let-bound-names-fordecl-tdz.js14
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-let-bound-names-in-stmt.js20
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-let-bound-names-let.js18
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-let-destructuring.js33
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-let-fresh-binding-per-iteration.js30
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-lhs-cover-non-asnmt-trgt.js25
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-lhs-cover.js21
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-ary.js21
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-obj.js21
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-lhs-let.js40
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-lhs-member.js21
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-lhs-non-asnmt-trgt.js19
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-var-bound-names-dup.js19
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-var-bound-names-in-stmt.js20
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-var-bound-names-let.js20
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-var-expr.js27
-rw-r--r--js/src/tests/test262/language/statements/for-in/identifier-let-allowed-as-lefthandside-expression-not-strict.js14
-rw-r--r--js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-const.js19
-rw-r--r--js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-let.js19
-rw-r--r--js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-lhs.js19
-rw-r--r--js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-var.js19
-rw-r--r--js/src/tests/test262/language/statements/for-in/let-array-with-newline.js22
-rw-r--r--js/src/tests/test262/language/statements/for-in/let-block-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/for-in/let-identifier-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/for-in/order-after-define-property.js53
-rw-r--r--js/src/tests/test262/language/statements/for-in/order-enumerable-shadowed.js35
-rw-r--r--js/src/tests/test262/language/statements/for-in/order-property-added.js27
-rw-r--r--js/src/tests/test262/language/statements/for-in/order-property-on-prototype.js30
-rw-r--r--js/src/tests/test262/language/statements/for-in/order-simple-object.js35
-rw-r--r--js/src/tests/test262/language/statements/for-in/scope-body-lex-boundary.js52
-rw-r--r--js/src/tests/test262/language/statements/for-in/scope-body-lex-close.js42
-rw-r--r--js/src/tests/test262/language/statements/for-in/scope-body-lex-open.js50
-rw-r--r--js/src/tests/test262/language/statements/for-in/scope-body-var-none.js50
-rw-r--r--js/src/tests/test262/language/statements/for-in/scope-head-lex-close.js46
-rw-r--r--js/src/tests/test262/language/statements/for-in/scope-head-lex-open.js40
-rw-r--r--js/src/tests/test262/language/statements/for-in/scope-head-var-none.js47
-rw-r--r--js/src/tests/test262/language/statements/for-in/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/for-in/var-arguments-fn-strict-init-strict.js21
-rw-r--r--js/src/tests/test262/language/statements/for-in/var-arguments-fn-strict-strict.js21
-rw-r--r--js/src/tests/test262/language/statements/for-in/var-arguments-strict-init-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/for-in/var-arguments-strict-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/for-in/var-eval-strict-init-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/for-in/var-eval-strict-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/for-of/Array.prototype.Symbol.iterator.js22
-rw-r--r--js/src/tests/test262/language/statements/for-of/Array.prototype.entries.js29
-rw-r--r--js/src/tests/test262/language/statements/for-of/Array.prototype.keys.js21
-rw-r--r--js/src/tests/test262/language/statements/for-of/arguments-mapped-aliasing.js30
-rw-r--r--js/src/tests/test262/language/statements/for-of/arguments-mapped-mutation.js26
-rw-r--r--js/src/tests/test262/language/statements/for-of/arguments-mapped.js23
-rw-r--r--js/src/tests/test262/language/statements/for-of/arguments-unmapped-aliasing.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/arguments-unmapped-mutation.js27
-rw-r--r--js/src/tests/test262/language/statements/for-of/arguments-unmapped.js24
-rw-r--r--js/src/tests/test262/language/statements/for-of/array-contract-expand.js35
-rw-r--r--js/src/tests/test262/language/statements/for-of/array-contract.js23
-rw-r--r--js/src/tests/test262/language/statements/for-of/array-expand-contract.js27
-rw-r--r--js/src/tests/test262/language/statements/for-of/array-expand.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/array-key-get-error.js29
-rw-r--r--js/src/tests/test262/language/statements/for-of/array.js20
-rw-r--r--js/src/tests/test262/language/statements/for-of/body-dstr-assign-error.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/body-dstr-assign.js27
-rw-r--r--js/src/tests/test262/language/statements/for-of/body-put-error.js52
-rw-r--r--js/src/tests/test262/language/statements/for-of/break-from-catch.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/break-from-finally.js32
-rw-r--r--js/src/tests/test262/language/statements/for-of/break-from-try.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/break-label-from-catch.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/break-label-from-finally.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/break-label-from-try.js35
-rw-r--r--js/src/tests/test262/language/statements/for-of/break-label.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/break.js26
-rw-r--r--js/src/tests/test262/language/statements/for-of/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/for-of/continue-from-catch.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/continue-from-finally.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/continue-from-try.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/continue-label-from-catch.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/continue-label-from-finally.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/continue-label-from-try.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/continue-label.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/continue.js26
-rw-r--r--js/src/tests/test262/language/statements/for-of/cptn-decl-abrupt-empty.js44
-rw-r--r--js/src/tests/test262/language/statements/for-of/cptn-decl-itr.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/cptn-decl-no-itr.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/cptn-expr-abrupt-empty.js45
-rw-r--r--js/src/tests/test262/language/statements/for-of/cptn-expr-itr.js35
-rw-r--r--js/src/tests/test262/language/statements/for-of/cptn-expr-no-itr.js32
-rw-r--r--js/src/tests/test262/language/statements/for-of/decl-async-fun.js21
-rw-r--r--js/src/tests/test262/language/statements/for-of/decl-async-gen.js21
-rw-r--r--js/src/tests/test262/language/statements/for-of/decl-cls.js15
-rw-r--r--js/src/tests/test262/language/statements/for-of/decl-const.js15
-rw-r--r--js/src/tests/test262/language/statements/for-of/decl-fun.js15
-rw-r--r--js/src/tests/test262/language/statements/for-of/decl-gen.js16
-rw-r--r--js/src/tests/test262/language/statements/for-of/decl-let.js15
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-assignment.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-evaluation.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-arrow.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-class.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-cover.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-fn.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-gen.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-in.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-let.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-order.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-simple-no-strict.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-expr.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-get-err.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-err.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-null.js73
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-skip.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close-err.js77
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close-null.js86
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close.js93
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close-err.js72
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close-skip.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close.js81
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-null.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined-hole.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined-own.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-expr.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-null.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined-hole.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined-own.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-expr.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-const.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-let.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref-init-active.js79
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref-init.js79
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref.js79
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref-no-get.js46
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref-user-err.js44
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-unresolvable-no-strict.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-unresolvable-strict-strict.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-identifier.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-simple-no-strict.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-simple-strict-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-expr.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-abpt.js80
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-err.js76
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-null.js79
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-skip.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close.js85
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-get-err.js51
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-err.js76
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-null.js79
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-skip.js71
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close.js84
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close-err.js91
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close-null.js91
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close.js102
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close-err.js84
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close-skip.js75
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close.js87
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-nrml-close-skip.js71
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close-err.js93
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close-null.js88
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close.js99
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close-err.js85
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close-skip.js78
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close.js89
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-abpt.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-get-err.js49
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-err.js69
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-null.js73
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-skip.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close.js78
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-array.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-bool.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-null.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-num.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-string.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-symbol.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-undef.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close-null.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close.js74
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-get-err.js49
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-array.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-bool.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-null.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-num.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-string.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-symbol.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-undef.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-iteration.js45
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-after-element.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-after-elision.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-element.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-elision.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-rest.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision-iter-abpt.js71
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-init.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-get-err.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-nrml-close-skip.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close-err.js88
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close-null.js88
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close.js103
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close-err.js85
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close-skip.js68
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close.js93
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-iteration.js46
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-lref-err.js77
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-lref.js74
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-iter-thrw-close-skip.js80
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-null.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined-hole.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined-own.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-expr.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-null.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined-hole.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined-own.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-expr.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-const.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-let.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-no-get.js49
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-user-err-iter-close-skip.js83
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-user-err.js44
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-unresolvable-no-strict.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-unresolvable-strict-strict.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-expr.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-ident-invalid-strict.js35
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-ident-valid.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-close.js72
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-get-err-array-prototype.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-get-err.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-no-close.js72
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-name-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elem-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elem-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elision-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elision-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-empty-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-empty-iter.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-rest-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-rest-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-val-null.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-hole.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-throws.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-complete.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-done.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-step-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val-array-prototype.js81
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val-err.js75
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-id-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-prop-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-prop-id.js73
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-val-null.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-val-undef.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-iter-close.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-step-err.js71
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision.js77
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-empty.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-init-err.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-elem.js84
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-elision.js90
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-empty.js73
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-rest.js69
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-direct.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-elision-next-err.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-elision.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-exhausted.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-close.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-step-err.js68
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-val-err.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-id.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-id.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-obj-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-obj-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-init-null.js51
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-init-undefined.js51
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-get-value-err.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-arrow.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-class.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-cover.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-fn.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-gen.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-skipped.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-init-err.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-list-err.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-value-null.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-eval-err.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-get-value-err.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-skipped.js78
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-value-null.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-value-undef.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-getter.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-skip-non-enumerable.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-val-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-close.js72
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-get-err-array-prototype.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-get-err.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-no-close.js72
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-name-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elem-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elem-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elision-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elision-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-empty-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-empty-iter.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-rest-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-rest-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-val-null.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-hole.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-throws.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-complete.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-done.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-step-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val-array-prototype.js81
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val-err.js75
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-id-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-prop-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-prop-id.js73
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-val-null.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-val-undef.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-iter-close.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-step-err.js71
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision.js77
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-empty.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-init-err.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-elem.js84
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-elision.js90
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-empty.js73
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-rest.js69
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-direct.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-elision-next-err.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-elision.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-exhausted.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-close.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-step-err.js68
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-val-err.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-id.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-id.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-obj-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-obj-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-init-null.js51
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-init-undefined.js51
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-get-value-err.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-arrow.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-class.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-cover.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-fn.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-gen.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-skipped.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-init-err.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-list-err.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-value-null.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-eval-err.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-get-value-err.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-skipped.js78
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-value-null.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-value-undef.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-getter.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-skip-non-enumerable.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-val-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-empty-bool.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-empty-null.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-empty-num.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-empty-obj.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-empty-string.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-empty-symbol.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-empty-undef.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-first.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-last.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-lone.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-middle.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-trlng.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-expr.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-ident-valid.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-missing.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-null.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-truthy.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-undef.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-evaluation.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-arrow.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-class.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-cover.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-fn.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-gen.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-in.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-let.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-order.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-simple-no-strict.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-simple-strict-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-expr.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-const.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-let.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-unresolvable-no-strict.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-unresolvable-strict-strict.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-simple-no-strict.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-id-simple-strict-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-missing.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-null.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-truthy.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-undef.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-evaluation.js43
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-arrow.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-class.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-cover.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-fn.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-gen.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-in.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-let.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-expr.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js69
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref-init-active.js87
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref-init.js87
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref.js87
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-expr.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-first.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-last.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-lone.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-middle.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-trlng.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-name-evaluation-error.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-name-evaluation.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-null.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-undefined-own.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-undefined.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-expr.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-invalid.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-null.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-undefined-own.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-undefined.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-expr.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-ident-valid.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-const.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-let.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-order.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref-no-get.js46
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref-user-err.js44
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-unresolvable-no-strict.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-unresolvable-strict-strict.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-computed-property-no-strict.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-computed-property.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-descriptors.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-empty-obj.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-getter-abrupt-get-error.js44
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-getter.js47
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1dot.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1dot0.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1e0.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-array-1.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-array-1e0.js51
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-string-1.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-not-last-element-invalid.js35
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-number.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-order.js44
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-put-const.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-same-name.js52
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-skip-non-enumerable.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-str-val.js43
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-symbol-val.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-to-property-with-setter.js49
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-to-property.js46
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-val-null.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-val-undefined.js41
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/obj-rest-valid-object.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-close.js69
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-get-err-array-prototype.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-get-err.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-no-close.js69
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-name-iter-val.js68
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elem-init.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elem-iter.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elision-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elision-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-empty-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-empty-iter.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-rest-init.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-rest-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-val-null.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-exhausted.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-arrow.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-class.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-cover.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-fn.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-gen.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-hole.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-skipped.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-throws.js52
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-undef.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-unresolvable.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-complete.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-done.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-step-err.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val-array-prototype.js78
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val-err.js72
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val.js68
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-id-init.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-id.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-prop-id-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-prop-id.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-val-null.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-val-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-exhausted.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-iter-close.js52
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-step-err.js68
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision.js74
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-empty.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-init-err.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-elem.js81
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-elision.js87
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-empty.js70
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-rest.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-direct.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-elision-next-err.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-elision.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-exhausted.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-close.js52
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-step-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-val-err.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-ary.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-id.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-obj.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-ary.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-id.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-obj.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-obj-id.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-obj-prop-id.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-init-null.js48
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-init-undefined.js48
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-empty.js58
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-get-value-err.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-arrow.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-class.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-cover.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-fn.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-gen.js61
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-skipped.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-throws.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-unresolvable.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-trailing-comma.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-init-err.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-list-err.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-init.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-trailing-comma.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-value-null.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-eval-err.js52
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-get-value-err.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-skipped.js75
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-throws.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-unresolvable.js59
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-trailing-comma.js57
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id.js56
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-init.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-value-null.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-value-undef.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj.js60
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-getter.js55
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-skip-non-enumerable.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-val-obj.js62
-rw-r--r--js/src/tests/test262/language/statements/for-of/escaped-of.js24
-rw-r--r--js/src/tests/test262/language/statements/for-of/float32array-mutate.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/float32array.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/float64array-mutate.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/float64array.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/generator-close-via-break.js49
-rw-r--r--js/src/tests/test262/language/statements/for-of/generator-close-via-continue.js67
-rw-r--r--js/src/tests/test262/language/statements/for-of/generator-close-via-return.js51
-rw-r--r--js/src/tests/test262/language/statements/for-of/generator-close-via-throw.js51
-rw-r--r--js/src/tests/test262/language/statements/for-of/generator-next-error.js24
-rw-r--r--js/src/tests/test262/language/statements/for-of/generator.js26
-rw-r--r--js/src/tests/test262/language/statements/for-of/generic-iterable.js30
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-const-bound-names-dup.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-const-bound-names-fordecl-tdz.js14
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-const-bound-names-in-stmt.js20
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-const-bound-names-let.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-const-fresh-binding-per-iteration.js21
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-const-init.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-decl-no-expr.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-expr-no-expr.js19
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-expr-obj-iterator-method.js15
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-expr-primitive-iterator-method.js19
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-expr-to-obj.js19
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-let-bound-names-dup.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-let-bound-names-fordecl-tdz.js14
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-let-bound-names-in-stmt.js20
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-let-bound-names-let.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-let-destructuring.js30
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-let-fresh-binding-per-iteration.js21
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-let-init.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-async-dot.js17
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-async-escaped.js20
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-async-invalid.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-async-parens.js20
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-cover-non-asnmt-trgt.js25
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-cover.js21
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-ary.js21
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-obj.js21
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-let.js26
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-member.js21
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-lhs-non-asnmt-trgt.js19
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-var-bound-names-dup.js19
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-var-bound-names-in-stmt.js20
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-var-bound-names-let.js20
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-var-init.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/head-var-no-expr.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/int16array-mutate.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/int16array.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/int32array-mutate.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/int32array.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/int8array-mutate.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/int8array.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-as-proxy.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-non-object.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-abrupt.js49
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-is-null.js49
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-non-callable.js49
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-throw-get-method-abrupt.js48
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-throw-get-method-non-callable.js48
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-via-break.js48
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-via-continue.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-via-return.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-close-via-throw.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-next-error.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-next-reference.js43
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-next-result-done-attr.js132
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-next-result-type.js108
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-next-result-value-attr-error.js47
-rw-r--r--js/src/tests/test262/language/statements/for-of/iterator-next-result-value-attr.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-const.js19
-rw-r--r--js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-let.js19
-rw-r--r--js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-lhs.js19
-rw-r--r--js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-var.js19
-rw-r--r--js/src/tests/test262/language/statements/for-of/let-array-with-newline.js22
-rw-r--r--js/src/tests/test262/language/statements/for-of/let-block-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/let-identifier-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/for-of/map-contract-expand.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/map-contract.js26
-rw-r--r--js/src/tests/test262/language/statements/for-of/map-expand-contract.js30
-rw-r--r--js/src/tests/test262/language/statements/for-of/map-expand.js35
-rw-r--r--js/src/tests/test262/language/statements/for-of/map.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/nested.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/return-from-catch.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/return-from-finally.js37
-rw-r--r--js/src/tests/test262/language/statements/for-of/return-from-try.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/return.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/scope-body-lex-boundary.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/scope-body-lex-close.js42
-rw-r--r--js/src/tests/test262/language/statements/for-of/scope-body-lex-open.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/scope-body-var-none.js50
-rw-r--r--js/src/tests/test262/language/statements/for-of/scope-head-lex-close.js46
-rw-r--r--js/src/tests/test262/language/statements/for-of/scope-head-lex-open.js40
-rw-r--r--js/src/tests/test262/language/statements/for-of/scope-head-var-none.js47
-rw-r--r--js/src/tests/test262/language/statements/for-of/set-contract-expand.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/set-contract.js25
-rw-r--r--js/src/tests/test262/language/statements/for-of/set-expand-contract.js29
-rw-r--r--js/src/tests/test262/language/statements/for-of/set-expand.js34
-rw-r--r--js/src/tests/test262/language/statements/for-of/set.js48
-rw-r--r--js/src/tests/test262/language/statements/for-of/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/for-of/string-astral-truncated.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/string-astral.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/string-bmp.js29
-rw-r--r--js/src/tests/test262/language/statements/for-of/throw-from-catch.js39
-rw-r--r--js/src/tests/test262/language/statements/for-of/throw-from-finally.js38
-rw-r--r--js/src/tests/test262/language/statements/for-of/throw.js32
-rw-r--r--js/src/tests/test262/language/statements/for-of/uint16array-mutate.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/uint16array.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/uint32array-mutate.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/uint32array.js33
-rw-r--r--js/src/tests/test262/language/statements/for-of/uint8array-mutate.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/uint8array.js31
-rw-r--r--js/src/tests/test262/language/statements/for-of/uint8clampedarray-mutate.js36
-rw-r--r--js/src/tests/test262/language/statements/for-of/uint8clampedarray.js32
-rw-r--r--js/src/tests/test262/language/statements/for-of/yield-from-catch.js54
-rw-r--r--js/src/tests/test262/language/statements/for-of/yield-from-finally.js52
-rw-r--r--js/src/tests/test262/language/statements/for-of/yield-from-try.js51
-rw-r--r--js/src/tests/test262/language/statements/for-of/yield-star-from-catch.js66
-rw-r--r--js/src/tests/test262/language/statements/for-of/yield-star-from-finally.js64
-rw-r--r--js/src/tests/test262/language/statements/for-of/yield-star-from-try.js63
-rw-r--r--js/src/tests/test262/language/statements/for-of/yield-star.js53
-rw-r--r--js/src/tests/test262/language/statements/for-of/yield.js43
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-1.js25
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-10.js25
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-11.js23
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-12.js23
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-13.js23
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-14.js23
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-15.js23
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-16.js23
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-17.js24
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-18.js23
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-19.js24
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-2.js25
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-20.js24
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-21.js24
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-3.js25
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-4.js25
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-5.js25
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-6.js25
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-7.js25
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-8.js25
-rw-r--r--js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-9.js25
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A1.js37
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A10.1_T1.js114
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A10.1_T2.js115
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A10_T1.js54
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A10_T2.js55
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T1.js25
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T2.js64
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T3.js30
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A11_T1.js25
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A11_T2.js64
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A11_T3.js30
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T1.js25
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T2.js65
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T3.js30
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A12_T1.js25
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A12_T2.js65
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A12_T3.js30
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A13.js27
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A14.js48
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A15.js25
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A2.1.js27
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A2.2.js27
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A2.js35
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A3.js46
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A4.1.js27
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A4_T1.js27
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A4_T2.js27
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A5.js47
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A6.js35
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A7.1_T1.js24
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A7.1_T2.js24
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A7_T1.js24
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A7_T2.js24
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T1.js24
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T2.js24
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T3.js24
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A8_T1.js24
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A8_T2.js24
-rw-r--r--js/src/tests/test262/language/statements/for/S12.6.3_A8_T3.js24
-rw-r--r--js/src/tests/test262/language/statements/for/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/for/cptn-decl-expr-iter.js34
-rw-r--r--js/src/tests/test262/language/statements/for/cptn-decl-expr-no-iter.js30
-rw-r--r--js/src/tests/test262/language/statements/for/cptn-expr-expr-iter.js37
-rw-r--r--js/src/tests/test262/language/statements/for/cptn-expr-expr-no-iter.js32
-rw-r--r--js/src/tests/test262/language/statements/for/decl-async-fun.js21
-rw-r--r--js/src/tests/test262/language/statements/for/decl-async-gen.js21
-rw-r--r--js/src/tests/test262/language/statements/for/decl-cls.js15
-rw-r--r--js/src/tests/test262/language/statements/for/decl-const.js15
-rw-r--r--js/src/tests/test262/language/statements/for/decl-fun.js15
-rw-r--r--js/src/tests/test262/language/statements/for/decl-gen.js16
-rw-r--r--js/src/tests/test262/language/statements/for/decl-let.js15
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-close.js72
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-get-err-array-prototype.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-get-err.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-no-close.js72
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-name-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elem-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elem-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elision-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elision-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-empty-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-empty-iter.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-rest-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-rest-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-val-null.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-hole.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-throws.js55
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-complete.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-done.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-step-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val-array-prototype.js81
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val-err.js75
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-id-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-prop-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-prop-id.js73
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-val-null.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-val-undef.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-iter-close.js54
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-step-err.js71
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision.js77
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-empty.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-elem.js84
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-elision.js90
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-empty.js73
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-rest.js69
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-direct.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-elision-next-err.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-elision.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-exhausted.js61
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-close.js54
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-step-err.js68
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-val-err.js70
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-id.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-id.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-obj-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-obj-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-init-null.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-init-undefined.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-get-value-err.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-arrow.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-class.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-cover.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-fn.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-gen.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-skipped.js66
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-list-err.js59
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-value-null.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-eval-err.js55
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-get-value-err.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-skipped.js78
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init.js59
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id.js59
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-value-null.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-value-undef.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-getter.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-skip-non-enumerable.js66
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-val-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-close.js72
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-get-err-array-prototype.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-get-err.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-no-close.js72
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-name-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elem-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elem-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elision-init.js70
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elision-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-empty-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-empty-iter.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-rest-init.js67
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-rest-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-val-null.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-hole.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-throws.js55
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-complete.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-done.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-step-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val-array-prototype.js81
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val-err.js75
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-id-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-prop-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-prop-id.js73
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-val-null.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-val-undef.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-iter-close.js54
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-step-err.js71
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision.js77
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-empty.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-elem.js84
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-elision.js90
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-empty.js73
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-rest.js69
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-direct.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-elision-next-err.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-elision.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-exhausted.js61
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-close.js54
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-step-err.js68
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-val-err.js70
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-id.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-id.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-obj-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-obj-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-init-null.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-init-undefined.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-get-value-err.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-arrow.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-class.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-cover.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-fn.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-gen.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-skipped.js66
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-list-err.js59
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-value-null.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-eval-err.js55
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-get-value-err.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-skipped.js78
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-unresolvable.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init.js59
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id.js59
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-init.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-value-null.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-value-undef.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-getter.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-skip-non-enumerable.js66
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-val-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-close.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-get-err-array-prototype.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-get-err.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-no-close.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-name-iter-val.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elem-init.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elem-iter.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elision-init.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elision-iter.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-empty-init.js59
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-empty-iter.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-rest-init.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-rest-iter.js63
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-val-null.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-exhausted.js55
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-arrow.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-class.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-cover.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-fn.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-gen.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-hole.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-skipped.js60
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-throws.js49
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-undef.js54
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-unresolvable.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-complete.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-done.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-step-err.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val-array-prototype.js74
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val-err.js69
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-id-init.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-id.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-prop-id-init.js66
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-prop-id.js66
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-val-null.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-val-undef.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-exhausted.js61
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-iter-close.js48
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-step-err.js65
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision.js70
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-empty.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-elem.js77
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-elision.js83
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-rest.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-direct.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-elision-next-err.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-elision.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-exhausted.js54
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-close.js48
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-step-err.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-val-err.js64
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id.js55
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-ary.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-id.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-obj.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-ary.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-id.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-obj.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-obj-id.js55
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-obj-prop-id.js62
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-init-null.js45
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-init-undefined.js45
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-empty.js54
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-get-value-err.js52
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-arrow.js55
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-class.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-cover.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-fn.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-gen.js57
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-skipped.js59
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-throws.js52
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-unresolvable.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-trailing-comma.js49
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-list-err.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-init.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-trailing-comma.js49
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-value-null.js47
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-eval-err.js49
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-get-value-err.js54
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-skipped.js71
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-throws.js52
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-unresolvable.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init.js52
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-trailing-comma.js53
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id.js52
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-init.js58
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-value-null.js47
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-value-undef.js47
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj.js56
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-getter.js51
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-skip-non-enumerable.js59
-rw-r--r--js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-val-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/for/head-const-bound-names-in-stmt.js23
-rw-r--r--js/src/tests/test262/language/statements/for/head-const-fresh-binding-per-iteration.js16
-rw-r--r--js/src/tests/test262/language/statements/for/head-init-async-of.js18
-rw-r--r--js/src/tests/test262/language/statements/for/head-init-expr-check-empty-inc-empty-completion.js19
-rw-r--r--js/src/tests/test262/language/statements/for/head-init-expr-check-empty-inc-empty-syntax.js15
-rw-r--r--js/src/tests/test262/language/statements/for/head-init-var-check-empty-inc-empty-completion.js18
-rw-r--r--js/src/tests/test262/language/statements/for/head-init-var-check-empty-inc-empty-syntax.js13
-rw-r--r--js/src/tests/test262/language/statements/for/head-let-bound-names-in-stmt.js23
-rw-r--r--js/src/tests/test262/language/statements/for/head-let-destructuring.js32
-rw-r--r--js/src/tests/test262/language/statements/for/head-let-fresh-binding-per-iteration.js16
-rw-r--r--js/src/tests/test262/language/statements/for/head-lhs-let.js43
-rw-r--r--js/src/tests/test262/language/statements/for/head-var-bound-names-in-stmt.js19
-rw-r--r--js/src/tests/test262/language/statements/for/labelled-fn-stmt-const.js19
-rw-r--r--js/src/tests/test262/language/statements/for/labelled-fn-stmt-expr.js19
-rw-r--r--js/src/tests/test262/language/statements/for/labelled-fn-stmt-let.js19
-rw-r--r--js/src/tests/test262/language/statements/for/labelled-fn-stmt-var.js19
-rw-r--r--js/src/tests/test262/language/statements/for/let-array-with-newline.js22
-rw-r--r--js/src/tests/test262/language/statements/for/let-block-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/for/let-identifier-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/for/scope-body-lex-boundary.js45
-rw-r--r--js/src/tests/test262/language/statements/for/scope-body-lex-open.js48
-rw-r--r--js/src/tests/test262/language/statements/for/scope-body-var-none.js113
-rw-r--r--js/src/tests/test262/language/statements/for/scope-head-lex-close.js41
-rw-r--r--js/src/tests/test262/language/statements/for/scope-head-lex-open.js41
-rw-r--r--js/src/tests/test262/language/statements/for/scope-head-var-none.js44
-rw-r--r--js/src/tests/test262/language/statements/for/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/for/tco-const-body-strict.js25
-rw-r--r--js/src/tests/test262/language/statements/for/tco-let-body-strict.js25
-rw-r--r--js/src/tests/test262/language/statements/for/tco-lhs-body-strict.js26
-rw-r--r--js/src/tests/test262/language/statements/for/tco-var-body-strict.js25
-rw-r--r--js/src/tests/test262/language/statements/function/13.0-12-s-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/function/13.0-13-s.js21
-rw-r--r--js/src/tests/test262/language/statements/function/13.0-14-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.0-15-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.0-16-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.0-17-s.js18
-rw-r--r--js/src/tests/test262/language/statements/function/13.0-7-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.0-8-s-strict.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.0_4-17gs-strict.js15
-rw-r--r--js/src/tests/test262/language/statements/function/13.0_4-5gs-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-13gs-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-19-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-1gs-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-2-s-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-21-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-22-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-23-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-25-s.js23
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-27-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-29-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-31-s.js23
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-33-s.js22
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-39-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-4-s-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-41-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-4gs-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-5gs-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/function/13.1-8gs-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-1-s.js18
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-10-s.js16
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-11-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-12-s.js14
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-13-s.js16
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-14-s.js16
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-15-1.js21
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-15-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-16-s.js14
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-17-1.js55
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-17-s.js16
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-18-1.js42
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-18-s.js16
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-19-b-3gs-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-19-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-2-s-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-20-s.js15
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-21-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-22-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-23-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-24-s.js21
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-25-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-26-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-27-s.js18
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-28-s.js20
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-3-s.js18
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-30-s.js34
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-4-s-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-5-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-6-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-7-s.js18
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-8-s.js15
-rw-r--r--js/src/tests/test262/language/statements/function/13.2-9-s.js17
-rw-r--r--js/src/tests/test262/language/statements/function/S10.1.1_A1_T1.js19
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A1_T1.js74
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A4_T1.js29
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A4_T2.js29
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A4_T3.js29
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A4_T4.js29
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A5_T1.js30
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A5_T2.js28
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A6_T1.js32
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A6_T2.js32
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A6_T3.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A6_T4.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A7_T1.js28
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A7_T2.js30
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A7_T3.js56
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A7_T4.js58
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A8_T1.js30
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A8_T2.js32
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A9.1_T1.js36
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A9.1_T2.js36
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A9_T1.js37
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.1_A9_T2.js37
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A10.js40
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A11.js35
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A12.js42
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A13.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A14.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A15_T1.js48
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A15_T2.js50
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A15_T3.js50
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A15_T4.js50
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A16_T1.js38
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A16_T2.js38
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A16_T3.js46
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A17_T2.js72
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A17_T3.js71
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A18_T1.js57
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A18_T2.js60
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A19_T1.js30
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A19_T2.js28
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A19_T3.js37
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A19_T4.js39
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A19_T5.js43
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A19_T6.js44
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A19_T7.js55
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A19_T8.js75
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A1_T1.js46
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A1_T2.js46
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A2.js43
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A3_T1.js36
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A3_T2.js36
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A4_T1.js39
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A4_T2.js41
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A5_T1.js83
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A5_T2.js83
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A6_T1.js44
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A6_T2.js42
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A7_T1.js43
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A7_T2.js45
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A8_T1.js56
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A8_T2.js54
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A8_T3.js54
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2.2_A9.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A1_T1.js20
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A1_T2.js20
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A2_T1.js28
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A2_T2.js30
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A3.js34
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A4_T1.js50
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A4_T2.js50
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A5.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A6_T1-strict.js13
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A6_T2-strict.js15
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A7_T1-strict.js13
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A7_T2-strict.js13
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A8_T1-strict.js13
-rw-r--r--js/src/tests/test262/language/statements/function/S13.2_A8_T2-strict.js13
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A1.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A10.js32
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A11_T1.js23
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A11_T2.js28
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A11_T3.js27
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A11_T4.js30
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A12_T1.js35
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A12_T2.js40
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A13_T1.js26
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A13_T2.js27
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A13_T3.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A14_T1.js21
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A15_T1.js23
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A15_T2.js26
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A15_T3.js36
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A15_T4.js28
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A15_T5.js35
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A17_T1.js47
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A17_T2.js50
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A18.js32
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A19_T1.js34
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A19_T2.js37
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A2_T1.js29
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A2_T2.js29
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A2_T3.js31
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A3_T1.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A3_T2.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A3_T3.js31
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A4_T1.js31
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A4_T2.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A4_T3.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A4_T4.js51
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A6_T1.js38
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A6_T2.js38
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A7_T1.js73
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A7_T3.js16
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A8_T1.js33
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A8_T2.js40
-rw-r--r--js/src/tests/test262/language/statements/function/S13_A9.js21
-rw-r--r--js/src/tests/test262/language/statements/function/S14_A2.js31
-rw-r--r--js/src/tests/test262/language/statements/function/S14_A3.js32
-rw-r--r--js/src/tests/test262/language/statements/function/S14_A5_T1.js26
-rw-r--r--js/src/tests/test262/language/statements/function/S14_A5_T2.js25
-rw-r--r--js/src/tests/test262/language/statements/function/arguments-with-arguments-fn.js32
-rw-r--r--js/src/tests/test262/language/statements/function/arguments-with-arguments-lex.js32
-rw-r--r--js/src/tests/test262/language/statements/function/array-destructuring-param-strict-body.js134
-rw-r--r--js/src/tests/test262/language/statements/function/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/function/cptn-decl.js15
-rw-r--r--js/src/tests/test262/language/statements/function/dflt-params-abrupt.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dflt-params-arg-val-not-undefined.js87
-rw-r--r--js/src/tests/test262/language/statements/function/dflt-params-arg-val-undefined.js70
-rw-r--r--js/src/tests/test262/language/statements/function/dflt-params-duplicates.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dflt-params-ref-later.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dflt-params-ref-prior.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dflt-params-ref-self.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dflt-params-rest.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dflt-params-trailing-comma.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-init-iter-close.js73
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-init-iter-get-err-array-prototype.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-init-iter-get-err.js60
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-init-iter-no-close.js73
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-name-iter-val.js72
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elem-init.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elem-iter.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elision-init.js71
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elision-iter.js68
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-empty-init.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-empty-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-rest-init.js68
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-rest-iter.js71
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-val-null.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-exhausted.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-hole.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-skipped.js68
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-undef.js62
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-unresolvable.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-complete.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-done.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-step-err.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js82
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val-err.js78
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val.js72
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-id-init.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-id.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-prop-id-init.js74
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-prop-id.js74
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-val-null.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-val-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision-exhausted.js69
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision-step-err.js74
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision.js78
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-elem.js85
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-elision.js91
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-empty.js74
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-rest.js70
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-direct.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-elision-next-err.js60
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-elision.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-iter-step-err.js71
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-iter-val-err.js73
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-ary.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-id.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-obj.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-ary.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-id.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-obj.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-obj-prop-id.js70
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-close.js73
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-get-err.js60
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-no-close.js73
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-name-iter-val.js72
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js71
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js68
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js68
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js71
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js68
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js58
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js62
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js82
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js78
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js72
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-id.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js74
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js74
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision-exhausted.js69
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision-step-err.js74
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision.js78
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-elem.js85
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-elision.js91
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-empty.js74
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-rest.js70
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-direct.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js60
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-elision.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js71
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js73
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-ary.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-id.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-obj.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-id.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js70
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-init-null.js54
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-init-undefined.js54
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-empty.js62
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-get-value-err.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-throws.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-trailing-comma.js57
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-list-err.js62
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-init.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js57
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js56
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-eval-err.js58
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js79
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init.js60
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id.js60
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-init.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js56
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js56
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-getter.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-val-obj.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-init-null.js54
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-init-undefined.js54
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-empty.js62
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-get-value-err.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-throws.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-unresolvable.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-trailing-comma.js57
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-list-err.js62
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-init.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-trailing-comma.js57
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-value-null.js56
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-eval-err.js58
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-get-value-err.js63
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-skipped.js79
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-throws.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-unresolvable.js65
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init.js60
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-trailing-comma.js61
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id.js60
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-init.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-value-null.js56
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-value-undef.js56
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj.js64
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-getter.js59
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-skip-non-enumerable.js67
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-val-obj.js66
-rw-r--r--js/src/tests/test262/language/statements/function/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/function/early-body-super-call.js19
-rw-r--r--js/src/tests/test262/language/statements/function/early-body-super-prop.js19
-rw-r--r--js/src/tests/test262/language/statements/function/early-errors/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/function/early-errors/invalid-names-call-expression-bad-reference.js41
-rw-r--r--js/src/tests/test262/language/statements/function/early-errors/invalid-names-call-expression-this.js41
-rw-r--r--js/src/tests/test262/language/statements/function/early-errors/invalid-names-member-expression-bad-reference.js41
-rw-r--r--js/src/tests/test262/language/statements/function/early-errors/invalid-names-member-expression-this.js41
-rw-r--r--js/src/tests/test262/language/statements/function/early-errors/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/function/early-params-super-call.js17
-rw-r--r--js/src/tests/test262/language/statements/function/early-params-super-prop.js17
-rw-r--r--js/src/tests/test262/language/statements/function/enable-strict-via-body.js27
-rw-r--r--js/src/tests/test262/language/statements/function/enable-strict-via-outer-body.js27
-rw-r--r--js/src/tests/test262/language/statements/function/enable-strict-via-outer-script-strict.js27
-rw-r--r--js/src/tests/test262/language/statements/function/eval-var-scope-syntax-err.js59
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-arguments.js35
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-caller.js35
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js61
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js61
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-prop-caller.js61
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/function/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/function/invalid-2-names.js17
-rw-r--r--js/src/tests/test262/language/statements/function/invalid-3-names.js17
-rw-r--r--js/src/tests/test262/language/statements/function/invalid-function-body-1.js18
-rw-r--r--js/src/tests/test262/language/statements/function/invalid-function-body-2.js18
-rw-r--r--js/src/tests/test262/language/statements/function/invalid-function-body-3.js18
-rw-r--r--js/src/tests/test262/language/statements/function/invalid-name-dot.js17
-rw-r--r--js/src/tests/test262/language/statements/function/invalid-name-two-dots.js17
-rw-r--r--js/src/tests/test262/language/statements/function/length-dflt.js62
-rw-r--r--js/src/tests/test262/language/statements/function/line-terminator.js50
-rw-r--r--js/src/tests/test262/language/statements/function/name-arguments-non-strict.js14
-rw-r--r--js/src/tests/test262/language/statements/function/name-arguments-strict-body.js19
-rw-r--r--js/src/tests/test262/language/statements/function/name-arguments-strict-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/function/name-eval-non-strict.js14
-rw-r--r--js/src/tests/test262/language/statements/function/name-eval-strict-body.js19
-rw-r--r--js/src/tests/test262/language/statements/function/name-eval-strict-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/function/name-eval-stricteval.js17
-rw-r--r--js/src/tests/test262/language/statements/function/name-unicode.js20
-rw-r--r--js/src/tests/test262/language/statements/function/name.js26
-rw-r--r--js/src/tests/test262/language/statements/function/object-destructuring-param-strict-body.js134
-rw-r--r--js/src/tests/test262/language/statements/function/param-arguments-non-strict.js14
-rw-r--r--js/src/tests/test262/language/statements/function/param-arguments-strict-body.js23
-rw-r--r--js/src/tests/test262/language/statements/function/param-arguments-strict-strict.js24
-rw-r--r--js/src/tests/test262/language/statements/function/param-dflt-yield-non-strict.js31
-rw-r--r--js/src/tests/test262/language/statements/function/param-dflt-yield-strict-strict.js27
-rw-r--r--js/src/tests/test262/language/statements/function/param-duplicated-non-strict.js14
-rw-r--r--js/src/tests/test262/language/statements/function/param-duplicated-strict-1-strict.js24
-rw-r--r--js/src/tests/test262/language/statements/function/param-duplicated-strict-2-strict.js25
-rw-r--r--js/src/tests/test262/language/statements/function/param-duplicated-strict-3-strict.js24
-rw-r--r--js/src/tests/test262/language/statements/function/param-duplicated-strict-body-1.js23
-rw-r--r--js/src/tests/test262/language/statements/function/param-duplicated-strict-body-2.js24
-rw-r--r--js/src/tests/test262/language/statements/function/param-duplicated-strict-body-3.js23
-rw-r--r--js/src/tests/test262/language/statements/function/param-eval-non-strict-is-correct-value.js23
-rw-r--r--js/src/tests/test262/language/statements/function/param-eval-non-strict.js14
-rw-r--r--js/src/tests/test262/language/statements/function/param-eval-strict-body.js23
-rw-r--r--js/src/tests/test262/language/statements/function/param-eval-strict-strict.js24
-rw-r--r--js/src/tests/test262/language/statements/function/param-eval-stricteval.js22
-rw-r--r--js/src/tests/test262/language/statements/function/params-dflt-args-unmapped.js84
-rw-r--r--js/src/tests/test262/language/statements/function/params-dflt-ref-arguments.js63
-rw-r--r--js/src/tests/test262/language/statements/function/params-trailing-comma-multiple.js61
-rw-r--r--js/src/tests/test262/language/statements/function/params-trailing-comma-single.js60
-rw-r--r--js/src/tests/test262/language/statements/function/rest-param-strict-body.js134
-rw-r--r--js/src/tests/test262/language/statements/function/rest-params-trailing-comma-early-error.js59
-rw-r--r--js/src/tests/test262/language/statements/function/scope-body-lex-distinct.js55
-rw-r--r--js/src/tests/test262/language/statements/function/scope-param-elem-var-close.js33
-rw-r--r--js/src/tests/test262/language/statements/function/scope-param-elem-var-open.js31
-rw-r--r--js/src/tests/test262/language/statements/function/scope-param-rest-elem-var-close.js31
-rw-r--r--js/src/tests/test262/language/statements/function/scope-param-rest-elem-var-open.js31
-rw-r--r--js/src/tests/test262/language/statements/function/scope-paramsbody-var-close.js37
-rw-r--r--js/src/tests/test262/language/statements/function/scope-paramsbody-var-open.js35
-rw-r--r--js/src/tests/test262/language/statements/function/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/function/static-init-await-binding-invalid.js28
-rw-r--r--js/src/tests/test262/language/statements/function/static-init-await-binding-valid.js20
-rw-r--r--js/src/tests/test262/language/statements/function/unscopables-with-in-nested-fn.js104
-rw-r--r--js/src/tests/test262/language/statements/function/unscopables-with.js98
-rw-r--r--js/src/tests/test262/language/statements/function/use-strict-with-non-simple-param.js22
-rw-r--r--js/src/tests/test262/language/statements/generators/arguments-with-arguments-fn.js33
-rw-r--r--js/src/tests/test262/language/statements/generators/arguments-with-arguments-lex.js33
-rw-r--r--js/src/tests/test262/language/statements/generators/array-destructuring-param-strict-body.js134
-rw-r--r--js/src/tests/test262/language/statements/generators/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/cptn-decl.js20
-rw-r--r--js/src/tests/test262/language/statements/generators/declaration.js20
-rw-r--r--js/src/tests/test262/language/statements/generators/default-proto.js36
-rw-r--r--js/src/tests/test262/language/statements/generators/dflt-params-abrupt.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dflt-params-arg-val-not-undefined.js87
-rw-r--r--js/src/tests/test262/language/statements/generators/dflt-params-arg-val-undefined.js70
-rw-r--r--js/src/tests/test262/language/statements/generators/dflt-params-duplicates.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dflt-params-ref-later.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dflt-params-ref-prior.js67
-rw-r--r--js/src/tests/test262/language/statements/generators/dflt-params-ref-self.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dflt-params-rest.js67
-rw-r--r--js/src/tests/test262/language/statements/generators/dflt-params-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-close.js72
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-get-err-array-prototype.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-get-err.js59
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-no-close.js72
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-name-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elem-init.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elem-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elision-init.js70
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elision-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-empty-init.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-empty-iter.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-rest-init.js67
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-rest-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-val-null.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-hole.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-throws.js57
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-complete.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-done.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-step-err.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js81
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val-err.js77
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-id-init.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-prop-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-prop-id.js73
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-val-null.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-val-undef.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision-step-err.js73
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision.js77
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-empty.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-elem.js84
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-elision.js90
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-empty.js73
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-rest.js69
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-direct.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-elision-next-err.js59
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-elision.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-exhausted.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-iter-step-err.js70
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-iter-val-err.js72
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-id.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-id.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-obj-id.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-obj-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-close.js72
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-get-err.js59
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-no-close.js72
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-name-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elem-init.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elision-init.js70
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js67
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-empty-init.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-rest-init.js67
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js70
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-val-null.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-hole.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-skipped.js67
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-throws.js57
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-undef.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-complete.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-done.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js81
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js77
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val.js71
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-id-init.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-id.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js73
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id.js73
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-val-null.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-val-undef.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision-exhausted.js68
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision-step-err.js73
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision.js77
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-empty.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-elem.js84
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-elision.js90
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-empty.js73
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-rest.js69
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-direct.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js59
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-elision.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-exhausted.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js70
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js72
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-id.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-ary.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-id.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-obj.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-obj-id.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-obj-prop-id.js69
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-init-null.js53
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-init-undefined.js53
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-get-value-err.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-class.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-skipped.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-throws.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-list-err.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-init.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-value-null.js55
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-eval-err.js57
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-get-value-err.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-skipped.js78
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-throws.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init.js59
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id.js59
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-init.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-value-null.js55
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-value-undef.js55
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-getter.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-val-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-init-null.js53
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-init-undefined.js53
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-empty.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-get-value-err.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-arrow.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-class.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-cover.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-fn.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-gen.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-skipped.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-throws.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-list-err.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-init.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-trailing-comma.js56
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-value-null.js55
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-eval-err.js57
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-get-value-err.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-skipped.js78
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-throws.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init.js59
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-trailing-comma.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id.js59
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-init.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-value-null.js55
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-value-undef.js55
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-getter.js58
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-skip-non-enumerable.js66
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-val-obj.js65
-rw-r--r--js/src/tests/test262/language/statements/generators/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/eval-var-scope-syntax-err.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/b1/gen-func-decl-forbidden-ext-direct-access-prop-arguments.js36
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/b1/gen-func-decl-forbidden-ext-direct-access-prop-caller.js36
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-prop-caller.js64
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/generator-created-after-decl-inst.js26
-rw-r--r--js/src/tests/test262/language/statements/generators/has-instance.js15
-rw-r--r--js/src/tests/test262/language/statements/generators/invoke-as-constructor.js17
-rw-r--r--js/src/tests/test262/language/statements/generators/length-dflt.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/length-property-descriptor.js19
-rw-r--r--js/src/tests/test262/language/statements/generators/name.js24
-rw-r--r--js/src/tests/test262/language/statements/generators/no-yield.js19
-rw-r--r--js/src/tests/test262/language/statements/generators/object-destructuring-param-strict-body.js134
-rw-r--r--js/src/tests/test262/language/statements/generators/param-dflt-yield.js25
-rw-r--r--js/src/tests/test262/language/statements/generators/params-dflt-args-unmapped.js83
-rw-r--r--js/src/tests/test262/language/statements/generators/params-dflt-ref-arguments.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/params-trailing-comma-multiple.js62
-rw-r--r--js/src/tests/test262/language/statements/generators/params-trailing-comma-single.js61
-rw-r--r--js/src/tests/test262/language/statements/generators/prototype-own-properties.js15
-rw-r--r--js/src/tests/test262/language/statements/generators/prototype-property-descriptor.js18
-rw-r--r--js/src/tests/test262/language/statements/generators/prototype-relation-to-function.js20
-rw-r--r--js/src/tests/test262/language/statements/generators/prototype-typeof.js15
-rw-r--r--js/src/tests/test262/language/statements/generators/prototype-uniqueness.js16
-rw-r--r--js/src/tests/test262/language/statements/generators/prototype-value.js21
-rw-r--r--js/src/tests/test262/language/statements/generators/rest-param-strict-body.js134
-rw-r--r--js/src/tests/test262/language/statements/generators/rest-params-trailing-comma-early-error.js60
-rw-r--r--js/src/tests/test262/language/statements/generators/restricted-properties.js37
-rw-r--r--js/src/tests/test262/language/statements/generators/return.js22
-rw-r--r--js/src/tests/test262/language/statements/generators/scope-body-lex-distinct.js56
-rw-r--r--js/src/tests/test262/language/statements/generators/scope-param-elem-var-close.js34
-rw-r--r--js/src/tests/test262/language/statements/generators/scope-param-elem-var-open.js32
-rw-r--r--js/src/tests/test262/language/statements/generators/scope-param-rest-elem-var-close.js32
-rw-r--r--js/src/tests/test262/language/statements/generators/scope-param-rest-elem-var-open.js32
-rw-r--r--js/src/tests/test262/language/statements/generators/scope-paramsbody-var-close.js38
-rw-r--r--js/src/tests/test262/language/statements/generators/scope-paramsbody-var-open.js36
-rw-r--r--js/src/tests/test262/language/statements/generators/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/generators/unscopables-with-in-nested-fn.js104
-rw-r--r--js/src/tests/test262/language/statements/generators/unscopables-with.js98
-rw-r--r--js/src/tests/test262/language/statements/generators/use-strict-with-non-simple-param.js23
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-binding-identifier-escaped.js30
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-binding-identifier.js30
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-function-expression-binding-identifier.js23
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-generator-declaration-binding-identifier.js30
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-identifier-in-nested-function.js24
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-identifier-reference-escaped.js30
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-identifier-reference.js30
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-label-identifier-escaped.js30
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-label-identifier.js30
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-literal-property-name.js21
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-logical-or-expression.js20
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-parameter.js18
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-property-name.js21
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-statement.js47
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-as-yield-operand.js31
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-identifier-non-strict.js41
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-identifier-spread-non-strict.js63
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-identifier-spread-strict-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-identifier-strict-strict.js37
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-newline.js27
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-spread-arr-multiple.js44
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-spread-arr-single.js46
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-spread-obj.js49
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-star-after-newline.js20
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-star-before-newline.js22
-rw-r--r--js/src/tests/test262/language/statements/generators/yield-weak-binding.js17
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A1.1_T1.js55
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A1.1_T2.js73
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A1.2_T1.js75
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A1.2_T2.js103
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A10_T1.js22
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A10_T2.js22
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A11.js26
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A12_T1.js58
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A12_T2.js50
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A12_T3.js38
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A12_T4.js33
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A1_T1.js38
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A1_T2.js51
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A2.js15
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A3.js36
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A4.js38
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A5.js49
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A6_T1.js20
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A6_T2.js20
-rw-r--r--js/src/tests/test262/language/statements/if/S12.5_A8.js20
-rw-r--r--js/src/tests/test262/language/statements/if/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/if/cptn-else-false-abrupt-empty.js48
-rw-r--r--js/src/tests/test262/language/statements/if/cptn-else-false-nrml.js25
-rw-r--r--js/src/tests/test262/language/statements/if/cptn-else-true-abrupt-empty.js46
-rw-r--r--js/src/tests/test262/language/statements/if/cptn-else-true-nrml.js25
-rw-r--r--js/src/tests/test262/language/statements/if/cptn-empty-statement.js16
-rw-r--r--js/src/tests/test262/language/statements/if/cptn-no-else-false.js17
-rw-r--r--js/src/tests/test262/language/statements/if/cptn-no-else-true-abrupt-empty.js32
-rw-r--r--js/src/tests/test262/language/statements/if/cptn-no-else-true-nrml.js24
-rw-r--r--js/src/tests/test262/language/statements/if/empty-statement.js11
-rw-r--r--js/src/tests/test262/language/statements/if/if-async-fun-else-async-fun.js21
-rw-r--r--js/src/tests/test262/language/statements/if/if-async-fun-else-stmt.js21
-rw-r--r--js/src/tests/test262/language/statements/if/if-async-fun-no-else.js21
-rw-r--r--js/src/tests/test262/language/statements/if/if-async-gen-else-async-gen.js21
-rw-r--r--js/src/tests/test262/language/statements/if/if-async-gen-else-stmt.js21
-rw-r--r--js/src/tests/test262/language/statements/if/if-async-gen-no-else.js21
-rw-r--r--js/src/tests/test262/language/statements/if/if-cls-else-cls.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-cls-else-stmt.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-cls-no-else.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-const-else-const.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-const-else-stmt.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-const-no-else.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-decl-else-decl-strict-strict.js26
-rw-r--r--js/src/tests/test262/language/statements/if/if-decl-else-stmt-strict-strict.js26
-rw-r--r--js/src/tests/test262/language/statements/if/if-decl-no-else-strict-strict.js26
-rw-r--r--js/src/tests/test262/language/statements/if/if-fun-else-fun-strict-strict.js27
-rw-r--r--js/src/tests/test262/language/statements/if/if-fun-else-stmt-strict-strict.js27
-rw-r--r--js/src/tests/test262/language/statements/if/if-fun-no-else-strict-strict.js27
-rw-r--r--js/src/tests/test262/language/statements/if/if-gen-else-gen.js16
-rw-r--r--js/src/tests/test262/language/statements/if/if-gen-else-stmt.js16
-rw-r--r--js/src/tests/test262/language/statements/if/if-gen-no-else.js16
-rw-r--r--js/src/tests/test262/language/statements/if/if-let-else-let.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-let-else-stmt.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-let-no-else.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-stmt-else-async-fun.js21
-rw-r--r--js/src/tests/test262/language/statements/if/if-stmt-else-async-gen.js21
-rw-r--r--js/src/tests/test262/language/statements/if/if-stmt-else-cls.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-stmt-else-const.js15
-rw-r--r--js/src/tests/test262/language/statements/if/if-stmt-else-decl-strict-strict.js30
-rw-r--r--js/src/tests/test262/language/statements/if/if-stmt-else-fun-strict-strict.js31
-rw-r--r--js/src/tests/test262/language/statements/if/if-stmt-else-gen.js16
-rw-r--r--js/src/tests/test262/language/statements/if/if-stmt-else-let.js15
-rw-r--r--js/src/tests/test262/language/statements/if/labelled-fn-stmt-first.js30
-rw-r--r--js/src/tests/test262/language/statements/if/labelled-fn-stmt-lone.js30
-rw-r--r--js/src/tests/test262/language/statements/if/labelled-fn-stmt-second.js30
-rw-r--r--js/src/tests/test262/language/statements/if/let-array-with-newline.js22
-rw-r--r--js/src/tests/test262/language/statements/if/let-block-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/if/let-identifier-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/if/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/if/tco-else-body-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/if/tco-if-body-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/labeled/S12.12_A1_T1.js23
-rw-r--r--js/src/tests/test262/language/statements/labeled/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/labeled/continue.js28
-rw-r--r--js/src/tests/test262/language/statements/labeled/cptn-break.js21
-rw-r--r--js/src/tests/test262/language/statements/labeled/cptn-nrml.js22
-rw-r--r--js/src/tests/test262/language/statements/labeled/decl-async-function.js21
-rw-r--r--js/src/tests/test262/language/statements/labeled/decl-async-generator.js21
-rw-r--r--js/src/tests/test262/language/statements/labeled/decl-cls.js15
-rw-r--r--js/src/tests/test262/language/statements/labeled/decl-const.js15
-rw-r--r--js/src/tests/test262/language/statements/labeled/decl-fun-strict-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/labeled/decl-gen.js16
-rw-r--r--js/src/tests/test262/language/statements/labeled/decl-let.js15
-rw-r--r--js/src/tests/test262/language/statements/labeled/let-array-with-newline.js25
-rw-r--r--js/src/tests/test262/language/statements/labeled/let-block-with-newline.js21
-rw-r--r--js/src/tests/test262/language/statements/labeled/let-identifier-with-newline.js21
-rw-r--r--js/src/tests/test262/language/statements/labeled/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/labeled/static-init-invalid-await.js26
-rw-r--r--js/src/tests/test262/language/statements/labeled/tco-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/labeled/value-await-module-escaped.js22
-rw-r--r--js/src/tests/test262/language/statements/labeled/value-await-module.js21
-rw-r--r--js/src/tests/test262/language/statements/labeled/value-await-non-module-escaped.js17
-rw-r--r--js/src/tests/test262/language/statements/labeled/value-await-non-module.js16
-rw-r--r--js/src/tests/test262/language/statements/labeled/value-yield-non-strict-escaped.js13
-rw-r--r--js/src/tests/test262/language/statements/labeled/value-yield-non-strict.js14
-rw-r--r--js/src/tests/test262/language/statements/labeled/value-yield-strict-escaped-strict.js24
-rw-r--r--js/src/tests/test262/language/statements/labeled/value-yield-strict-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/let/block-local-closure-get-before-initialization.js19
-rw-r--r--js/src/tests/test262/language/statements/let/block-local-closure-set-before-initialization.js19
-rw-r--r--js/src/tests/test262/language/statements/let/block-local-use-before-initialization-in-declaration-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/block-local-use-before-initialization-in-prior-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/let/cptn-value.js39
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-init-iter-close.js47
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-init-iter-get-err-array-prototype.js42
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-init-iter-get-err.js36
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-init-iter-no-close.js47
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-name-iter-val.js46
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elem-init.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elem-iter.js39
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elision-init.js45
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elision-iter.js42
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-empty-init.js41
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-empty-iter.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-rest-init.js42
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-rest-iter.js45
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-val-null.js43
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-exhausted.js37
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-class.js40
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-cover.js39
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-fn.js39
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-gen.js40
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-hole.js33
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-skipped.js42
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-throws.js34
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-undef.js36
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-complete.js40
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-done.js35
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-step-err.js43
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js56
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val-err.js54
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val.js46
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-id-init.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-id.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-prop-id-init.js48
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-prop-id.js48
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-val-null.js43
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-val-undef.js43
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision-exhausted.js43
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision-step-err.js50
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision.js52
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-empty.js35
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-elem.js59
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-elision.js65
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-empty.js48
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-rest.js44
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-direct.js39
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-elision-next-err.js36
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-elision.js40
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-exhausted.js36
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-iter-step-err.js47
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-iter-val-err.js49
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id.js37
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-ary.js33
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-id.js33
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-obj.js33
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-ary.js33
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-id.js33
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-obj.js33
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-obj-id.js37
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-obj-prop-id.js44
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-init-null.js30
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-init-undefined.js30
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-empty.js36
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-get-value-err.js37
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-arrow.js37
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-class.js39
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-cover.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-fn.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-gen.js39
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-skipped.js41
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-throws.js37
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-trailing-comma.js31
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-list-err.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-init.js40
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-trailing-comma.js31
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-value-null.js32
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-eval-err.js34
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-get-value-err.js39
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-skipped.js53
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-throws.js37
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init.js34
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-trailing-comma.js35
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id.js34
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-init.js40
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-value-null.js32
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-value-undef.js32
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj.js38
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-getter.js33
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-skip-non-enumerable.js41
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-val-obj.js40
-rw-r--r--js/src/tests/test262/language/statements/let/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/let/fn-name-arrow.js26
-rw-r--r--js/src/tests/test262/language/statements/let/fn-name-class.js32
-rw-r--r--js/src/tests/test262/language/statements/let/fn-name-cover.js30
-rw-r--r--js/src/tests/test262/language/statements/let/fn-name-fn.js29
-rw-r--r--js/src/tests/test262/language/statements/let/fn-name-gen.js30
-rw-r--r--js/src/tests/test262/language/statements/let/function-local-closure-get-before-initialization.js19
-rw-r--r--js/src/tests/test262/language/statements/let/function-local-closure-set-before-initialization.js19
-rw-r--r--js/src/tests/test262/language/statements/let/function-local-use-before-initialization-in-declaration-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/function-local-use-before-initialization-in-prior-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/global-closure-get-before-initialization.js17
-rw-r--r--js/src/tests/test262/language/statements/let/global-closure-set-before-initialization.js17
-rw-r--r--js/src/tests/test262/language/statements/let/global-use-before-initialization-in-declaration-statement.js13
-rw-r--r--js/src/tests/test262/language/statements/let/global-use-before-initialization-in-prior-statement.js13
-rw-r--r--js/src/tests/test262/language/statements/let/redeclaration-error-from-within-strict-mode-function.js16
-rw-r--r--js/src/tests/test262/language/statements/let/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/let/static-init-await-binding-invalid.js27
-rw-r--r--js/src/tests/test262/language/statements/let/static-init-await-binding-valid.js20
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/escaped-let.js29
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/identifier-let-disallowed-as-boundname.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-closure-inside-condition.js14
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-closure-inside-initialization.js16
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-closure-inside-next-expression.js14
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js18
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js16
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-let-declaration-split-across-two-lines.js34
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js34
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-newline-await-in-normal-function.js25
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-generator-function.js26
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-normal-function.js24
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let-outer-inner-let-bindings.js23
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/let.js26
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-case-expression-statement-list.js12
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-default-statement-list.js12
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-do-statement-while-expression.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-for-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-label-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-while-expression-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-case-expression-statement-list.js11
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-default-statement-list.js11
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-do-statement-while-expression.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-for-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-label-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-while-expression-statement.js15
-rw-r--r--js/src/tests/test262/language/statements/return/12.9-1.js24
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T1.js20
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T10.js20
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T2.js22
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T3.js24
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T4.js20
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T5.js26
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T6.js26
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T7.js26
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T8.js26
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A1_T9.js24
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A3.js21
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A4.js30
-rw-r--r--js/src/tests/test262/language/statements/return/S12.9_A5.js40
-rw-r--r--js/src/tests/test262/language/statements/return/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/return/line-terminators.js38
-rw-r--r--js/src/tests/test262/language/statements/return/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/return/tco-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A1_T1.js75
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A1_T2.js89
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A1_T3.js93
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A1_T4.js83
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A2_T1.js33
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T1.js30
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T2.js30
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T3.js16
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T4.js32
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T5.js31
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A4_T1.js36
-rw-r--r--js/src/tests/test262/language/statements/switch/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-a-abrupt-empty.js58
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-nrml.js68
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-abrupt-empty.js26
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-b-abrupt-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js82
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-nrml.js67
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-b-final.js80
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-abrupt-empty.js51
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-b-abrupt-empty.js68
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js84
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-nrml.js69
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-b-final.js82
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js71
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-nrml.js59
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-final.js70
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-abrupt-empty.js55
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-nrml.js51
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-final.js72
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-no-match.js44
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-async-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-async-generator.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-close-case.js34
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-close-dflt.js48
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-generator.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-open-case.js34
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-open-dflt.js31
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-var-none-case.js34
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-var-none-dflt.js33
-rw-r--r--js/src/tests/test262/language/statements/switch/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js18
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/tco-case-body-dflt-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/tco-case-body-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/tco-dftl-body-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A1.js21
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A2_T1.js20
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A2_T2.js20
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A2_T3.js46
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A2_T4.js29
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A2_T5.js77
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A2_T6.js47
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A2_T7.js32
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A3_T1.js45
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A3_T2.js28
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A3_T3.js92
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A3_T4.js56
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A3_T5.js20
-rw-r--r--js/src/tests/test262/language/statements/throw/S12.13_A3_T6.js58
-rw-r--r--js/src/tests/test262/language/statements/throw/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/throw/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-10.js25
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-11.js27
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-12.js25
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-13.js36
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-14.js29
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-15.js31
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-16.js34
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-3.js28
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-4.js28
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-6.js30
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-7.js38
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-8.js30
-rw-r--r--js/src/tests/test262/language/statements/try/12.14-9.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A1.js56
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T1.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T2.js118
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T3.js153
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T4.js58
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A10_T5.js41
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A11_T1.js22
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A11_T2.js125
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A11_T3.js152
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A11_T4.js58
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A12_T1.js28
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A12_T2.js134
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A12_T3.js164
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A12_T4.js64
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A13_T1.js79
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A13_T2.js182
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A13_T3.js186
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A14.js81
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A15.js94
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T1.js19
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T10.js21
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T11.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T12.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T13.js26
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T14.js21
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T15.js23
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T2.js19
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T3.js19
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T5.js22
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T6.js22
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T7.js22
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T8.js23
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A16_T9.js20
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A17.js45
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T1.js18
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T2.js18
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T3.js62
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T4.js45
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T5.js102
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T6.js55
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A18_T7.js66
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A19_T1.js68
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A19_T2.js102
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A2.js54
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A3.js53
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A4.js37
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A5.js53
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A6.js69
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A7_T1.js140
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A7_T2.js154
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A7_T3.js171
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A8.js35
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T1.js25
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T2.js126
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T3.js162
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T4.js62
-rw-r--r--js/src/tests/test262/language/statements/try/S12.14_A9_T5.js44
-rw-r--r--js/src/tests/test262/language/statements/try/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws-strict.js16
-rw-r--r--js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws-strict.js16
-rw-r--r--js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/try/completion-values-fn-finally-abrupt.js81
-rw-r--r--js/src/tests/test262/language/statements/try/completion-values-fn-finally-normal.js82
-rw-r--r--js/src/tests/test262/language/statements/try/completion-values-fn-finally-return.js82
-rw-r--r--js/src/tests/test262/language/statements/try/completion-values.js67
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch-empty-break.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch-empty-continue.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-break.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-continue.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-catch.js32
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-empty-break.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-empty-continue.js20
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-from-catch.js45
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-skip-catch.js32
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-finally-wo-catch.js24
-rw-r--r--js/src/tests/test262/language/statements/try/cptn-try.js25
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-init-iter-close.js52
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err-array-prototype.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err.js36
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-init-iter-no-close.js52
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-name-iter-val.js51
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-init.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-iter.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-init.js50
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-iter.js47
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-init.js46
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-iter.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-init.js47
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-iter.js50
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-val-null.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-exhausted.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-class.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-cover.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-fn.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-gen.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-hole.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-skipped.js47
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-throws.js34
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-undef.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-complete.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-done.js40
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-step-err.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js61
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-err.js54
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val.js51
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id-init.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id-init.js53
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id.js53
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-null.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-undef.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-exhausted.js48
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-step-err.js50
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision.js57
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-empty.js40
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elem.js64
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elision.js70
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-empty.js53
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-rest.js49
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-direct.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision-next-err.js36
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-exhausted.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-step-err.js47
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-val-err.js49
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-ary.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-id.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-obj.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-ary.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-id.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-obj.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-id.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-prop-id.js49
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-init-null.js30
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-init-undefined.js30
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-empty.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-get-value-err.js37
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-arrow.js42
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-class.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-cover.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-fn.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-gen.js44
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-skipped.js46
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-throws.js37
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-trailing-comma.js36
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-list-err.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-init.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-trailing-comma.js36
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-value-null.js32
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-eval-err.js34
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-get-value-err.js39
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-skipped.js58
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-throws.js37
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-unresolvable.js41
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init.js39
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-trailing-comma.js40
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id.js39
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-init.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-null.js32
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-undef.js32
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj.js43
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-getter.js38
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-skip-non-enumerable.js46
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-val-obj.js45
-rw-r--r--js/src/tests/test262/language/statements/try/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/try/early-catch-duplicates.js17
-rw-r--r--js/src/tests/test262/language/statements/try/early-catch-function.js26
-rw-r--r--js/src/tests/test262/language/statements/try/early-catch-lex.js18
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding-finally.js19
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding-lexical.js40
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding-parens.js22
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding-throws.js27
-rw-r--r--js/src/tests/test262/language/statements/try/optional-catch-binding.js19
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-block-lex-close.js26
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-block-lex-open.js26
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-block-var-none.js27
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-param-lex-close.js20
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-param-lex-open.js22
-rw-r--r--js/src/tests/test262/language/statements/try/scope-catch-param-var-none.js28
-rw-r--r--js/src/tests/test262/language/statements/try/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/try/static-init-await-binding-invalid.js27
-rw-r--r--js/src/tests/test262/language/statements/try/static-init-await-binding-valid.js20
-rw-r--r--js/src/tests/test262/language/statements/try/tco-catch-finally-strict.js25
-rw-r--r--js/src/tests/test262/language/statements/try/tco-catch-strict.js27
-rw-r--r--js/src/tests/test262/language/statements/try/tco-finally-strict.js25
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-10-s.js12
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-11.js15
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-16-s.js13
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-17-s-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-18-s-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-19-s-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-1gs-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-2-s-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-20-s.js14
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-21-s.js14
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-22-s.js16
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-3-s-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-4-s-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-4gs-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-5-s.js12
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-6-s-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-7-s-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-8-s-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/12.2.1-9-s.js13
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A1.js51
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A10.js24
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A11.js29
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A12.js22
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A2.js52
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A3.js55
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A4.js30
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A5.js33
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A6_T1.js36
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A6_T2.js38
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A7.js25
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A8_T1.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A8_T2.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A8_T3.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A8_T4.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A8_T5.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A8_T6.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A8_T7.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A8_T8.js22
-rw-r--r--js/src/tests/test262/language/statements/variable/S12.2_A9.js28
-rw-r--r--js/src/tests/test262/language/statements/variable/S14_A1.js35
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-non-strict.js16
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-final-init-strict.js22
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-final-strict.js22
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-first-init-strict.js21
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-first-strict.js22
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-middle-init-strict.js21
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-middle-strict.js22
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-repeated-strict.js22
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-strict-single-init-strict.js22
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-fn-strict-single-strict.js22
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-non-strict.js13
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-strict-list-final-init-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-strict-list-final-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-strict-list-first-init-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-strict-list-first-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-strict-list-middle-init-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-strict-list-middle-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-strict-list-repeated-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-strict-single-init-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/arguments-strict-single-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/binding-resolution.js26
-rw-r--r--js/src/tests/test262/language/statements/variable/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/variable/cptn-value.js39
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-close.js46
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-get-err-array-prototype.js41
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-get-err.js35
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-no-close.js46
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-name-iter-val.js45
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-init.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-iter.js38
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elision-init.js44
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elision-iter.js41
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-empty-init.js40
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-empty-iter.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-rest-init.js41
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-rest-iter.js44
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-val-null.js42
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-exhausted.js36
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-class.js39
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-cover.js38
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-fn.js38
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-gen.js39
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-hole.js32
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-skipped.js41
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-throws.js33
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-undef.js35
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-unresolvable.js40
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-complete.js39
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-done.js34
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-step-err.js42
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js55
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val-err.js53
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val.js45
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-invalid.js27
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-valid.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-id-init.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-id.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-prop-id-init.js47
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-prop-id.js47
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-val-null.js42
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-val-undef.js42
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision-exhausted.js42
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision-step-err.js49
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision.js51
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-empty.js34
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-elem.js58
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-elision.js64
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-empty.js47
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-rest.js43
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-direct.js38
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-elision-next-err.js35
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-elision.js39
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-exhausted.js35
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-iter-step-err.js46
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-iter-val-err.js48
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id.js36
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-ary.js32
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-id.js32
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-obj.js32
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-ary.js32
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-id.js32
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-obj.js32
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-obj-id.js36
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-obj-prop-id.js43
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-init-null.js29
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-init-undefined.js29
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-invalid.js27
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-valid.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-empty.js35
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-get-value-err.js36
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-arrow.js36
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-class.js38
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-cover.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-fn.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-gen.js38
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-skipped.js40
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-throws.js36
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-unresolvable.js40
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-trailing-comma.js30
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-list-err.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-init.js39
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-trailing-comma.js30
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-value-null.js31
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-eval-err.js33
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-get-value-err.js38
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-skipped.js52
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-throws.js36
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-unresolvable.js40
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init.js33
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-trailing-comma.js34
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id.js33
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-init.js39
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-value-null.js31
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-value-undef.js31
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj.js37
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-getter.js32
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-skip-non-enumerable.js40
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-val-obj.js39
-rw-r--r--js/src/tests/test262/language/statements/variable/dstr/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-non-strict.js12
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-strict-list-final-init-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-strict-list-final-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-strict-list-first-init-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-strict-list-first-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-strict-list-middle-init-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-strict-list-middle-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-strict-list-repeated-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-strict-single-init-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/eval-strict-single-strict.js20
-rw-r--r--js/src/tests/test262/language/statements/variable/fn-name-arrow.js26
-rw-r--r--js/src/tests/test262/language/statements/variable/fn-name-class.js32
-rw-r--r--js/src/tests/test262/language/statements/variable/fn-name-cover.js30
-rw-r--r--js/src/tests/test262/language/statements/variable/fn-name-fn.js29
-rw-r--r--js/src/tests/test262/language/statements/variable/fn-name-gen.js30
-rw-r--r--js/src/tests/test262/language/statements/variable/id-arguments-strict-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/id-eval-strict-strict.js18
-rw-r--r--js/src/tests/test262/language/statements/variable/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/variable/static-init-await-binding-invalid.js27
-rw-r--r--js/src/tests/test262/language/statements/variable/static-init-await-binding-valid.js20
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A1.js65
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A10.js31
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A11.js23
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A14_T1.js27
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A14_T2.js27
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A15.js22
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A2.js29
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A3.js32
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A4_T1.js36
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A4_T2.js31
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A4_T3.js31
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A4_T4.js31
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A4_T5.js26
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A5.js40
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A6_T1.js20
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A6_T2.js20
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A6_T3.js20
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A6_T4.js20
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A6_T5.js20
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A6_T6.js20
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A7.js33
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A8.js31
-rw-r--r--js/src/tests/test262/language/statements/while/S12.6.2_A9.js29
-rw-r--r--js/src/tests/test262/language/statements/while/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/while/cptn-abrupt-empty.js32
-rw-r--r--js/src/tests/test262/language/statements/while/cptn-iter.js25
-rw-r--r--js/src/tests/test262/language/statements/while/cptn-no-iter.js21
-rw-r--r--js/src/tests/test262/language/statements/while/decl-async-fun.js21
-rw-r--r--js/src/tests/test262/language/statements/while/decl-async-gen.js21
-rw-r--r--js/src/tests/test262/language/statements/while/decl-cls.js15
-rw-r--r--js/src/tests/test262/language/statements/while/decl-const.js15
-rw-r--r--js/src/tests/test262/language/statements/while/decl-fun.js15
-rw-r--r--js/src/tests/test262/language/statements/while/decl-gen.js16
-rw-r--r--js/src/tests/test262/language/statements/while/decl-let.js15
-rw-r--r--js/src/tests/test262/language/statements/while/labelled-fn-stmt.js19
-rw-r--r--js/src/tests/test262/language/statements/while/let-array-with-newline.js22
-rw-r--r--js/src/tests/test262/language/statements/while/let-block-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/while/let-identifier-with-newline.js18
-rw-r--r--js/src/tests/test262/language/statements/while/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/while/tco-body-strict.js25
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-0-1.js24
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-0-10.js23
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-0-11.js25
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-0-12.js23
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-0-3.js20
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-0-7.js24
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-0-8.js18
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-0-9.js24
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-2-1.js18
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-2-2.js18
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-2-3.js18
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-2-4.js21
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-2-5.js21
-rw-r--r--js/src/tests/test262/language/statements/with/12.10-7-1.js26
-rw-r--r--js/src/tests/test262/language/statements/with/12.10.1-10-s-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/with/12.10.1-11gs-strict.js17
-rw-r--r--js/src/tests/test262/language/statements/with/12.10.1-12-s.js19
-rw-r--r--js/src/tests/test262/language/statements/with/12.10.1-13-s.js16
-rw-r--r--js/src/tests/test262/language/statements/with/12.10.1-4-s.js19
-rw-r--r--js/src/tests/test262/language/statements/with/12.10.1-5-s-strict.js15
-rw-r--r--js/src/tests/test262/language/statements/with/12.10.1-8-s.js23
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.10_T1.js142
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.10_T2.js151
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.10_T3.js154
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.10_T4.js144
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.10_T5.js145
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.11_T1.js148
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.11_T2.js153
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.11_T3.js155
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.11_T4.js156
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.11_T5.js158
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.12_T1.js147
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.12_T2.js153
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.12_T3.js154
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.12_T4.js155
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.12_T5.js158
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.1_T1.js137
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.1_T2.js148
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.1_T3.js150
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.2_T1.js148
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.2_T2.js153
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.2_T3.js155
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.2_T4.js157
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.2_T5.js155
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.3_T1.js147
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.3_T2.js148
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.3_T3.js150
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.3_T4.js152
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.3_T5.js158
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.4_T1.js142
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.4_T2.js151
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.4_T3.js153
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.4_T4.js143
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.4_T5.js145
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.5_T1.js147
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.5_T2.js150
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.5_T3.js158
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.5_T4.js142
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.5_T5.js150
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.6_T1.js141
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.6_T2.js150
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.6_T3.js152
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.7_T1.js147
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.7_T2.js152
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.7_T3.js154
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.7_T4.js156
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.7_T5.js158
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.8_T1.js147
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.8_T2.js147
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.8_T3.js150
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.8_T4.js155
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.8_T5.js158
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.9_T1.js147
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.9_T2.js142
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A1.9_T3.js150
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.10_T1.js47
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.10_T2.js60
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.10_T3.js60
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.10_T4.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.10_T5.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.11_T1.js38
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.11_T2.js44
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.11_T3.js44
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.11_T4.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.11_T5.js47
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.12_T1.js38
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.12_T2.js44
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.12_T3.js43
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.12_T4.js47
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.12_T5.js47
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.1_T1.js44
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.1_T2.js62
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.1_T3.js57
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.2_T1.js49
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.2_T2.js50
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.2_T3.js50
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.2_T4.js63
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.2_T5.js62
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.3_T1.js49
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.3_T2.js50
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.3_T3.js50
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.3_T4.js62
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.4_T1.js47
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.4_T2.js60
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.4_T3.js60
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.4_T4.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.4_T5.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.5_T1.js47
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.5_T2.js60
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.5_T3.js60
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.5_T4.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.5_T5.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.6_T1.js61
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.6_T2.js67
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.6_T3.js68
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.7_T1.js47
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.7_T2.js56
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.7_T3.js56
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.7_T4.js60
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.7_T5.js60
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.8_T1.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.8_T2.js49
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.8_T3.js49
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.8_T4.js61
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.8_T5.js61
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.9_T1.js47
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.9_T2.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A3.9_T3.js48
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A4_T1.js33
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A4_T2.js33
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A4_T3.js33
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A4_T4.js42
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A4_T5.js33
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A4_T6.js33
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A5_T1.js50
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A5_T2.js50
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A5_T3.js51
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A5_T4.js55
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A5_T5.js55
-rw-r--r--js/src/tests/test262/language/statements/with/S12.10_A5_T6.js55
-rw-r--r--js/src/tests/test262/language/statements/with/binding-blocked-by-unscopables.js54
-rw-r--r--js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-falsey-prop.js60
-rw-r--r--js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-non-obj.js34
-rw-r--r--js/src/tests/test262/language/statements/with/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/with/cptn-abrupt-empty.js31
-rw-r--r--js/src/tests/test262/language/statements/with/cptn-nrml.js21
-rw-r--r--js/src/tests/test262/language/statements/with/decl-async-fun.js22
-rw-r--r--js/src/tests/test262/language/statements/with/decl-async-gen.js22
-rw-r--r--js/src/tests/test262/language/statements/with/decl-cls.js16
-rw-r--r--js/src/tests/test262/language/statements/with/decl-const.js16
-rw-r--r--js/src/tests/test262/language/statements/with/decl-fun.js16
-rw-r--r--js/src/tests/test262/language/statements/with/decl-gen.js17
-rw-r--r--js/src/tests/test262/language/statements/with/decl-let.js16
-rw-r--r--js/src/tests/test262/language/statements/with/has-property-err.js38
-rw-r--r--js/src/tests/test262/language/statements/with/labelled-fn-stmt.js27
-rw-r--r--js/src/tests/test262/language/statements/with/let-array-with-newline.js25
-rw-r--r--js/src/tests/test262/language/statements/with/let-block-with-newline.js21
-rw-r--r--js/src/tests/test262/language/statements/with/let-identifier-with-newline.js21
-rw-r--r--js/src/tests/test262/language/statements/with/scope-var-close.js27
-rw-r--r--js/src/tests/test262/language/statements/with/scope-var-open.js28
-rw-r--r--js/src/tests/test262/language/statements/with/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/with/stict-script-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/with/strict-fn-decl-nested-1.js24
-rw-r--r--js/src/tests/test262/language/statements/with/strict-fn-decl-nested-2.js23
-rw-r--r--js/src/tests/test262/language/statements/with/strict-fn-decl.js20
-rw-r--r--js/src/tests/test262/language/statements/with/strict-fn-expr-strict.js21
-rw-r--r--js/src/tests/test262/language/statements/with/strict-fn-method-strict.js19
-rw-r--r--js/src/tests/test262/language/statements/with/unscopables-get-err.js42
-rw-r--r--js/src/tests/test262/language/statements/with/unscopables-inc-dec.js53
-rw-r--r--js/src/tests/test262/language/statements/with/unscopables-not-referenced-for-undef.js47
-rw-r--r--js/src/tests/test262/language/statements/with/unscopables-prop-get-err.js48
9414 files changed, 580914 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/async-function/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/async-function/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..d2eda62d6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/array-destructuring-param-strict-body.js
@@ -0,0 +1,110 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/async-func-decl.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function declaration)
+esid: sec-async-function-definitions
+features: [rest-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+async function f([element]) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/async-function/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/async-function/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..433fa550eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/await-as-binding-identifier-escaped.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier-escaped.case
+// - src/async-functions/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function asyncFn() {
+ var \u0061wait;
+}
diff --git a/js/src/tests/test262/language/statements/async-function/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/async-function/await-as-binding-identifier.js
new file mode 100644
index 0000000000..4705212167
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/await-as-binding-identifier.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier.case
+// - src/async-functions/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function asyncFn() {
+ var await;
+}
diff --git a/js/src/tests/test262/language/statements/async-function/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/async-function/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..a88596ad99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/await-as-identifier-reference-escaped.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference-escaped.case
+// - src/async-functions/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function asyncFn() {
+ void \u0061wait;
+}
diff --git a/js/src/tests/test262/language/statements/async-function/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/async-function/await-as-identifier-reference.js
new file mode 100644
index 0000000000..fe4155f679
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/await-as-identifier-reference.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference.case
+// - src/async-functions/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function asyncFn() {
+ void await;
+}
diff --git a/js/src/tests/test262/language/statements/async-function/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/async-function/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..37bfe0f0fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/await-as-label-identifier-escaped.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier-escaped.case
+// - src/async-functions/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function asyncFn() {
+ \u0061wait: ;
+}
diff --git a/js/src/tests/test262/language/statements/async-function/await-as-label-identifier.js b/js/src/tests/test262/language/statements/async-function/await-as-label-identifier.js
new file mode 100644
index 0000000000..050a0747e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/await-as-label-identifier.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier.case
+// - src/async-functions/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function asyncFn() {
+ await: ;
+}
diff --git a/js/src/tests/test262/language/statements/async-function/browser.js b/js/src/tests/test262/language/statements/async-function/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/browser.js
diff --git a/js/src/tests/test262/language/statements/async-function/cptn-decl.js b/js/src/tests/test262/language/statements/async-function/cptn-decl.js
new file mode 100644
index 0000000000..31cf99ab11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/cptn-decl.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2017 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-async-function-definitions-runtime-semantics-evaluation
+description: Async function declaration completion value is empty.
+info: |
+ AsyncFunctionDeclaration : async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.sameValue(eval('async function f() {}'), undefined);
+assert.sameValue(eval('1; async function f() {}'), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-function/declaration-returns-promise.js b/js/src/tests/test262/language/statements/async-function/declaration-returns-promise.js
new file mode 100644
index 0000000000..5cbd29e2a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/declaration-returns-promise.js
@@ -0,0 +1,15 @@
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ Async functions return promises
+---*/
+
+async function foo() { };
+var p = foo();
+assert(p instanceof Promise, "async functions return promise instances");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-function/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/async-function/dflt-params-abrupt.js
new file mode 100644
index 0000000000..fd2a6705ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/dflt-params-abrupt.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/async-func-decl.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (async function declaration)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+
+var callCount = 0;
+async function f(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+}
+
+f()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, Test262Error))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/async-function/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..7636e6752a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/async-func-decl.template
+/*---
+description: Use of initializer when argument value is not `undefined` (async function declaration)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+async function ref(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+}
+
+ref(false, '', NaN, 0, null, obj).then(() => {
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
diff --git a/js/src/tests/test262/language/statements/async-function/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/async-function/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..1e993209ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/dflt-params-arg-val-undefined.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/async-func-decl.template
+/*---
+description: Use of initializer when argument value is `undefined` (async function declaration)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+async function ref(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+}
+
+ref(undefined, void 0).then(() => {
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/async-function/dflt-params-duplicates.js
new file mode 100644
index 0000000000..2ea2494afb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/dflt-params-duplicates.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/async-func-decl.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async function declaration)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+
+async function f(x = 0, x) {
+
+}
diff --git a/js/src/tests/test262/language/statements/async-function/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/async-function/dflt-params-ref-later.js
new file mode 100644
index 0000000000..5ae817357f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/dflt-params-ref-later.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/async-func-decl.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (async function declaration)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+async function f(x = y, y) {
+
+ callCount = callCount + 1;
+}
+
+f()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, ReferenceError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/async-function/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..2e4a12da71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/dflt-params-ref-prior.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/async-func-decl.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (async function declaration)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+async function ref(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+}
+
+ref(3).then(() => {
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/async-function/dflt-params-ref-self.js
new file mode 100644
index 0000000000..37786435e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/dflt-params-ref-self.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/async-func-decl.template
+/*---
+description: Referencing a parameter from within its own initializer (async function declaration)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+async function f(x = x) {
+
+ callCount = callCount + 1;
+}
+
+f()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, ReferenceError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/dflt-params-rest.js b/js/src/tests/test262/language/statements/async-function/dflt-params-rest.js
new file mode 100644
index 0000000000..5e8a1926b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/dflt-params-rest.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/async-func-decl.template
+/*---
+description: RestParameter does not support an initializer (async function declaration)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+async function f(...x = []) {
+
+}
diff --git a/js/src/tests/test262/language/statements/async-function/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/async-function/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..2a8141f351
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/dflt-params-trailing-comma.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/async-func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (async function declaration)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+async function ref(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+}
+
+ref(42, undefined, 1).then(() => {
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-NSPL-with-USD.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-NSPL-with-USD.js
new file mode 100644
index 0000000000..324d132e16
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-NSPL-with-USD.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is *true* and IsSimpleParameterList of ArrowParameters is *false*.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async function foo(x = 1){"use strict"}
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-arguments-in-formal-parameters-strict.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-arguments-in-formal-parameters-strict.js
new file mode 100644
index 0000000000..58c95919b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-arguments-in-formal-parameters-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters contains arguments in strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+async function foo (arguments) { }
+
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-await-in-formals-default.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-await-in-formals-default.js
new file mode 100644
index 0000000000..927d1d111f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-await-in-formals-default.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters' default expressions contains await
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+async function foo (x = await) { }
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-await-in-formals.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-await-in-formals.js
new file mode 100644
index 0000000000..ac072a3ae3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-await-in-formals.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters contains await
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+async function foo (await) { }
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-binding-identifier-arguments-strict.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-binding-identifier-arguments-strict.js
new file mode 100644
index 0000000000..00728103fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-binding-identifier-arguments-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ If the source code matching this production is strict code, it is a Syntax Error if BindingIdentifier is the IdentifierName arguments.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+async function arguments () { }
+
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-binding-identifier-eval-strict.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-binding-identifier-eval-strict.js
new file mode 100644
index 0000000000..247169a87d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-binding-identifier-eval-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ If the source code matching this production is strict code, it is a Syntax Error if BindingIdentifier is the IdentifierName eval.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+async function eval () { }
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-body-contains-super-call.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-body-contains-super-call.js
new file mode 100644
index 0000000000..ed401145f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-body-contains-super-call.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a syntax error if AsyncFunctionBody contains SuperCall is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async function foo (foo) { super() };
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-body-contains-super-property.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-body-contains-super-property.js
new file mode 100644
index 0000000000..0c451621e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-body-contains-super-property.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a syntax error if AsyncFunctionBody contains SuperProperty is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async function foo (foo) { super.prop };
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-duplicate-parameters-strict.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-duplicate-parameters-strict.js
new file mode 100644
index 0000000000..afec6627ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-duplicate-parameters-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ If strict mode, early error rules for StrictFormalParameters are applied
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+async function foo(a, a) { }
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-eval-in-formal-parameters-strict.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-eval-in-formal-parameters-strict.js
new file mode 100644
index 0000000000..46463fdcbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-eval-in-formal-parameters-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters contains eval in strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+async function foo (eval) { }
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-body-duplicate.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-body-duplicate.js
new file mode 100644
index 0000000000..b1eac325e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-body-duplicate.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if BoundNames of FormalParameters also occurs in the LexicallyDeclaredNames of AsyncFunctionBody
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async function foo (bar) { let bar; }
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-contains-super-call.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-contains-super-call.js
new file mode 100644
index 0000000000..c1932d8ed9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-contains-super-call.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a syntax error if FormalParameters contains SuperCall is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async function foo (foo = super()) { let bar; }
diff --git a/js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-contains-super-property.js b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-contains-super-property.js
new file mode 100644
index 0000000000..5e7e301b79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/early-errors-declaration-formals-contains-super-property.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a syntax error if FormalParameters contains SuperCall is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async function foo (foo = super.foo) { let bar; }
diff --git a/js/src/tests/test262/language/statements/async-function/escaped-async.js b/js/src/tests/test262/language/statements/async-function/escaped-async.js
new file mode 100644
index 0000000000..2a0502aff1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/escaped-async.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-grammar-notation
+description: >
+ The `async` contextual keyword must not contain Unicode escape sequences.
+info: |
+ Terminal symbols are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+\u0061sync function f(){}
diff --git a/js/src/tests/test262/language/statements/async-function/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/statements/async-function/eval-var-scope-syntax-err.js
new file mode 100644
index 0000000000..5e797937a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/eval-var-scope-syntax-err.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/eval-var-scope-syntax-err.case
+// - src/function-forms/error-no-strict/async-func-decl.template
+/*---
+description: sloppy direct eval in params introduces var (async function declaration in sloppy code)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async, noStrict]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+
+ Runtime Semantics: IteratorBindingInitialization
+ FormalParameter : BindingElement
+
+ 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment.
+
+---*/
+
+
+var callCount = 0;
+async function f(a = eval("var a = 42")) {
+
+ callCount = callCount + 1;
+}
+
+f()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, SyntaxError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-body-that-returns-after-await.js b/js/src/tests/test262/language/statements/async-function/evaluation-body-that-returns-after-await.js
new file mode 100644
index 0000000000..f89a24d7a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-body-that-returns-after-await.js
@@ -0,0 +1,22 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ The return value of the async function resolves the promise
+flags: [async]
+---*/
+
+async function foo() {
+ await Promise.resolve();
+ return 42;
+}
+
+foo().then(function (v) {
+ assert.sameValue(v, 42);
+ $DONE();
+}, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-body-that-returns.js b/js/src/tests/test262/language/statements/async-function/evaluation-body-that-returns.js
new file mode 100644
index 0000000000..6d57a3b973
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-body-that-returns.js
@@ -0,0 +1,20 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ The return value of the async function resolves the promise
+flags: [async]
+---*/
+
+async function foo() {
+ return 42;
+}
+
+foo().then(function (v) {
+ assert.sameValue(v, 42);
+ $DONE();
+}, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-body-that-throws-after-await.js b/js/src/tests/test262/language/statements/async-function/evaluation-body-that-throws-after-await.js
new file mode 100644
index 0000000000..c2a0e758bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-body-that-throws-after-await.js
@@ -0,0 +1,25 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ Errors thrown from the async function body reject the returned promise
+flags: [async]
+---*/
+
+async function foo() {
+ await Promise.resolve();
+ throw 1;
+}
+
+foo().then(function () {
+ $DONE("Should not be called");
+}, function (e) {
+ assert.sameValue(e, 1);
+ $DONE();
+});
+
+
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-body-that-throws.js b/js/src/tests/test262/language/statements/async-function/evaluation-body-that-throws.js
new file mode 100644
index 0000000000..3bde4aedff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-body-that-throws.js
@@ -0,0 +1,23 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ Errors thrown from the async function body reject the returned promise
+flags: [async]
+---*/
+
+async function foo() {
+ throw 1;
+}
+
+foo().then(function () {
+ $DONE("Should not be called");
+}, function (e) {
+ assert.sameValue(e, 1);
+ $DONE();
+});
+
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-body.js b/js/src/tests/test262/language/statements/async-function/evaluation-body.js
new file mode 100644
index 0000000000..80935ed9b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-body.js
@@ -0,0 +1,20 @@
+// copyright 2016 microsoft, inc. all rights reserved.
+// this code is governed by the bsd license found in the license file.
+
+/*---
+author: brian terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ async function bodies are executed immediately (unlike generators)
+---*/
+
+let called;
+async function foo() {
+ called = true;
+ await new Promise();
+}
+
+foo();
+assert(called);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-default-that-throws.js b/js/src/tests/test262/language/statements/async-function/evaluation-default-that-throws.js
new file mode 100644
index 0000000000..6e7afb4cce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-default-that-throws.js
@@ -0,0 +1,21 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ If a default expression throws, the promise is rejected.
+info: |
+ This is different from generators which will throw the error out of the generator
+ when it is called.
+flags: [async]
+---*/
+var y = null;
+async function foo(x = y()) {}
+foo().then(function () {
+ $DONE('promise should be rejected');
+}, function () {
+ $DONE();
+});
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-mapped-arguments.js b/js/src/tests/test262/language/statements/async-function/evaluation-mapped-arguments.js
new file mode 100644
index 0000000000..62f9ba958e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-mapped-arguments.js
@@ -0,0 +1,23 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ Mapped arguments object is used when the async function has a
+ simple parameter list.
+flags: [noStrict, async]
+---*/
+
+
+async function foo(a) {
+ arguments[0] = 2;
+ assert.sameValue(a, 2);
+
+ a = 3;
+ assert.sameValue(arguments[0], 3);
+}
+
+foo(1).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-this-value-global.js b/js/src/tests/test262/language/statements/async-function/evaluation-this-value-global.js
new file mode 100644
index 0000000000..75f9f331b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-this-value-global.js
@@ -0,0 +1,19 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ The this value is set to the global object when not passed in sloppy mode.
+flags: [noStrict, async]
+includes: [asyncHelpers.js]
+---*/
+
+var glob = this;
+async function foo() {
+ assert.sameValue(this, glob);
+}
+
+asyncTest(foo);
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-this-value-passed.js b/js/src/tests/test262/language/statements/async-function/evaluation-this-value-passed.js
new file mode 100644
index 0000000000..ac6bb9f99f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-this-value-passed.js
@@ -0,0 +1,19 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ The this value from the caller is present in the async function body
+flags: [async]
+---*/
+
+
+async function foo(a) {
+ assert.sameValue(this, a)
+}
+var obj = {};
+foo.call(obj, obj).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/async-function/evaluation-unmapped-arguments.js b/js/src/tests/test262/language/statements/async-function/evaluation-unmapped-arguments.js
new file mode 100644
index 0000000000..1f94e09bb8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/evaluation-unmapped-arguments.js
@@ -0,0 +1,24 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ Unmapped arguments object is used when the async function doesn't have a
+ simple parameter list.
+flags: [async]
+---*/
+
+
+async function foo(a = 42) {
+ arguments[0] = 2;
+ assert.sameValue(a, 1);
+
+ a = 3;
+ assert.sameValue(arguments[0], 2);
+}
+
+foo(1).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/async-func-decl-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/async-func-decl-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..93513936b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/async-func-decl-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template
+/*---
+description: Forbidden extension, f.arguments (async function declaration)
+esid: sec-async-function-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+async function f() {
+ assert.sameValue(f.hasOwnProperty("arguments"), false);
+ callCount++;
+}
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/async-func-decl-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/async-func-decl-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..3afd748784
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/async-func-decl-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template
+/*---
+description: Forbidden extension, o.caller (async function declaration)
+esid: sec-async-function-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+async function f() {
+ assert.sameValue(f.hasOwnProperty("caller"), false);
+ callCount++;
+}
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..01aa1a889f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template
+/*---
+description: Forbidden extension, o.caller (async function declaration)
+esid: sec-async-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+async function f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+ callCount++;
+}
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..d67e324fad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template
+/*---
+description: Forbidden extension, o.caller (async function declaration)
+esid: sec-async-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+async function f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+ callCount++;
+}
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..c9ce6d0156
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/async-func-decl-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template
+/*---
+description: Forbidden extension, o.caller (async function declaration)
+esid: sec-async-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+async function f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+ callCount++;
+}
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/async-function/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/async-function/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/async-function/let-newline-await-in-async-function.js b/js/src/tests/test262/language/statements/async-function/let-newline-await-in-async-function.js
new file mode 100644
index 0000000000..3f9b97ac42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/let-newline-await-in-async-function.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Jeff Walden <jwalden+code@mit.edu>
+esid: sec-let-and-const-declarations
+description: >
+ `let await` does not permit ASI in between, as `await` is a BindingIdentifier
+info: |
+ `await` is a perfectly cromulent binding name in any context grammatically, just
+ prohibited by static semantics in some contexts. Therefore ASI can never apply
+ between `let` (where a LexicalDeclaration is permitted) and `await`,
+ so a subsequent `0` where `=` was expected is a syntax error.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async function f() {
+ let
+ await 0;
+}
diff --git a/js/src/tests/test262/language/statements/async-function/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/async-function/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..e9129e8b7b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/object-destructuring-param-strict-body.js
@@ -0,0 +1,110 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/async-func-decl.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function declaration)
+esid: sec-async-function-definitions
+features: [rest-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+async function f({property}) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/async-function/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/async-function/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..6c9d696c32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/params-trailing-comma-multiple.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/async-func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (async function declaration)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+async function ref(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+}
+
+ref(42, 39, 1).then(() => {
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 2, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/async-function/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/async-function/params-trailing-comma-single.js
new file mode 100644
index 0000000000..5f1b1ee69e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/params-trailing-comma-single.js
@@ -0,0 +1,37 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/async-func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (async function declaration)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+async function ref(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+}
+
+ref(42, 39).then(() => {
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/async-function/rest-param-strict-body.js b/js/src/tests/test262/language/statements/async-function/rest-param-strict-body.js
new file mode 100644
index 0000000000..b58daec03c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/rest-param-strict-body.js
@@ -0,0 +1,110 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/async-func-decl.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async function declaration)
+esid: sec-async-function-definitions
+features: [rest-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+async function f(a,...rest) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/async-function/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/async-function/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..a4e5b59135
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/async-func-decl.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async function declaration)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+
+async function f(...a,) {
+
+}
diff --git a/js/src/tests/test262/language/statements/async-function/returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/statements/async-function/returns-async-arrow-returns-arguments-from-parent-function.js
new file mode 100644
index 0000000000..2643fe8125
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/returns-async-arrow-returns-arguments-from-parent-function.js
@@ -0,0 +1,31 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-arguments-from-parent-function.case
+// - src/async-functions/evaluation/async-declaration.template
+/*---
+description: Async function returns an async function. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+async function asyncFn(x) {
+ let a = arguments;
+ return async () => a === arguments;
+}
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, true);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/statements/async-function/returns-async-arrow-returns-newtarget.js
new file mode 100644
index 0000000000..9b9f18d211
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/returns-async-arrow-returns-newtarget.js
@@ -0,0 +1,30 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-newtarget.case
+// - src/async-functions/evaluation/async-declaration.template
+/*---
+description: Async function returns an async function. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+async function asyncFn(x) {
+ return async () => new.target;
+}
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/returns-async-arrow.js b/js/src/tests/test262/language/statements/async-function/returns-async-arrow.js
new file mode 100644
index 0000000000..d611abfd48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/returns-async-arrow.js
@@ -0,0 +1,30 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow.case
+// - src/async-functions/evaluation/async-declaration.template
+/*---
+description: Async function returns an async function. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+async function asyncFn(x) {
+ return async () => x;
+}
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/statements/async-function/returns-async-function-returns-arguments-from-own-function.js
new file mode 100644
index 0000000000..ec3e021001
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/returns-async-function-returns-arguments-from-own-function.js
@@ -0,0 +1,31 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-arguments-from-own-function.case
+// - src/async-functions/evaluation/async-declaration.template
+/*---
+description: Async function returns an async function. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+async function asyncFn(x) {
+ let a = arguments;
+ return async function() { return a === arguments; };
+}
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, false);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/statements/async-function/returns-async-function-returns-newtarget.js
new file mode 100644
index 0000000000..ebcbe36042
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/returns-async-function-returns-newtarget.js
@@ -0,0 +1,30 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-newtarget.case
+// - src/async-functions/evaluation/async-declaration.template
+/*---
+description: Async function returns an async function. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+async function asyncFn(x) {
+ return async function() { return new.target; };
+}
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/returns-async-function.js b/js/src/tests/test262/language/statements/async-function/returns-async-function.js
new file mode 100644
index 0000000000..c3b973c6bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/returns-async-function.js
@@ -0,0 +1,30 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function.case
+// - src/async-functions/evaluation/async-declaration.template
+/*---
+description: Async function returns an async function. (Async function declaration)
+esid: prod-AsyncFunctionDeclaration
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionDeclaration:
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+async function asyncFn(x) {
+ return async function() { return x; };
+}
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/shell.js b/js/src/tests/test262/language/statements/async-function/shell.js
new file mode 100644
index 0000000000..ae18ad584d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/shell.js
@@ -0,0 +1,113 @@
+// GENERATED, DO NOT EDIT
+// file: asyncHelpers.js
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ A collection of assertion and wrapper functions for testing asynchronous built-ins.
+defines: [asyncTest]
+---*/
+
+function asyncTest(testFunc) {
+ if (!Object.hasOwn(globalThis, "$DONE")) {
+ throw new Test262Error("asyncTest called without async flag");
+ }
+ if (typeof testFunc !== "function") {
+ $DONE(new Test262Error("asyncTest called with non-function argument"));
+ return;
+ }
+ try {
+ testFunc().then(
+ function () {
+ $DONE();
+ },
+ function (error) {
+ $DONE(error);
+ }
+ );
+ } catch (syncError) {
+ $DONE(syncError);
+ }
+}
+
+assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
+ var innerThenable;
+ if (message === undefined) {
+ message = "";
+ } else {
+ message += " ";
+ }
+ if (typeof func === "function") {
+ try {
+ innerThenable = func();
+ if (
+ innerThenable === null ||
+ typeof innerThenable !== "object" ||
+ typeof innerThenable.then !== "function"
+ ) {
+ message +=
+ "Expected to obtain an inner promise that would reject with a" +
+ expectedErrorConstructor.name +
+ " but result was not a thenable";
+ throw new Test262Error(message);
+ }
+ } catch (thrown) {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise";
+ throw new Test262Error(message);
+ }
+ } else {
+ message +=
+ "assert.throwsAsync called with an argument that is not a function";
+ throw new Test262Error(message);
+ }
+
+ try {
+ return innerThenable.then(
+ function () {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but no exception was thrown at all";
+ throw new Test262Error(message);
+ },
+ function (thrown) {
+ var expectedName, actualName;
+ if (typeof thrown !== "object" || thrown === null) {
+ message += "Thrown value was not an object!";
+ throw new Test262Error(message);
+ } else if (thrown.constructor !== expectedErrorConstructor) {
+ expectedName = expectedErrorConstructor.name;
+ actualName = thrown.constructor.name;
+ if (expectedName === actualName) {
+ message +=
+ "Expected a " +
+ expectedName +
+ " but got a different error constructor with the same name";
+ } else {
+ message +=
+ "Expected a " + expectedName + " but got a " + actualName;
+ }
+ throw new Test262Error(message);
+ }
+ }
+ );
+ } catch (thrown) {
+ if (typeof thrown !== "object" || thrown === null) {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but innerThenable synchronously threw a value that was not an object ";
+ } else {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but a " +
+ thrown.constructor.name +
+ " was thrown synchronously";
+ }
+ throw new Test262Error(message);
+ }
+};
diff --git a/js/src/tests/test262/language/statements/async-function/syntax-declaration-line-terminators-allowed.js b/js/src/tests/test262/language/statements/async-function/syntax-declaration-line-terminators-allowed.js
new file mode 100644
index 0000000000..6573d802e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/syntax-declaration-line-terminators-allowed.js
@@ -0,0 +1,19 @@
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ Declarations allow line breaks after function and after arguments list
+---*/
+
+async function
+foo()
+{
+
+}
+
+assert(foo instanceof Function);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-function/syntax-declaration-no-line-terminator.js b/js/src/tests/test262/language/statements/async-function/syntax-declaration-no-line-terminator.js
new file mode 100644
index 0000000000..586b181800
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/syntax-declaration-no-line-terminator.js
@@ -0,0 +1,15 @@
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: Async function declarations cannot have a line break after `async`
+info: Reference error is thrown due to looking up async in strict mode
+---*/
+assert.throws(ReferenceError, function() {
+ async
+ function foo() {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-function/syntax-declaration.js b/js/src/tests/test262/language/statements/async-function/syntax-declaration.js
new file mode 100644
index 0000000000..7b409d3007
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/syntax-declaration.js
@@ -0,0 +1,16 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: Async function declaration returns a promise
+flags: [async]
+---*/
+
+async function foo () { }
+
+foo().then(function() {
+ $DONE();
+})
diff --git a/js/src/tests/test262/language/statements/async-function/try-reject-finally-reject.js b/js/src/tests/test262/language/statements/async-function/try-reject-finally-reject.js
new file mode 100644
index 0000000000..14814d099b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/try-reject-finally-reject.js
@@ -0,0 +1,28 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+async function f() {
+ try {
+ await new Promise(function(resolve, reject) {
+ reject("early-reject");
+ });
+ } finally {
+ await new Promise(function(resolve, reject) {
+ reject("override");
+ });
+ }
+}
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Awaited rejection in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/try-reject-finally-return.js b/js/src/tests/test262/language/statements/async-function/try-reject-finally-return.js
new file mode 100644
index 0000000000..5bf93ea1cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/try-reject-finally-return.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+async function f() {
+ try {
+ await new Promise(function(resolve, reject) {
+ reject("early-reject");
+ });
+ } finally {
+ return "override";
+ }
+}
+
+f().then(function(value) {
+ assert.sameValue(value, "override", "Return in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/try-reject-finally-throw.js b/js/src/tests/test262/language/statements/async-function/try-reject-finally-throw.js
new file mode 100644
index 0000000000..8027488be6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/try-reject-finally-throw.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+async function f() {
+ try {
+ await new Promise(function(resolve, reject) {
+ reject("early-reject");
+ });
+ } finally {
+ throw "override";
+ }
+}
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Exception thrown in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/try-return-finally-reject.js b/js/src/tests/test262/language/statements/async-function/try-return-finally-reject.js
new file mode 100644
index 0000000000..0455d3ad71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/try-return-finally-reject.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer resolving an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+async function f() {
+ try {
+ return "early-return";
+ } finally {
+ await new Promise(function(resolve, reject) {
+ reject("override");
+ });
+ }
+}
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Awaited rejection in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/try-return-finally-return.js b/js/src/tests/test262/language/statements/async-function/try-return-finally-return.js
new file mode 100644
index 0000000000..eed39ff17b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/try-return-finally-return.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer resolving an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+async function f() {
+ try {
+ return "early-return";
+ } finally {
+ return await new Promise(function(resolve, reject) {
+ resolve("override");
+ });
+ }
+}
+
+f().then(function(value) {
+ assert.sameValue(value, "override", "Return in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/try-return-finally-throw.js b/js/src/tests/test262/language/statements/async-function/try-return-finally-throw.js
new file mode 100644
index 0000000000..aba4c86fe6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/try-return-finally-throw.js
@@ -0,0 +1,24 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer resolving an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+async function f() {
+ try {
+ return "early-return";
+ } finally {
+ throw "override";
+ }
+}
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Exception thrown in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/try-throw-finally-reject.js b/js/src/tests/test262/language/statements/async-function/try-throw-finally-reject.js
new file mode 100644
index 0000000000..be2d482b52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/try-throw-finally-reject.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+async function f() {
+ try {
+ throw "early-throw";
+ } finally {
+ await new Promise(function(resolve, reject) {
+ reject("override");
+ });
+ }
+}
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Awaited rejection in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/try-throw-finally-return.js b/js/src/tests/test262/language/statements/async-function/try-throw-finally-return.js
new file mode 100644
index 0000000000..80a8d303db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/try-throw-finally-return.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+async function f() {
+ try {
+ throw "early-throw";
+ } finally {
+ return await new Promise(function(resolve, reject) {
+ resolve("override");
+ });
+ }
+}
+
+f().then(function(value) {
+ assert.sameValue(value, "override", "Return in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/try-throw-finally-throw.js b/js/src/tests/test262/language/statements/async-function/try-throw-finally-throw.js
new file mode 100644
index 0000000000..0ccfe934a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/try-throw-finally-throw.js
@@ -0,0 +1,24 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+async function f() {
+ try {
+ throw "early-throw";
+ } finally {
+ throw "override";
+ }
+}
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Exception thrown in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-function/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/statements/async-function/unscopables-with-in-nested-fn.js
new file mode 100644
index 0000000000..bcec8c672e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/unscopables-with-in-nested-fn.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with-in-nested-fn.case
+// - src/function-forms/default/async-func-decl.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async function declaration)
+esid: sec-async-function-definitions
+features: [globalThis, Symbol.unscopables, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+async function ref(x) {
+ (function() {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ }
+ })();
+ (function() {
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ })();
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+}
+
+ref(10).then(() => {
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+}).then($DONE, $DONE);
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');
diff --git a/js/src/tests/test262/language/statements/async-function/unscopables-with.js b/js/src/tests/test262/language/statements/async-function/unscopables-with.js
new file mode 100644
index 0000000000..ecdf135c5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-function/unscopables-with.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with.case
+// - src/function-forms/default/async-func-decl.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async function declaration)
+esid: sec-async-function-definitions
+features: [globalThis, Symbol.unscopables, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionDeclaration :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+async function ref(x) {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
+ }
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+}
+
+ref(10).then(() => {
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+}).then($DONE, $DONE);
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');
diff --git a/js/src/tests/test262/language/statements/async-generator/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/async-generator/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..4660b77b66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/array-destructuring-param-strict-body.js
@@ -0,0 +1,113 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/async-gen-func-decl.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+async function* f([element]) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/async-generator/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..a16ff93677
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/await-as-binding-identifier-escaped.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ var \u0061wait;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/async-generator/await-as-binding-identifier.js
new file mode 100644
index 0000000000..7542c47b57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/await-as-binding-identifier.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ var await;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/async-generator/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..51e5721c93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/await-as-identifier-reference-escaped.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ void \u0061wait;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/async-generator/await-as-identifier-reference.js
new file mode 100644
index 0000000000..8a6a5d34df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/await-as-identifier-reference.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ void await;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/async-generator/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..b84fe46ab9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/await-as-label-identifier-escaped.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ \u0061wait: ;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/await-as-label-identifier.js b/js/src/tests/test262/language/statements/async-generator/await-as-label-identifier.js
new file mode 100644
index 0000000000..bf5216ae72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/await-as-label-identifier.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ await: ;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/browser.js b/js/src/tests/test262/language/statements/async-generator/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/browser.js
diff --git a/js/src/tests/test262/language/statements/async-generator/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/async-generator/dflt-params-abrupt.js
new file mode 100644
index 0000000000..e22664b6d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dflt-params-abrupt.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/async-gen-func-decl.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+
+var callCount = 0;
+async function* f(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+assert.sameValue(callCount, 0, 'generator function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/async-generator/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..dee107ae7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/async-gen-func-decl.template
+/*---
+description: Use of initializer when argument value is not `undefined` (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+async function* ref(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+}
+
+ref(false, '', NaN, 0, null, obj).next().then(() => {
+ assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
diff --git a/js/src/tests/test262/language/statements/async-generator/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/async-generator/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..614a523460
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dflt-params-arg-val-undefined.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/async-gen-func-decl.template
+/*---
+description: Use of initializer when argument value is `undefined` (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+async function* ref(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+}
+
+ref(undefined, void 0).next().then(() => {
+ assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/async-generator/dflt-params-duplicates.js
new file mode 100644
index 0000000000..48ac553082
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dflt-params-duplicates.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/async-gen-func-decl.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [default-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+
+async function* f(x = 0, x) {
+
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/async-generator/dflt-params-ref-later.js
new file mode 100644
index 0000000000..e17f8f5136
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dflt-params-ref-later.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/async-gen-func-decl.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+async function* f(x = y, y) {
+
+ callCount = callCount + 1;
+}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+assert.sameValue(callCount, 0, 'generator function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/async-generator/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..2df4cd9872
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dflt-params-ref-prior.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/async-gen-func-decl.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+async function* ref(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+}
+
+ref(3).next().then(() => {
+ assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/async-generator/dflt-params-ref-self.js
new file mode 100644
index 0000000000..24b4278be1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dflt-params-ref-self.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/async-gen-func-decl.template
+/*---
+description: Referencing a parameter from within its own initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+async function* f(x = x) {
+
+ callCount = callCount + 1;
+}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+assert.sameValue(callCount, 0, 'generator function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dflt-params-rest.js b/js/src/tests/test262/language/statements/async-generator/dflt-params-rest.js
new file mode 100644
index 0000000000..50094b3de8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dflt-params-rest.js
@@ -0,0 +1,46 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/async-gen-func-decl.template
+/*---
+description: RestParameter does not support an initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [default-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+async function* f(...x = []) {
+
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/async-generator/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..f5e049aeda
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dflt-params-trailing-comma.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/async-gen-func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+async function* ref(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+}
+
+ref(42, undefined, 1).next().then(() => {
+ assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-close.js
new file mode 100644
index 0000000000..66717ee508
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-close.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+};
+f(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..1a9865bda0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Abrupt completion returned by GetIterator (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+
+async function* f([x, y, z]) {
+
+};
+
+assert.throws(TypeError, function() {
+ f([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-get-err.js
new file mode 100644
index 0000000000..47760857b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-get-err.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Abrupt completion returned by GetIterator (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+
+async function* f([x]) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-no-close.js
new file mode 100644
index 0000000000..f42a6ef574
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-init-iter-no-close.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+};
+f(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-name-iter-val.js
new file mode 100644
index 0000000000..9dd28b5cbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-name-iter-val.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: SingleNameBinding with normal value iteration (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..5eeaddad31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..cbbc764a7b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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;
+async function* f([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+};
+f([[7, 8, 9]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..723e86f68d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..40495d162f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+};
+f([[]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..fbdc137fd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..51d5ea22a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f([[23]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..78f1782d92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[...x] = 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);
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..9271decb43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+};
+f([values]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..d0ebed22f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Nested array destructuring with a null value (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+
+async function* f([[x]]) {
+
+};
+
+assert.throws(TypeError, function() {
+ f([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..aaf0cfd4cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Destructuring initializer with an exhausted iterator (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..41133d343f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// 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/async-gen-func-decl.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..361a54ca1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// 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/async-gen-func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..35ac762a96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// 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/async-gen-func-decl.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..0553c068fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// 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/async-gen-func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..c785c7d025
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// 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/async-gen-func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..2e66084421
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Destructuring initializer with a "hole" (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+};
+f([,]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..937670ce09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f([null, 0, false, '']).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..a47cab8a60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Destructuring initializer returns an abrupt completion (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+---*/
+
+
+async function* f([x = (function() { throw new Test262Error(); })()]) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..711fcfc10b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Destructuring initializer with an undefined value (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f([undefined]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..91a4c062fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Destructuring initializer is an unresolvable reference (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+async function* f([ x = unresolvableReference ]) {
+
+};
+
+assert.throws(ReferenceError, function() {
+ f([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..d1a11c6fac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: SingleNameBinding when value iteration completes (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..d4b4d4e018
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..f572a96d70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+
+async function* f([x]) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..38b3441861
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+async function* f([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..178441885a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+async function* f([x]) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..5c49770c68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..050ac6608e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..5b956e129f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-id.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+};
+f([{ x: 11, y: 22, z: 33 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..1880fe720f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..46e8755d07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f([{ u: 777, w: 888, y: 999 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..a70d7d5795
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Nested object destructuring with a null value (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+async function* f([{ x }]) {
+
+};
+
+assert.throws(TypeError, function() {
+ f([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..025274a7d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Nested object destructuring with a value of `undefined` (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+async function* f([{ x }]) {
+
+};
+
+assert.throws(TypeError, function() {
+ f([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..b7f11d1ab4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision-exhausted.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Elision accepts exhausted iterator (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([,]) {
+
+ callCount = callCount + 1;
+};
+f(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..cf759e2f6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision-step-err.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+
+async function* f([,]) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision.js
new file mode 100644
index 0000000000..2571145e47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-elision.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Elision advances iterator (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-empty.js
new file mode 100644
index 0000000000..db417ba5bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-empty.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+async function* f([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+};
+f(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..1d1e9fd881
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element containing an array BindingElementList pattern (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+};
+f([3, 4, 5]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..e83247fdc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element containing an elision (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+};
+f(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..73693bd1bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element containing an "empty" array pattern (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+};
+f(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..d1a09db82f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,49 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element containing a rest element (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+};
+f(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..e12f4ca909
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-direct.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Lone rest element (direct binding) (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+async function* f([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+};
+f([1]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..17aef78e13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Rest element following elision elements (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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 iter = (function*() { throw new Test262Error(); })();
+
+
+async function* f([, ...x]) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..e78db95d58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-elision.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element following elision elements (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+};
+f(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..afbae9f5b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: RestElement applied to an exhausted iterator (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+};
+f([1, 2]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..c8ea051d59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+
+async function* f([...x]) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..58b4e41cae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+async function* f([...x]) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..c6841c4a97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-id.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Lone rest element (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...x]) {
+ 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);
+ callCount = callCount + 1;
+};
+f(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..bb9b3db04e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-ary.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..ff6045f1af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-id.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element (identifier) does not support initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...x = []]) {
+
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..613a299c64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-init-obj.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...{ x } = []]) {
+
+ callCount = callCount + 1;
+};
+f([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..5f7c9ee7e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...[x], y]) {
+
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..e05edefa89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element (identifier) may not be followed by any element (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...x, y]) {
+
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..33c334013c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...{ x }, y]) {
+
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..29a9d3265b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-obj-id.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element containing an object binding pattern (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..684eb38b2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,49 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest element containing an object binding pattern (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+async function* f([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+};
+f([7, 8, 9]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/browser.js b/js/src/tests/test262/language/statements/async-generator/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..6414b85cc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-close.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..1a56240ee1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+
+async function* f([x, y, z] = [1, 2, 3]) {
+
+};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..de44a6cc57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-get-err.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+
+async function* f([x] = iter) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..e8e41b61f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-init-iter-no-close.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..8465a02be4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-name-iter-val.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..b1767c07f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..23964a3413
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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;
+async function* f([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..0f5d51e217
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..dc8b97e069
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..c86116e893
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..bd28dd3256
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..52d1b56404
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[...x] = 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);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..87d6e440ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..07776a80c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Nested array destructuring with a null value (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+
+async function* f([[x]] = [null]) {
+
+};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..cd7012022b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..5618b6127c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// 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/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..f8af995ee3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// 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/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..a7a2ac2817
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// 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/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..29cb41fcc3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// 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/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..9e06b9f8d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// 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/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..06d9249510
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..4ac8a44b1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..21664b01a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+---*/
+
+
+async function* f([x = (function() { throw new Test262Error(); })()] = [undefined]) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..d65d474711
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..fafba0dda8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+async function* f([ x = unresolvableReference ] = []) {
+
+};
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..c1e0cdc1cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..ac2460e888
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..8c48978994
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+
+async function* f([x] = g) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..ea16359a78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+async function* f([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..b35c1aae02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+async function* f([x] = g) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..25876266b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..0b777e4c10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..32510ad6ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..5a8c4cf500
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..e1894c266d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..b1da8b1b5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Nested object destructuring with a null value (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+async function* f([{ x }] = [null]) {
+
+};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..98f8e419ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+async function* f([{ x }] = []) {
+
+};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..36ee1dd508
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Elision accepts exhausted iterator (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([,] = iter) {
+
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..7961fd0631
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision-step-err.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+
+async function* f([,] = iter) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..d6b839cf5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-elision.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Elision advances iterator (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..8d415e85d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-empty.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+async function* f([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..d59f9184cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..74ce17b637
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element containing an elision (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..534fee7f9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..97ef5cf592
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,49 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element containing a rest element (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...[...x]] = 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);
+
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..20ab4e6e64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Lone rest element (direct binding) (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+async function* f([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..3b681e70e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Rest element following elision elements (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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 iter = (function*() { throw new Test262Error(); })();
+
+
+async function* f([, ...x] = iter) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..a3a71900f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element following elision elements (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([ , , ...x] = 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);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..0dd8596944
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..77cd5280ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+
+async function* f([...x] = iter) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..daea98a488
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+async function* f([...x] = iter) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..39b0da8701
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Lone rest element (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...x] = 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);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..4ce335cf4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..9b4c9810e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...x = []] = []) {
+
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..215054fba8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..30829b32c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..61dc0c55af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..b968e3a5c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+async function* f([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..22573b9f72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element containing an object binding pattern (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..1ec00fde2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,49 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest element containing an object binding pattern (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+async function* f([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-init-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-init-null.js
new file mode 100644
index 0000000000..7666e0fee3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-init-null.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+async function* f({} = null) {
+
+};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-init-undefined.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..72af21f978
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-init-undefined.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+async function* f({} = undefined) {
+
+};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..d09c56d7bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-empty.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+async function* f({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..eca4bc75ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+async function* f({ poisoned } = poisonedProperty) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..305dd74e47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..4c1ffddfc3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..27a82ff7ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..98a366aa31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..4496b1a371
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..f16fd9dde4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..50b1cf0c36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-throws.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+async function* f({ x = thrower() } = {}) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..b15b7359c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+async function* f({ x = unresolvableReference } = {}) {
+
+};
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..be253e56a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,36 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+async function* f({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..75d1b49d22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-list-err.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+
+async function* f({ a, b = thrower(), c = ++initCount } = {}) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..6b7db21671
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..44112cd71b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,36 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+async function* f({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..118f16b3e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+async function* f({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {
+
+};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..552d85c163
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..f5e611718d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+async function* f({ [thrower()]: x } = {}) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..ef6f3f23e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+async function* f({ poisoned: x = ++initEvalCount } = poisonedProperty) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..edcc87ceb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..b0814dabfe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+async function* f({ x: y = thrower() } = {}) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..74ef7127dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+async function* f({ x: y = unresolvableReference } = {}) {
+
+};
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..5edab18821
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+async function* f({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..308f9f5aca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+async function* f({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..660995b69d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Binding as specified via property name and identifier (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+async function* f({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..62ed8e5e15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..7d4681cde7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+async function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {
+
+};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..a241147697
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/async-gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+async function* f({ w: { x, y, z } = undefined } = { }) {
+
+};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..4e1490ec4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..4cfe3fafe0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+async function* f({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..3563a9ae17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+async function* f({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..a5a3e3b2ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/async-gen-func-decl-dflt.template
+/*---
+description: Rest object contains just unextracted data (async generator function declaration (default parameter))
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+async function* f({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-init-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-init-null.js
new file mode 100644
index 0000000000..deeb256b6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-init-null.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+async function* f({}) {
+
+};
+
+assert.throws(TypeError, function() {
+ f(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-init-undefined.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-init-undefined.js
new file mode 100644
index 0000000000..f04f037892
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-init-undefined.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+async function* f({}) {
+
+};
+
+assert.throws(TypeError, function() {
+ f(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-empty.js
new file mode 100644
index 0000000000..23428d35f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-empty.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+async function* f({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+};
+f(obj).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..1795f3cc65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-get-value-err.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+async function* f({ poisoned }) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..237d5f9694
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..e272d987e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..6389dbcb7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..1ccd8761ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..c9679afdfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..3770316b3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-skipped.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f({ w: null, x: 0, y: false, z: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..34eda335f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-throws.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Error thrown when evaluating the initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+async function* f({ x = thrower() }) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..3e8e754b26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Destructuring initializer is an unresolvable reference (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+async function* f({ x = unresolvableReference }) {
+
+};
+
+assert.throws(ReferenceError, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..3fb2d68313
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,36 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+async function* f({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-list-err.js
new file mode 100644
index 0000000000..2eb05668ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-list-err.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+
+async function* f({ a, b = thrower(), c = ++initCount }) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..0f9f618d41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-init.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..8739c17c46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,36 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+async function* f({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+};
+f({ x: [45] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..0ce6940358
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+async function* f({ w: [x, y, z] = [4, 5, 6] }) {
+
+};
+
+assert.throws(TypeError, function() {
+ f({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..121f6a935d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-ary.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({ w: [7, undefined, ] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..83da8522d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-eval-err.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Evaluation of property name returns an abrupt completion (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+async function* f({ [thrower()]: x }) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..dbbae145d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+async function* f({ poisoned: x = ++initEvalCount }) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..70d3ccd06c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f({ s: null, u: 0, w: false, y: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..eca60f73b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Error thrown when evaluating the initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+async function* f({ x: y = thrower() }) {
+
+};
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..302e84b74c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Destructuring initializer is an unresolvable reference (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+async function* f({ x: y = unresolvableReference }) {
+
+};
+
+assert.throws(ReferenceError, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..f93d9daeb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-init.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+async function* f({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f({ }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..e938f19afc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+async function* f({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..e7aa455720
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-id.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Binding as specified via property name and identifier (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+async function* f({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..b3afb6e80d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-init.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({ w: undefined }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..7685385e43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+async function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+
+};
+
+assert.throws(TypeError, function() {
+ f({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..17a2359eaf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/async-gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+async function* f({ w: { x, y, z } = undefined }) {
+
+};
+
+assert.throws(TypeError, function() {
+ f({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..6656224cd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-prop-obj.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+async function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({ w: { x: undefined, z: 7 } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..b68d00047c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-getter.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+async function* f({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f({ get v() { count++; return 2; } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..14ade21962
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+async function* f({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+};
+f(o).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..60b6b9e206
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/obj-ptrn-rest-val-obj.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/async-gen-func-decl.template
+/*---
+description: Rest object contains just unextracted data (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+async function* f({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f({x: 1, y: 2, a: 5, b: 3}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/dstr/shell.js b/js/src/tests/test262/language/statements/async-generator/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/async-generator/escaped-async.js b/js/src/tests/test262/language/statements/async-generator/escaped-async.js
new file mode 100644
index 0000000000..953409edfd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/escaped-async.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-grammar-notation
+description: >
+ The `async` contextual keyword must not contain Unicode escape sequences.
+info: |
+ Terminal symbols are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+\u0061sync function* f(){}
diff --git a/js/src/tests/test262/language/statements/async-generator/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/statements/async-generator/eval-var-scope-syntax-err.js
new file mode 100644
index 0000000000..2711c015b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/eval-var-scope-syntax-err.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/eval-var-scope-syntax-err.case
+// - src/function-forms/error-no-strict/async-gen-func-decl.template
+/*---
+description: sloppy direct eval in params introduces var (async generator function declaration in sloppy code)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [default-parameters, async-iteration]
+flags: [generated, noStrict]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+
+ Runtime Semantics: IteratorBindingInitialization
+ FormalParameter : BindingElement
+
+ 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment.
+
+---*/
+
+
+var callCount = 0;
+async function* f(a = eval("var a = 42")) {
+
+ callCount = callCount + 1;
+}
+
+assert.throws(SyntaxError, function() {
+ f();
+});
+
+assert.sameValue(callCount, 0, 'generator function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/async-gen-func-decl-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/async-gen-func-decl-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..2fba1e4405
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/async-gen-func-decl-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.template
+/*---
+description: Forbidden extension, f.arguments (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [arrow-function, async-functions, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+async function* f() {
+ assert.sameValue(f.hasOwnProperty("arguments"), false);
+ callCount++;
+}
+
+f().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/async-gen-func-decl-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/async-gen-func-decl-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..d791f45a6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/async-gen-func-decl-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.template
+/*---
+description: Forbidden extension, o.caller (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [arrow-function, async-functions, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+async function* f() {
+ assert.sameValue(f.hasOwnProperty("caller"), false);
+ callCount++;
+}
+
+f().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..c662810e41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template
+/*---
+description: Forbidden extension, o.caller (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [arrow-function, async-functions, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+async function* f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+ callCount++;
+}
+
+f().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..d6e06a187c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template
+/*---
+description: Forbidden extension, o.caller (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [arrow-function, async-functions, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+async function* f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+ callCount++;
+}
+
+f().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..e6de8ef013
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/async-gen-func-decl-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template
+/*---
+description: Forbidden extension, o.caller (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [arrow-function, async-functions, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+async function* f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+ callCount++;
+}
+
+f().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/async-generator/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/async-generator/generator-created-after-decl-inst.js b/js/src/tests/test262/language/statements/async-generator/generator-created-after-decl-inst.js
new file mode 100644
index 0000000000..403a0b70fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/generator-created-after-decl-inst.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncgenerator-definitions-evaluatebody
+description: >
+ The generator object is created after FunctionDeclarationInstantiation.
+info: |
+ 14.5.10 Runtime Semantics: EvaluateBody
+
+ 1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList).
+ 2. Let generator be ? OrdinaryCreateFromConstructor(functionObject, "%AsyncGeneratorPrototype%",
+ « [[AsyncGeneratorState]], [[AsyncGeneratorContext]], [[AsyncGeneratorQueue]] »).
+ 3. Perform ! AsyncGeneratorStart(generator, FunctionBody).
+ ...
+
+features: [async-iteration]
+---*/
+
+async function* g(a = (g.prototype = null)) {}
+var oldPrototype = g.prototype;
+var it = g();
+
+assert.notSameValue(Object.getPrototypeOf(it), oldPrototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/async-generator/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/async-generator/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..cf3968ee69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/object-destructuring-param-strict-body.js
@@ -0,0 +1,113 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/async-gen-func-decl.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+async function* f({property}) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/async-generator/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..6bd7572487
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/params-trailing-comma-multiple.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/async-gen-func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+async function* ref(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+}
+
+ref(42, 39, 1).next().then(() => {
+ assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 2, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/async-generator/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/async-generator/params-trailing-comma-single.js
new file mode 100644
index 0000000000..073dab2edb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/params-trailing-comma-single.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/async-gen-func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+async function* ref(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+}
+
+ref(42, 39).next().then(() => {
+ assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/async-generator/rest-param-strict-body.js b/js/src/tests/test262/language/statements/async-generator/rest-param-strict-body.js
new file mode 100644
index 0000000000..5ea01c0c44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/rest-param-strict-body.js
@@ -0,0 +1,113 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/async-gen-func-decl.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+async function* f(a,...rest) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/async-generator/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..758af25e8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/async-gen-func-decl.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+
+async function* f(...a,) {
+
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/return-undefined-implicit-and-explicit.js b/js/src/tests/test262/language/statements/async-generator/return-undefined-implicit-and-explicit.js
new file mode 100644
index 0000000000..75bc5dd2d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/return-undefined-implicit-and-explicit.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-return-statement-runtime-semantics-evaluation
+description: >
+ Return with an explicit return value awaits this value.
+info: |
+ 13.10.1 Runtime Semantics: Evaluation
+
+ ReturnStatement : return;
+ 1. Return Completion { [[Type]]: return, [[Value]]: undefined, [[Target]]: empty }.
+
+ ReturnStatement : return Expression ;
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let exprValue be ? GetValue(exprRef).
+ 3. If ! GetGeneratorKind() is async, set exprValue to ? Await(exprValue).
+ 4. Return Completion { [[Type]]: return, [[Value]]: exprValue, [[Target]]: empty }.
+
+ 25.5.3.2 AsyncGeneratorStart ( generator, generatorBody )
+
+ ...
+ 5. Set the code evaluation state of genContext such that when evaluation is resumed for that
+ execution context the following steps will be performed:
+ a. Let result be the result of evaluating generatorBody.
+ ...
+ e. If result is a normal completion, let resultValue be undefined.
+ ...
+ g. Return ! AsyncGeneratorResolve(generator, resultValue, true).
+
+includes: [compareArray.js]
+flags: [async]
+features: [async-iteration]
+---*/
+
+// 25.5.3.2, step 5.e: |generatorBody| execution ends with a normal completion.
+async function* g1() {
+ // no return
+}
+
+// 13.10.1: No expression form means direct return.
+async function* g2() {
+ return;
+}
+
+// 13.10.1: Explicit expression requires Await.
+async function* g3() {
+ return undefined; // Return undefined via global value `undefined`.
+}
+
+// 13.10.1: Explicit expression requires Await.
+async function* g4() {
+ return void 0; // Return undefined via void expression.
+}
+
+var expected = [
+ "tick 1",
+
+ "g1 ret",
+ "g2 ret",
+
+ "tick 2",
+
+ "g3 ret",
+ "g4 ret",
+];
+
+var actual = [];
+
+Promise.resolve(0)
+ .then(() => actual.push("tick 1"))
+ .then(() => actual.push("tick 2"))
+ .then(() => {
+ assert.compareArray(actual, expected, "Ticks for implicit and explicit return undefined");
+}).then($DONE, $DONE);
+
+g1().next().then(v => actual.push("g1 ret"));
+g2().next().then(v => actual.push("g2 ret"));
+g3().next().then(v => actual.push("g3 ret"));
+g4().next().then(v => actual.push("g4 ret"));
diff --git a/js/src/tests/test262/language/statements/async-generator/shell.js b/js/src/tests/test262/language/statements/async-generator/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/shell.js
diff --git a/js/src/tests/test262/language/statements/async-generator/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/statements/async-generator/unscopables-with-in-nested-fn.js
new file mode 100644
index 0000000000..7c63a23776
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/unscopables-with-in-nested-fn.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with-in-nested-fn.case
+// - src/function-forms/default/async-gen-func-decl.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [globalThis, Symbol.unscopables, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+async function* ref(x) {
+ (function() {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ }
+ })();
+ (function() {
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ })();
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+}
+
+ref(10).next().then(() => {
+ assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+}).then($DONE, $DONE);
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');
diff --git a/js/src/tests/test262/language/statements/async-generator/unscopables-with.js b/js/src/tests/test262/language/statements/async-generator/unscopables-with.js
new file mode 100644
index 0000000000..791c40315f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/unscopables-with.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with.case
+// - src/function-forms/default/async-gen-func-decl.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async generator function declaration)
+esid: sec-asyncgenerator-definitions-instantiatefunctionobject
+features: [globalThis, Symbol.unscopables, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
+ ( FormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
+ scope, strict).
+ [...]
+
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+async function* ref(x) {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
+ }
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+}
+
+ref(10).next().then(() => {
+ assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+}).then($DONE, $DONE);
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/async-generator/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..866f682069
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ var yi\u0065ld;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/async-generator/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..8351c65c5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-as-binding-identifier.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ var yield;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/async-generator/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..951a7741b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ void yi\u0065ld;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/async-generator/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..db16bf85e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-as-identifier-reference.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ void yield;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/async-generator/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..a523fed8c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-as-label-identifier-escaped.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ yi\u0065ld: ;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/async-generator/yield-as-label-identifier.js
new file mode 100644
index 0000000000..78cbbb63ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-as-label-identifier.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier.case
+// - src/async-generators/syntax/async-declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+async function *gen() {
+ yield: ;
+}
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-identifier-non-strict.js b/js/src/tests/test262/language/statements/async-generator/yield-identifier-non-strict.js
new file mode 100644
index 0000000000..d1d4c66c8d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-identifier-non-strict.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-non-strict.case
+// - src/async-generators/non-strict/async-declaration.template
+/*---
+description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator function declaration - valid for non-strict only cases)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+---*/
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ return (function(arg) {
+ var yield = arg + 1;
+ return yield;
+ }(yield))
+}
+
+var iter = gen();
+
+var item = iter.next();
+
+item.then(({ done, value }) => {
+ assert.sameValue(done, false);
+ assert.sameValue(value, undefined);
+});
+
+item = iter.next(42);
+
+item.then(({ done, value }) => {
+ assert.sameValue(done, true);
+ assert.sameValue(value, 43);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-identifier-spread-non-strict.js b/js/src/tests/test262/language/statements/async-generator/yield-identifier-spread-non-strict.js
new file mode 100644
index 0000000000..ef3a5bcef0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-identifier-spread-non-strict.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-spread-non-strict.case
+// - src/async-generators/non-strict/async-declaration.template
+/*---
+description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator function declaration - valid for non-strict only cases)
+esid: prod-AsyncGeneratorDeclaration
+features: [object-spread, Symbol, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+var s = Symbol('s');
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield {
+ ...yield yield,
+ ...(function(arg) {
+ var yield = arg;
+ return {...yield};
+ }(yield)),
+ ...yield,
+ }
+}
+
+var iter = gen();
+
+var iter = gen();
+
+iter.next();
+iter.next();
+iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
+iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
+var item = iter.next({ z: 30, b: 2 });
+
+item.then(({ done, value }) => {
+ assert.sameValue(done, false);
+ assert.sameValue(value.x, 10);
+ assert.sameValue(value.y, 20);
+ assert.sameValue(value.z, 30);
+ assert.sameValue(value.a, 1);
+ assert.sameValue(value.b, 2);
+ assert.sameValue(value[s], 42);
+ assert.sameValue(Object.keys(value).length, 5);
+ assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property");
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/async-generator/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..fd6e9a2fd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-spread-strict.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [object-spread, async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+}
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/async-generator/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..76ce9ef46d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-identifier-strict-strict.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-strict.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+}
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-catch.js
new file mode 100644
index 0000000000..c215587a00
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-catch.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-catch.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}).catch(rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+});
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js
new file mode 100644
index 0000000000..19d00d022f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-async-iterator.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: yield * [Promise.reject(value)] is treated as throw value (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ for await (let line of readFile()) {
+ yield line;
+ }
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-for-await-of-sync-iterator.js
new file mode 100644
index 0000000000..fa67f67422
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-for-await-of-sync-iterator.js
@@ -0,0 +1,49 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-sync-iterator.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: yield Promise.reject(value) in for-await-of is treated as throw value (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ for await (let value of iterable) {
+ yield value;
+ }
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-yield-star-async-iterator.js
new file mode 100644
index 0000000000..5c9d76f588
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-yield-star-async-iterator.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-async-iterator.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: yield * (async iterator) is treated as throw value (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield * readFile();
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-yield-star-sync-iterator.js
new file mode 100644
index 0000000000..d1833caa7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next-yield-star-sync-iterator.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-sync-iterator.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: yield * (async iterator) is treated as throw value (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield * iterable;
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next.js b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next.js
new file mode 100644
index 0000000000..f4972beae6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-promise-reject-next.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-return-then-getter-ticks.js b/js/src/tests/test262/language/statements/async-generator/yield-return-then-getter-ticks.js
new file mode 100644
index 0000000000..2a3b580a91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-return-then-getter-ticks.js
@@ -0,0 +1,105 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-evaluation
+description: >
+ Return resumption value is awaited upon and hence is treated as a thenable.
+info: |
+ 14.4.14 Runtime Semantics: Evaluation
+ YieldExpression : yield AssignmentExpression
+
+ ...
+ 3. Let value be ? GetValue(exprRef).
+ 4. If generatorKind is async, then return ? AsyncGeneratorYield(value).
+ ...
+
+ 25.5.3.7 AsyncGeneratorYield ( value )
+ ...
+ 5. Set value to ? Await(value).
+ ...
+ 8. Set the code evaluation state of genContext such that when evaluation is resumed with a
+ Completion resumptionValue the following steps will be performed:
+ ...
+ b. Let awaited be Await(resumptionValue.[[Value]]).
+ ...
+ e. Return Completion { [[Type]]: return, [[Value]]: awaited.[[Value]], [[Target]]: empty }.
+ ...
+
+ 6.2.3.1 Await
+ ...
+ 2. Let promise be ? PromiseResolve(%Promise%, « value »).
+ ...
+
+ 25.6.4.5.1 PromiseResolve ( C, x )
+ ...
+ 3. Let promiseCapability be ? NewPromiseCapability(C).
+ 4. Perform ? Call(promiseCapability.[[Resolve]], undefined, « x »).
+ ...
+
+ 25.6.1.5 NewPromiseCapability ( C )
+ ...
+ 7. Let promise be ? Construct(C, « executor »).
+ ...
+
+ 25.6.3.1 Promise ( executor )
+ ...
+ 8. Let resolvingFunctions be CreateResolvingFunctions(promise).
+ ...
+
+ 25.6.1.3 CreateResolvingFunctions ( promise )
+ ...
+ 2. Let stepsResolve be the algorithm steps defined in Promise Resolve Functions (25.6.1.3.2).
+ 3. Let resolve be CreateBuiltinFunction(stepsResolve, « [[Promise]], [[AlreadyResolved]] »).
+ ...
+
+ 25.6.1.3.2 Promise Resolve Functions
+ ...
+ 9. Let then be Get(resolution, "then").
+ ...
+
+includes: [compareArray.js]
+flags: [async]
+features: [async-iteration]
+---*/
+
+var expected = [
+ "start",
+
+ // `Await(value)` promise resolved.
+ "tick 1",
+
+ // "then" of `resumptionValue.[[Value]]` accessed.
+ "get then",
+
+ // `Await(resumptionValue.[[Value]])` promise resolved.
+ "tick 2",
+];
+
+var actual = [];
+
+async function* f() {
+ actual.push("start");
+ yield 123;
+ actual.push("stop - never reached");
+}
+
+Promise.resolve(0)
+ .then(() => actual.push("tick 1"))
+ .then(() => actual.push("tick 2"))
+ .then(() => {
+ assert.compareArray(actual, expected, "Ticks for return with thenable getter");
+}).then($DONE, $DONE);
+
+var it = f();
+
+// Start generator execution.
+it.next();
+
+// Stop generator execution.
+it.return({
+ get then() {
+ actual.push("get then");
+ }
+});
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/async-generator/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..3f22543cca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-spread-arr-multiple.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-multiple.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Use yield value in a array spread position (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield [...yield yield];
+}
+
+var iter = gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+
+item.then(({ done, value }) => {
+ item = iter.next(value);
+
+ item.then(({ done, value }) => {
+ assert.compareArray(value, arr);
+ assert.sameValue(done, false);
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/async-generator/yield-spread-arr-single.js
new file mode 100644
index 0000000000..c68224b07b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-spread-arr-single.js
@@ -0,0 +1,49 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-single.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Use yield value in a array spread position (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield [...yield];
+}
+
+var iter = gen();
+
+iter.next(false);
+var item = iter.next(arr);
+
+item.then(({ done, value }) => {
+ assert.notSameValue(value, arr, 'value is a new array');
+ assert(Array.isArray(value), 'value is an Array exotic object');
+ assert.sameValue(value.length, 3)
+ assert.sameValue(value[0], 'a');
+ assert.sameValue(value[1], 'b');
+ assert.sameValue(value[2], 'c');
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-spread-obj.js b/js/src/tests/test262/language/statements/async-generator/yield-spread-obj.js
new file mode 100644
index 0000000000..e5611226af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-spread-obj.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-obj.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Use yield value in a object spread position (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [object-spread, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+}
+
+var iter = gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+item.then(({ done, value }) => {
+ assert.sameValue(value.x, 42);
+ assert.sameValue(value.y, 39);
+ assert.sameValue(Object.keys(value).length, 2);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-async-from-sync-iterator-inaccessible.js b/js/src/tests/test262/language/statements/async-generator/yield-star-async-from-sync-iterator-inaccessible.js
new file mode 100644
index 0000000000..f962045044
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-async-from-sync-iterator-inaccessible.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-createasyncfromsynciterator
+description: >
+ Async-from-Sync Iterator instances are not accessible from user code.
+info: |
+ 25.1.4.1 CreateAsyncFromSyncIterator ( syncIteratorRecord )
+ 1. Let asyncIterator be ! ObjectCreate(%AsyncFromSyncIteratorPrototype%, « [[SyncIteratorRecord]] »).
+ 2. Set asyncIterator.[[SyncIteratorRecord]] to syncIteratorRecord.
+ 3. Let nextMethod be ! Get(asyncIterator, "next").
+ 4. Let iteratorRecord be Record { [[Iterator]]: asyncIterator, [[NextMethod]]: nextMethod, [[Done]]: false }.
+ 5. Return iteratorRecord.
+
+ 14.4.14 Runtime Semantics: Evaluation
+ YieldExpression : yield * AssignmentExpression
+ 1. Let generatorKind be ! GetGeneratorKind().
+ ...
+ 4. Let iteratorRecord be ? GetIterator(value, generatorKind).
+ ...
+
+ 7.4.1 GetIterator ( obj [ , hint [ , method ] ] )
+ ...
+ 3. If method is not present, then
+ a. If hint is async, then
+ i. Set method to ? GetMethod(obj, @@asyncIterator).
+ ii. If method is undefined, then
+ 1. Let syncMethod be ? GetMethod(obj, @@iterator).
+ 2. Let syncIteratorRecord be ? GetIterator(obj, sync, syncMethod).
+ 3. Return ? CreateAsyncFromSyncIterator(syncIteratorRecord).
+ ...
+
+flags: [async]
+features: [async-iteration]
+---*/
+
+var AsyncIteratorPrototype = Object.getPrototypeOf(async function*(){}.constructor.prototype.prototype);
+
+Object.defineProperty(AsyncIteratorPrototype, Symbol.iterator, {
+ get() {
+ throw new Error("@@iterator accessed");
+ }
+});
+
+Object.defineProperty(AsyncIteratorPrototype, Symbol.asyncIterator, {
+ get() {
+ throw new Error("@@asyncIterator accessed");
+ }
+});
+
+async function* g() {
+ yield* [];
+}
+g().next().then(() => $DONE(), $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-async-next.js b/js/src/tests/test262/language/statements/async-generator/yield-star-async-next.js
new file mode 100644
index 0000000000..155a5d02cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-async-next.js
@@ -0,0 +1,219 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-next.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Execution order for yield* with async iterator and next() (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({ name: "get [Symbol.iterator]" });
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({
+ name: "get [Symbol.asyncIterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.asyncIterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-promise-1",
+ get then() {
+ log.push({
+ name: "get next then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "next-promise-2",
+ get then() {
+ log.push({
+ name: "get next then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+ assert.sameValue(log[1].thisValue, obj, "get [Symbol.asyncIterator] thisValue");
+
+ assert.sameValue(log[2].name, "call [Symbol.asyncIterator]");
+ assert.sameValue(log[2].thisValue, obj, "[Symbol.asyncIterator] thisValue");
+ assert.sameValue(log[2].args.length, 0, "[Symbol.asyncIterator] args.length");
+
+ assert.sameValue(log[3].name, "get next");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "get next thisValue");
+
+ assert.sameValue(log[4].name, "call next");
+ assert.sameValue(log[4].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[4].args.length, 1, "next args.length");
+ assert.sameValue(log[4].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[5].name, "get next then (1)");
+ assert.sameValue(log[5].thisValue.name, "next-promise-1", "get next then thisValue");
+
+ assert.sameValue(log[6].name, "call next then (1)");
+ assert.sameValue(log[6].thisValue.name, "next-promise-1", "next then thisValue");
+ assert.sameValue(log[6].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[6].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[6].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[7].name, "get next done (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[8].name, "get next value (1)");
+ assert.sameValue(log[8].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 9, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[9].name, "call next");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[9].args.length, 1, "next args.length");
+ assert.sameValue(log[9].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[10].name, "get next then (2)");
+ assert.sameValue(log[10].thisValue.name, "next-promise-2", "get next then thisValue");
+
+ assert.sameValue(log[11].name, "call next then (2)");
+ assert.sameValue(log[11].thisValue.name, "next-promise-2", "next then thisValue");
+ assert.sameValue(log[11].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[12].name, "get next done (2)");
+ assert.sameValue(log[12].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[13].name, "get next value (2)");
+ assert.sameValue(log[13].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-async-return.js b/js/src/tests/test262/language/statements/async-generator/yield-star-async-return.js
new file mode 100644
index 0000000000..9e2c42bae3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-async-return.js
@@ -0,0 +1,235 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-return.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: execution order for yield* with async iterator and return() (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator, « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. If generatorKind is async, then set value to ? Await(value).
+ 3. Return Completion{[[Type]]: return, [[Value]]: value, [[Target]]: empty}.
+ ix. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var returnCount = 0;
+ return {
+ name: 'asyncIterator',
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-promise-1",
+ get then() {
+ log.push({
+ name: "get return then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "return-promise-2",
+ get then() {
+ log.push({
+ name: "get return then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+}
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return then (1)");
+ assert.sameValue(log[4].thisValue.name, "return-promise-1", "get return then thisValue");
+
+ assert.sameValue(log[5].name, "call return then (1)");
+ assert.sameValue(log[5].thisValue.name, "return-promise-1", "return then thisValue");
+ assert.sameValue(log[5].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[6].name, "get return done (1)");
+ assert.sameValue(log[6].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[7].name, "get return value (1)");
+ assert.sameValue(log[7].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.return("return-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get return");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[9].name, "call return");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[9].args.length, 1, "return args.length");
+ assert.sameValue(log[9].args[0], "return-arg-2", "return args[0]");
+
+ assert.sameValue(log[10].name, "get return then (2)");
+ assert.sameValue(log[10].thisValue.name, "return-promise-2", "get return then thisValue");
+
+ assert.sameValue(log[11].name, "call return then (2)");
+ assert.sameValue(log[11].thisValue.name, "return-promise-2", "return then thisValue");
+ assert.sameValue(log[11].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[12].name, "get return done (2)");
+ assert.sameValue(log[12].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[13].name, "get return value (2)");
+ assert.sameValue(log[13].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 14, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-async-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-async-throw.js
new file mode 100644
index 0000000000..465156fa18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-async-throw.js
@@ -0,0 +1,243 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: execution order for yield* with async iterator and throw() (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Let resultValue be Return ? IteratorValue(innerResult).
+ b. If generatorKind is async, then set resultValue to ? Await(resultValue).
+ c. Return resultValue.
+ 7. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var throwCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-promise-1",
+ get then() {
+ log.push({
+ name: "get throw then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "throw-promise-2",
+ get then() {
+ log.push({
+ name: "get throw then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw then (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-promise-1", "get throw thisValue");
+
+ assert.sameValue(log[5].name, "call throw then (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-promise-1", "throw thisValue");
+ assert.sameValue(log[5].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[6].name, "get throw done (1)");
+ assert.sameValue(log[6].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[7].name, "get throw value (1)");
+ assert.sameValue(log[7].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.throw("throw-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get throw");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[9].name, "call throw");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[9].args.length, 1, "throw args.length");
+ assert.sameValue(log[9].args[0], "throw-arg-2", "throw args[0]");
+
+ assert.sameValue(log[10].name, "get throw then (2)");
+ assert.sameValue(log[10].thisValue.name, "throw-promise-2", "get throw thisValue");
+
+ assert.sameValue(log[11].name, "call throw then (2)");
+ assert.sameValue(log[11].thisValue.name, "throw-promise-2", "throw thisValue");
+ assert.sameValue(log[11].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[12].name, "get throw done (2)");
+ assert.sameValue(log[12].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[13].name, "get throw value (2)");
+ assert.sameValue(log[13].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-expr-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-expr-abrupt.js
new file mode 100644
index 0000000000..0c41b9ec6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-expr-abrupt.js
@@ -0,0 +1,54 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-expr-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while getting yield* operand (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ ...
+
+---*/
+var obj = {};
+var abrupt = function() {
+ throw obj;
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* abrupt();
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, obj, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-get-abrupt.js
new file mode 100644
index 0000000000..7796050a16
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-get-abrupt.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-get-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while getting [Symbol.asyncIterator] (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ get [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..5c5a180678
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-boolean-throw.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: false
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-number-throw.js
new file mode 100644
index 0000000000..7fd8825b29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-number-throw.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: 0
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-object-throw.js
new file mode 100644
index 0000000000..4d985ae446
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-object-throw.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: {}
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-string-throw.js
new file mode 100644
index 0000000000..19439f18f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-string-throw.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: ''
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..2d9cfc5c55
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-not-callable-symbol-throw.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: Symbol.asyncIterator
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-null-sync-get-abrupt.js
new file mode 100644
index 0000000000..7bc93f03e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-null-sync-get-abrupt.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while getting @@iterator after null @@asyncIterator (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-abrupt.js
new file mode 100644
index 0000000000..883bc0973f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-abrupt.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while calling [Symbol.asyncIterator] (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-boolean-throw.js
new file mode 100644
index 0000000000..cadf3d6496
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-boolean-throw.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - boolean (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-null-throw.js
new file mode 100644
index 0000000000..81284e6d0b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-null-throw.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - null (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-number-throw.js
new file mode 100644
index 0000000000..e6688ecb7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-number-throw.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - number (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return 42;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-string-throw.js
new file mode 100644
index 0000000000..92943314d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-string-throw.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - string (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return '42';
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-symbol-throw.js
new file mode 100644
index 0000000000..ae3539c5e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-symbol-throw.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - symbol (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return Symbol.asyncIterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-undefined-throw.js
new file mode 100644
index 0000000000..40aea77591
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-returns-undefined-throw.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - undefined (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-undefined-sync-get-abrupt.js
new file mode 100644
index 0000000000..ee81acbf34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-async-undefined-sync-get-abrupt.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-get-abrupt.js
new file mode 100644
index 0000000000..1bd3ca00ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-get-abrupt.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-get-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while getting [Symbol.iterator] (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..a87cfc0adf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-boolean-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: false
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-number-throw.js
new file mode 100644
index 0000000000..aa32053600
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-number-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: 0
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-object-throw.js
new file mode 100644
index 0000000000..0fa5e2d73c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-object-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: {}
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-string-throw.js
new file mode 100644
index 0000000000..86f31ce384
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-string-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: ''
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..4bec50b862
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-not-callable-symbol-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: Symbol.iterator
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-abrupt.js
new file mode 100644
index 0000000000..c2094a328f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-abrupt.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while calling [Symbol.iterator] (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-boolean-throw.js
new file mode 100644
index 0000000000..327afe9fde
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-boolean-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.iterator]() - boolean (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-null-throw.js
new file mode 100644
index 0000000000..4b0e3cf33c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-null-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.iterator]() - null (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-number-throw.js
new file mode 100644
index 0000000000..9cd51156c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-number-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.iterator]() - number (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return 0;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-string-throw.js
new file mode 100644
index 0000000000..1ce242fde1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-string-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.iterator]() - string (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return '';
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-symbol-throw.js
new file mode 100644
index 0000000000..6f87f06bc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-symbol-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.iterator]() - symbol (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return Symbol.iterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-undefined-throw.js
new file mode 100644
index 0000000000..71c01c4e0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-getiter-sync-returns-undefined-throw.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Non object returned by [Symbol.iterator]() - undefined (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-call-done-get-abrupt.js
new file mode 100644
index 0000000000..9bc62c10fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-call-done-get-abrupt.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-done-get-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while getting done (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get done() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-call-returns-abrupt.js
new file mode 100644
index 0000000000..8ca899a840
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-call-returns-abrupt.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-returns-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while calling next (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-call-value-get-abrupt.js
new file mode 100644
index 0000000000..033348b08d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-call-value-get-abrupt.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-value-get-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while getting value (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ done: true,
+ get value() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-get-abrupt.js
new file mode 100644
index 0000000000..e1d269458e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-get-abrupt.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-get-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Abrupt completion while getting next (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ get next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-non-object-ignores-then.js
new file mode 100644
index 0000000000..271fa593c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-non-object-ignores-then.js
@@ -0,0 +1,85 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-non-object-ignores-then.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: If next() value is not-object, do not access respective then property (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+
+---*/
+Number.prototype.then = function() {
+ throw new Test262Error('Number#then should not be used');
+};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return 42;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, 'TypeError');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..cd7b5607ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-boolean-throw.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Not-callable next value in a yield star position - boolean (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: true
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-null-throw.js
new file mode 100644
index 0000000000..88662200ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-null-throw.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-null-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Not-callable next value in a yield star position - null (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: null
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-number-throw.js
new file mode 100644
index 0000000000..ba69eeffc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-number-throw.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-number-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Not-callable next value in a yield star position - number (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: 42
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-object-throw.js
new file mode 100644
index 0000000000..7871989780
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-object-throw.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-object-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Not-callable next value in a yield star position - object (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: {}
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-string-throw.js
new file mode 100644
index 0000000000..14557c4e67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-string-throw.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-string-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Not-callable next value in a yield star position - string (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: ''
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..2584c8a5a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-symbol-throw.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Not-callable next value in a yield star position - symbol (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: Symbol('oi')
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-undefined-throw.js
new file mode 100644
index 0000000000..75fa4c5333
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-not-callable-undefined-throw.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Not-callable next value in a yield star position - undefined (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: undefined
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-get-abrupt.js
new file mode 100644
index 0000000000..f7cc2f3588
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-get-abrupt.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-get-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Return abrupt after getting next().then (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-boolean-fulfillpromise.js
new file mode 100644
index 0000000000..9a486d6b4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-boolean-fulfillpromise.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: FulfillPromise if next().then is not-callable (boolean) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: true,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-null-fulfillpromise.js
new file mode 100644
index 0000000000..767625c782
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-null-fulfillpromise.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: FulfillPromise if next().then is not-callable (null) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: null,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-number-fulfillpromise.js
new file mode 100644
index 0000000000..2864b5a9b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-number-fulfillpromise.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: FulfillPromise if next().then is not-callable (number) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: 39,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-object-fulfillpromise.js
new file mode 100644
index 0000000000..37271cc528
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-object-fulfillpromise.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: FulfillPromise if next().then is not-callable (object) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: {},
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-string-fulfillpromise.js
new file mode 100644
index 0000000000..7863bf280a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-string-fulfillpromise.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: FulfillPromise if next().then is not-callable (string) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: '',
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-symbol-fulfillpromise.js
new file mode 100644
index 0000000000..639fc0c175
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-symbol-fulfillpromise.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: FulfillPromise if next().then is not-callable (symbol) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: Symbol('oi'),
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-undefined-fulfillpromise.js
new file mode 100644
index 0000000000..4c3469f468
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-non-callable-undefined-fulfillpromise.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: FulfillPromise if next().then is not-callable (undefined) (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: undefined,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-returns-abrupt.js
new file mode 100644
index 0000000000..adc3d00793
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-next-then-returns-abrupt.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-returns-abrupt.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: Return abrupt after calling next().then (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-normal-notdone-iter-value-throws.js b/js/src/tests/test262/language/statements/async-generator/yield-star-normal-notdone-iter-value-throws.js
new file mode 100644
index 0000000000..4a4d8a4d30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-normal-notdone-iter-value-throws.js
@@ -0,0 +1,54 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-evaluation
+description: >
+ Abrupt completion when calling IteratorValue is propagated when received.[[Type]] is normal.
+info: |
+ 14.4.14 Runtime Semantics: Evaluation
+ YieldExpression : yield* AssignmentExpression
+
+ ...
+ 7. Repeat,
+ a. If received.[[Type]] is normal, then
+ ...
+ vi. If generatorKind is async, then set received to AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+flags: [async]
+features: [async-iteration]
+---*/
+
+var token = {};
+
+var asyncIter = {
+ [Symbol.asyncIterator]() {
+ return this;
+ },
+ next() {
+ return {
+ done: false,
+ get value() {
+ throw token;
+ }
+ };
+ }
+};
+
+async function* f() {
+ var thrown;
+ try {
+ yield* asyncIter;
+ } catch (e) {
+ thrown = e;
+ }
+ return thrown;
+}
+
+var iter = f();
+
+iter.next().then(({value}) => {
+ assert.sameValue(value, token);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-promise-not-unwrapped.js b/js/src/tests/test262/language/statements/async-generator/yield-star-promise-not-unwrapped.js
new file mode 100644
index 0000000000..4dabe6af43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-promise-not-unwrapped.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// Copyright (C) 2022 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-evaluation
+description: >
+ `yield*` in an async generator does not await promises returned by a manually implemented async iterator.
+flags: [async]
+features: [async-iteration]
+---*/
+
+var innerPromise = Promise.resolve("unwrapped value");
+
+var asyncIter = {
+ [Symbol.asyncIterator]() {
+ return this;
+ },
+ next() {
+ return {
+ done: false,
+ value: innerPromise,
+ };
+ },
+ get return() {
+ throw new Test262Error(".return should not be accessed");
+ },
+ get throw() {
+ throw new Test262Error(".throw should not be accessed");
+ },
+};
+
+async function* f() {
+ yield* asyncIter;
+}
+
+f()
+ .next()
+ .then(v => {
+ assert.sameValue(v.value, innerPromise, "yield* should not unwrap promises from manually-implemented async iterators");
+ })
+ .then($DONE, $DONE)
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-return-missing-value-is-awaited.js b/js/src/tests/test262/language/statements/async-generator/yield-star-return-missing-value-is-awaited.js
new file mode 100644
index 0000000000..d4d3f641be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-return-missing-value-is-awaited.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-evaluation
+description: >
+ If iterator's "return" method is missing,
+ received value is awaited before forwarded to the runtime.
+info: |
+ YieldExpression : yield * AssignmentExpression
+
+ [...]
+ 7. Repeat,
+ [...]
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, then
+ 1. If generatorKind is async, then set received.[[Value]] to ? Await(received.[[Value]]).
+ 2. Return Completion(received).
+features: [Symbol.asyncIterator, async-iteration]
+flags: [async]
+---*/
+
+var asyncIterable = {
+ [Symbol.asyncIterator]: function() {
+ return this;
+ },
+ next: function() {
+ return {value: 1, done: false};
+ },
+};
+
+async function* asyncGenerator() {
+ yield* asyncIterable;
+}
+
+var asyncIterator = asyncGenerator();
+asyncIterator.next().then(function() {
+ var promise = Promise.resolve(2).then(() => 3);
+ return asyncIterator.return(promise).then(function(result) {
+ assert.sameValue(result.value, 3);
+ assert.sameValue(result.done, true);
+ });
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-return-notdone-iter-value-throws.js b/js/src/tests/test262/language/statements/async-generator/yield-star-return-notdone-iter-value-throws.js
new file mode 100644
index 0000000000..f0fbdabdd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-return-notdone-iter-value-throws.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-evaluation
+description: >
+ Abrupt completion when calling IteratorValue is propagated when received.[[Type]] is return.
+info: |
+ 14.4.14 Runtime Semantics: Evaluation
+ YieldExpression : yield* AssignmentExpression
+
+ ...
+ 7. Repeat,
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ...
+ ix. If generatorKind is async, then set received to AsyncGeneratorYield(? IteratorValue(innerReturnResult)).
+ ...
+
+flags: [async]
+features: [async-iteration]
+---*/
+
+var token = {};
+
+var asyncIter = {
+ [Symbol.asyncIterator]() {
+ return this;
+ },
+ next() {
+ return {
+ done: false,
+ value: undefined,
+ };
+ },
+ return() {
+ return {
+ done: false,
+ get value() {
+ throw token;
+ }
+ };
+ }
+};
+
+async function* f() {
+ var thrown;
+ try {
+ yield* asyncIter;
+ } catch (e) {
+ thrown = e;
+ }
+ return thrown;
+}
+
+var iter = f();
+
+iter.next().then(() => {
+ iter.return().then(({value}) => {
+ assert.sameValue(value, token);
+ }).then($DONE, $DONE);
+}).catch($DONE);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-return-then-getter-ticks.js b/js/src/tests/test262/language/statements/async-generator/yield-star-return-then-getter-ticks.js
new file mode 100644
index 0000000000..efa97408a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-return-then-getter-ticks.js
@@ -0,0 +1,145 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-evaluation
+description: >
+ Return resumption value is awaited upon and hence is treated as a thenable.
+info: |
+ 15.5.5 Runtime Semantics: Evaluation
+ YieldExpression : yield* AssignmentExpression
+
+ ...
+ 7. Repeat,
+ a. If received.[[Type]] is normal, then
+ i. Let innerResult be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]],
+ « received.[[Value]] »).
+ ii. If generatorKind is async, then set innerResult to ? Await(innerResult).
+ ...
+ vi. If generatorKind is async, then set received to AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, then
+ 1. If generatorKind is async, then set received.[[Value]] to ? Await(received.[[Value]]).
+ 2. Return Completion(received).
+ ...
+
+ 27.6.3.8 AsyncGeneratorYield ( value )
+ ...
+ 12. If queue is not empty, then
+ ...
+ 13. Else,
+ ...
+ c. Set the code evaluation state of genContext such that when evaluation is resumed with a
+ Completion resumptionValue the following steps will be performed:
+ i. Return ? AsyncGeneratorUnwrapYieldResumption(resumptionValue).
+
+ 27.6.3.7 AsyncGeneratorUnwrapYieldResumption ( resumptionValue )
+ ...
+ 2. Let awaited be Completion(Await(resumptionValue.[[Value]])).
+ ...
+
+ 6.2.3.1 Await
+ ...
+ 2. Let promise be ? PromiseResolve(%Promise%, « value »).
+ ...
+
+ 27.2.4.7.1 PromiseResolve ( C, x )
+ ...
+ 2. Let promiseCapability be ? NewPromiseCapability(C).
+ 3. Perform ? Call(promiseCapability.[[Resolve]], undefined, « x »).
+ ...
+
+ 27.2.1.5 NewPromiseCapability ( C )
+ ...
+ 7. Let promise be ? Construct(C, « executor »).
+ ...
+
+ 27.2.3.1 Promise ( executor )
+ ...
+ 8. Let resolvingFunctions be CreateResolvingFunctions(promise).
+ ...
+
+ 27.2.1.3 CreateResolvingFunctions ( promise )
+ ...
+ 2. Let stepsResolve be the algorithm steps defined in Promise Resolve Functions (25.6.1.3.2).
+ 3. Let resolve be CreateBuiltinFunction(stepsResolve, « [[Promise]], [[AlreadyResolved]] »).
+ ...
+
+ 27.2.1.3.2 Promise Resolve Functions
+ ...
+ 9. Let then be Get(resolution, "then").
+ ...
+
+includes: [compareArray.js]
+flags: [async]
+features: [async-iteration]
+---*/
+
+var expected = [
+ "start",
+
+ // `Await(innerResult)` promise resolved.
+ "tick 1",
+
+ // "then" of `resumptionValue.[[Value]]` accessed.
+ "get then",
+
+ // `Await(resumptionValue.[[Value]])` promise resolved.
+ "tick 2",
+
+ // Get iterator "return" method.
+ "get return",
+
+ // "then" of `received.[[Value]]` accessed.
+ "get then",
+
+ // `Await(received.[[Value]])` promise resolved.
+ "tick 3",
+];
+
+var actual = [];
+
+var asyncIter = {
+ [Symbol.asyncIterator]() {
+ return this;
+ },
+ next() {
+ return {
+ done: false,
+ };
+ },
+ get return() {
+ actual.push("get return");
+ }
+};
+
+async function* f() {
+ actual.push("start");
+ yield* asyncIter;
+ actual.push("stop - never reached");
+}
+
+Promise.resolve(0)
+ .then(() => actual.push("tick 1"))
+ .then(() => actual.push("tick 2"))
+ .then(() => actual.push("tick 3"))
+ .then(() => {
+ assert.compareArray(actual, expected, "Ticks for return with thenable getter");
+}).then($DONE, $DONE);
+
+var it = f();
+
+// Start generator execution.
+it.next();
+
+// Stop generator execution.
+it.return({
+ get then() {
+ actual.push("get then");
+ }
+});
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-sync-next.js b/js/src/tests/test262/language/statements/async-generator/yield-star-sync-next.js
new file mode 100644
index 0000000000..a0f99421a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-sync-next.js
@@ -0,0 +1,222 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-next.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: execution order for yield* with sync iterator and next() (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ 5. Let received be NormalCompletion(undefined).
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]).
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ vii. Let received be GeneratorYield(innerResult).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.next ( value )
+
+ ...
+ 5. Let nextResult be IteratorNext(syncIterator, value).
+ ...
+ 7. Let nextValue be IteratorValue(nextResult).
+ ...
+ 9. Let nextDone be IteratorComplete(nextResult).
+ ...
+ 12. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « nextValue »).
+ ...
+ 14. Set onFulfilled.[[Done]] to nextDone.
+ 15. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+ Async Iterator Value Unwrap Functions
+
+ 1. Return ! CreateIterResultObject(value, F.[[Done]]).
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({
+ name: "get [Symbol.iterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.iterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ };
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({ name: "get [Symbol.asyncIterator]" });
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+
+ assert.sameValue(log[2].name, "get [Symbol.iterator]");
+ assert.sameValue(log[2].thisValue, obj, "get [Symbol.iterator] thisValue");
+
+ assert.sameValue(log[3].name, "call [Symbol.iterator]");
+ assert.sameValue(log[3].thisValue, obj, "[Symbol.iterator] thisValue");
+ assert.sameValue(log[3].args.length, 0, "[Symbol.iterator] args.length");
+
+ assert.sameValue(log[4].name, "get next");
+ assert.sameValue(log[4].thisValue.name, "syncIterator", "get next thisValue");
+
+ assert.sameValue(log[5].name, "call next");
+ assert.sameValue(log[5].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[5].args.length, 1, "next args.length");
+ assert.sameValue(log[5].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[6].name, "get next done (1)");
+ assert.sameValue(log[6].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[7].name, "get next value (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[8].name, "call next");
+ assert.sameValue(log[8].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[8].args.length, 1, "next args.length");
+ assert.sameValue(log[8].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[9].name, "get next done (2)");
+ assert.sameValue(log[9].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[10].name, "get next value (2)");
+ assert.sameValue(log[10].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[11].name, "after yield*");
+ assert.sameValue(log[11].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 12, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-sync-return.js b/js/src/tests/test262/language/statements/async-generator/yield-star-sync-return.js
new file mode 100644
index 0000000000..ff28d86c36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-sync-return.js
@@ -0,0 +1,197 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-return.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: execution order for yield* with sync iterator and return() (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator,
+ « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to
+ ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. Return Completion{[[Type]]: return, [[Value]]: value,
+ [[Target]]: empty}.
+ ix. Let received be GeneratorYield(innerResult).
+
+ %AsyncFromSyncIteratorPrototype%.return ( value )
+
+ 5. Let return be GetMethod(syncIterator, "return").
+ ...
+ ...
+ 8. Let returnResult be Call(return, syncIterator, « value »).
+ ...
+ 11. Let returnValue be IteratorValue(returnResult).
+ ..
+ 13. Let returnDone be IteratorComplete(returnResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, « returnValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to returnDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var returnCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+}
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return done (1)");
+ assert.sameValue(log[4].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[5].name, "get return value (1)");
+ assert.sameValue(log[5].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.return().then(v => {
+ assert.sameValue(log[6].name, "get return");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[7].name, "call return");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "get return thisValue");
+ assert.sameValue(log[7].args.length, 1, "return args.length");
+ assert.sameValue(log[7].args[0], undefined, "return args[0]");
+
+ assert.sameValue(log[8].name, "get return done (2)");
+ assert.sameValue(log[8].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[9].name, "get return value (2)");
+ assert.sameValue(log[9].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 10, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-sync-throw.js b/js/src/tests/test262/language/statements/async-generator/yield-star-sync-throw.js
new file mode 100644
index 0000000000..f656b36759
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-sync-throw.js
@@ -0,0 +1,203 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-throw.case
+// - src/async-generators/default/async-declaration.template
+/*---
+description: execution order for yield* with sync iterator and throw() (Async generator Function declaration)
+esid: prod-AsyncGeneratorDeclaration
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ Async Generator Function Definitions
+
+ AsyncGeneratorDeclaration:
+ async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
+ AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Return ? IteratorValue(innerResult).
+ 7. Let received be GeneratorYield(innerResult).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.throw ( value )
+
+ ...
+ 5. Let throw be GetMethod(syncIterator, "throw").
+ ...
+ 8. Let throwResult be Call(throw, syncIterator, « value »).
+ ...
+ 11. Let throwValue be IteratorValue(throwResult).
+ ...
+ 13. Let throwDone be IteratorComplete(throwResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « throwValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to throwDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var throwCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+async function *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw done (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[5].name, "get throw value (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.throw().then(v => {
+ assert.sameValue(log[6].name, "get throw");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[7].name, "call throw");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[7].args.length, 1, "throw args.length");
+ assert.sameValue(log[7].args[0], undefined, "throw args[0]");
+
+ assert.sameValue(log[8].name, "get throw done (2)");
+ assert.sameValue(log[8].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[9].name, "get throw value (2)");
+ assert.sameValue(log[9].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[10].name, "after yield*");
+ assert.sameValue(log[10].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 11, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/async-generator/yield-star-throw-notdone-iter-value-throws.js b/js/src/tests/test262/language/statements/async-generator/yield-star-throw-notdone-iter-value-throws.js
new file mode 100644
index 0000000000..fbb3376934
--- /dev/null
+++ b/js/src/tests/test262/language/statements/async-generator/yield-star-throw-notdone-iter-value-throws.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-evaluation
+description: >
+ Abrupt completion when calling IteratorValue is propagated when received.[[Type]] is throw.
+info: |
+ 14.4.14 Runtime Semantics: Evaluation
+ YieldExpression : yield* AssignmentExpression
+
+ ...
+ 7. Repeat,
+ ...
+ b. Else if received.[[Type]] is throw, then
+ ...
+ ii. If throw is not undefined, then
+ ...
+ 7. If generatorKind is async, then set received to AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+flags: [async]
+features: [async-iteration]
+---*/
+
+var token = {};
+
+var asyncIter = {
+ [Symbol.asyncIterator]() {
+ return this;
+ },
+ next() {
+ return {
+ done: false,
+ value: undefined,
+ };
+ },
+ throw() {
+ return {
+ done: false,
+ get value() {
+ throw token;
+ }
+ };
+ }
+};
+
+async function* f() {
+ var thrown;
+ try {
+ yield* asyncIter;
+ } catch (e) {
+ thrown = e;
+ }
+ return thrown;
+}
+
+var iter = f();
+
+iter.next().then(() => {
+ iter.throw().then(({value}) => {
+ assert.sameValue(value, token);
+ }).then($DONE, $DONE);
+}).catch($DONE);
diff --git a/js/src/tests/test262/language/statements/block/12.1-1.js b/js/src/tests/test262/language/statements/block/12.1-1.js
new file mode 100644
index 0000000000..41e088cd1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/12.1-1.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.1-1
+description: "12.1 - block '{ StatementListopt };' is not allowed: try-catch"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try{};catch(){}
diff --git a/js/src/tests/test262/language/statements/block/12.1-2.js b/js/src/tests/test262/language/statements/block/12.1-2.js
new file mode 100644
index 0000000000..de0ee99cb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/12.1-2.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.1-2
+description: >
+ 12.1 - block '{ StatementListopt };' is not allowed:
+ try-catch-finally
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try{};catch{};finally{}
diff --git a/js/src/tests/test262/language/statements/block/12.1-3.js b/js/src/tests/test262/language/statements/block/12.1-3.js
new file mode 100644
index 0000000000..95386a3023
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/12.1-3.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.1-3
+description: "12.1 - block '{ StatementListopt };' is not allowed: try-finally"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try{};finally{}
diff --git a/js/src/tests/test262/language/statements/block/12.1-4.js b/js/src/tests/test262/language/statements/block/12.1-4.js
new file mode 100644
index 0000000000..764b3e15a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/12.1-4.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.1-4
+description: "12.1 - block '{ StatementListopt };' is not allowed: if-else"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if{};else{}
diff --git a/js/src/tests/test262/language/statements/block/12.1-5.js b/js/src/tests/test262/language/statements/block/12.1-5.js
new file mode 100644
index 0000000000..1953b0dce2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/12.1-5.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.1-5
+description: "12.1 - block '{ StatementListopt };' is not allowed: if-else-if"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if{};else if{}
diff --git a/js/src/tests/test262/language/statements/block/12.1-6.js b/js/src/tests/test262/language/statements/block/12.1-6.js
new file mode 100644
index 0000000000..a8de62d4f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/12.1-6.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.1-6
+description: >
+ 12.1 - block '{ StatementListopt };' is not allowed:
+ if-else-if-else
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if{};else if{};else{}
diff --git a/js/src/tests/test262/language/statements/block/12.1-7.js b/js/src/tests/test262/language/statements/block/12.1-7.js
new file mode 100644
index 0000000000..513a24b3cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/12.1-7.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.1-7
+description: "12.1 - block '{ StatementListopt };' is not allowed: do-while"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do{};while()
diff --git a/js/src/tests/test262/language/statements/block/S12.1_A2.js b/js/src/tests/test262/language/statements/block/S12.1_A2.js
new file mode 100644
index 0000000000..39fb4edb96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/S12.1_A2.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production StatementList Statement is evaluated as follows
+ 1. Evaluate Statement.
+ 2. If an exception was thrown, return (throw, V, empty) where V is the exception
+es5id: 12.1_A2
+description: Throwing exception within a Block
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+assert.throws(ReferenceError, function() {
+ {
+ x();
+ }
+});
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try {
+ throw "catchme";
+ throw new Test262Error('#2: throw "catchme" lead to throwing exception');
+} catch (e) {
+ if (e!=="catchme") {
+ throw new Test262Error('#2.1: Exception === "catchme". Actual: Exception ==='+ e );
+ }
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/block/S12.1_A4_T1.js b/js/src/tests/test262/language/statements/block/S12.1_A4_T1.js
new file mode 100644
index 0000000000..8d1cd42e44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/S12.1_A4_T1.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The production Block can't be inside of expression
+es5id: 12.1_A4_T1
+description: Checking if execution of "y={__func}()" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function __func(){};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+y={__func;}();
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/block/S12.1_A4_T2.js b/js/src/tests/test262/language/statements/block/S12.1_A4_T2.js
new file mode 100644
index 0000000000..8783c5b76c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/S12.1_A4_T2.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The production Block can't be inside of expression
+es5id: 12.1_A4_T2
+description: Checking if execution of "y={x;}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+x=1;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+y={x;};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/block/S12.1_A5.js b/js/src/tests/test262/language/statements/block/S12.1_A5.js
new file mode 100644
index 0000000000..97a625bedc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/S12.1_A5.js
@@ -0,0 +1,58 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ StatementList: StatementList Statement inside the Block is evaluated from
+ left to right
+es5id: 12.1_A5
+description: Throwing exceptions within embedded/sequence Blocks
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ throw 1;
+ throw 2;
+ throw 3;
+ throw new Test262Error('1.1: throw 1 lead to throwing exception');
+} catch (e) {
+ if (e!==1) {
+ throw new Test262Error('#1.2: Exception === 1. Actual: Exception ==='+ e);
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try {
+ {
+ throw 1;
+ throw 2;
+ }
+ throw 3;
+ throw new Test262Error('#2.1: throw 1 lead to throwing exception');
+} catch (e) {
+ if (e!==1) {
+ throw new Test262Error('#2.2: Exception === 1. Actual: Exception ==='+ e);
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+try {
+ throw 1;
+ {
+ throw 2;
+ throw 3;
+ }
+ throw new Test262Error('#3.1: throw 1 lead to throwing exception');
+} catch (e) {
+ if (e!==1) {
+ throw new Test262Error('#3.2: Exception === 1. Actual: Exception ==='+ e);
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/block/browser.js b/js/src/tests/test262/language/statements/block/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/browser.js
diff --git a/js/src/tests/test262/language/statements/block/early-errors/browser.js b/js/src/tests/test262/language/statements/block/early-errors/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/early-errors/browser.js
diff --git a/js/src/tests/test262/language/statements/block/early-errors/invalid-names-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/block/early-errors/invalid-names-call-expression-bad-reference.js
new file mode 100644
index 0000000000..b58f2e02d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/early-errors/invalid-names-call-expression-bad-reference.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/block.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, block statement)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+{ (() => {})().#x }
diff --git a/js/src/tests/test262/language/statements/block/early-errors/invalid-names-call-expression-this.js b/js/src/tests/test262/language/statements/block/early-errors/invalid-names-call-expression-this.js
new file mode 100644
index 0000000000..be675df8cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/early-errors/invalid-names-call-expression-this.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/block.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, block statement)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+{ (() => this)().#x }
diff --git a/js/src/tests/test262/language/statements/block/early-errors/invalid-names-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/block/early-errors/invalid-names-member-expression-bad-reference.js
new file mode 100644
index 0000000000..78adc1a2ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/early-errors/invalid-names-member-expression-bad-reference.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/block.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, block statement)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+{ something.#x }
diff --git a/js/src/tests/test262/language/statements/block/early-errors/invalid-names-member-expression-this.js b/js/src/tests/test262/language/statements/block/early-errors/invalid-names-member-expression-this.js
new file mode 100644
index 0000000000..c587936244
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/early-errors/invalid-names-member-expression-this.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/block.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, block statement)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+{ this.#x }
diff --git a/js/src/tests/test262/language/statements/block/early-errors/shell.js b/js/src/tests/test262/language/statements/block/early-errors/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/early-errors/shell.js
diff --git a/js/src/tests/test262/language/statements/block/labeled-continue.js b/js/src/tests/test262/language/statements/block/labeled-continue.js
new file mode 100644
index 0000000000..dc08215409
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/labeled-continue.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-static-semantics-containsundefinedcontinuetarget
+description: Clears label set in check for undefined `continue` target
+info: |
+ With arguments iterationSet and labelSet.
+
+ Statement : BlockStatement
+
+ 1. Return ContainsUndefinedContinueTarget of |BlockStatement| with arguments
+ _iterationSet_ and « ».
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+label: {
+ for ( ;; ) {
+ continue label;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/block/scope-lex-close.js b/js/src/tests/test262/language/statements/block/scope-lex-close.js
new file mode 100644
index 0000000000..42818aa30a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/scope-lex-close.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-block-runtime-semantics-evaluation
+description: Removal of lexical environment for BlockStatement
+info: |
+ 1. Let oldEnv be the running execution context's LexicalEnvironment.
+ 2. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 3. Perform BlockDeclarationInstantiation(StatementList, blockEnv).
+ 4. Set the running execution context's LexicalEnvironment to blockEnv.
+ 5. Let blockValue be the result of evaluating StatementList.
+ 6. Set the running execution context's LexicalEnvironment to oldEnv.
+ 7. Return blockValue.
+features: [let]
+---*/
+
+var probe;
+
+{
+ let x = 'inside';
+ probe = function() { return x; };
+}
+
+let x = 'outside';
+
+assert.sameValue(x, 'outside');
+assert.sameValue(probe(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/block/scope-lex-open.js b/js/src/tests/test262/language/statements/block/scope-lex-open.js
new file mode 100644
index 0000000000..5d711ea573
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/scope-lex-open.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-block-runtime-semantics-evaluation
+description: Creation of new lexical environment for BlockStatement
+info: |
+ 1. Let oldEnv be the running execution context's LexicalEnvironment.
+ 2. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 3. Perform BlockDeclarationInstantiation(StatementList, blockEnv).
+ 4. Set the running execution context's LexicalEnvironment to blockEnv.
+ 5. Let blockValue be the result of evaluating StatementList.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeBefore = function() { return x; };
+var probeInside;
+
+{
+ let x = 'inside';
+ probeInside = function() { return x; };
+}
+
+assert.sameValue(probeBefore(), 'outside');
+assert.sameValue(probeInside(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/block/scope-var-none.js b/js/src/tests/test262/language/statements/block/scope-var-none.js
new file mode 100644
index 0000000000..9e94d7b58a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/scope-var-none.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-block-runtime-semantics-evaluation
+description: Retainment of existing variable environment for BlockStatement
+info: |
+ 1. Let oldEnv be the running execution context's LexicalEnvironment.
+ 2. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 3. Perform BlockDeclarationInstantiation(StatementList, blockEnv).
+ 4. Set the running execution context's LexicalEnvironment to blockEnv.
+ 5. Let blockValue be the result of evaluating StatementList.
+ 6. Set the running execution context's LexicalEnvironment to oldEnv.
+ 7. Return blockValue.
+---*/
+
+var x = 'outside';
+var probeBefore = function() { return x; };
+var probeInside;
+
+{
+ var x = 'inside';
+ probeInside = function() { return x; };
+}
+
+assert.sameValue(probeBefore(), 'inside', 'reference preceding statement');
+assert.sameValue(probeInside(), 'inside', 'reference within statement');
+assert.sameValue(x, 'inside', 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/block/shell.js b/js/src/tests/test262/language/statements/block/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/block/tco-stmt-list-strict.js b/js/src/tests/test262/language/statements/block/tco-stmt-list-strict.js
new file mode 100644
index 0000000000..f8bae6ce7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/tco-stmt-list-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ { void 0; return f(n - 1); }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/block/tco-stmt-strict.js b/js/src/tests/test262/language/statements/block/tco-stmt-strict.js
new file mode 100644
index 0000000000..308d5cff42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/block/tco-stmt-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ { return f(n - 1); }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/12.8-1.js b/js/src/tests/test262/language/statements/break/12.8-1.js
new file mode 100644
index 0000000000..0302583434
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/12.8-1.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.8-1
+description: >
+ The break Statement - a break statement without an identifier may
+ have a LineTerminator before the semi-colon
+---*/
+
+ var sum = 0;
+ for (var i = 1; i <= 10; i++) {
+ if (i === 6) {
+ break
+ ;
+ }
+ sum += i;
+ }
+
+assert.sameValue(sum, 15, 'sum');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A1_T1.js b/js/src/tests/test262/language/statements/break/S12.8_A1_T1.js
new file mode 100644
index 0000000000..0944e1c41c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A1_T1.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of break without an IterationStatement leads to syntax error
+es5id: 12.8_A1_T1
+description: Checking if break statement with no loop fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x=1;
+break;
+var y=2;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A1_T2.js b/js/src/tests/test262/language/statements/break/S12.8_A1_T2.js
new file mode 100644
index 0000000000..700980d937
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A1_T2.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of break without an IterationStatement leads to syntax error
+es5id: 12.8_A1_T2
+description: Checking if break Identifier with no loop fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+LABEL : x=3.14;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x=1;
+break LABEL;
+var y=2;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A1_T3.js b/js/src/tests/test262/language/statements/break/S12.8_A1_T3.js
new file mode 100644
index 0000000000..eba60f66d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A1_T3.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of break without an IterationStatement leads to syntax error
+es5id: 12.8_A1_T3
+description: >
+ Checking if break statement with no loop, placed into a block,
+ fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+{
+ var x=1;
+ break;
+ var y=2;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A1_T4.js b/js/src/tests/test262/language/statements/break/S12.8_A1_T4.js
new file mode 100644
index 0000000000..985686fb73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A1_T4.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of break without an IterationStatement leads to syntax error
+es5id: 12.8_A1_T4
+description: >
+ Checking if break Identifier with no loop, placed into a block,
+ fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+LABEL : x=3.14;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+{
+ var x=1;
+ break LABEL;
+ var y=2;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A3.js b/js/src/tests/test262/language/statements/break/S12.8_A3.js
new file mode 100644
index 0000000000..c2bc51fc33
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A3.js
@@ -0,0 +1,34 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: When "break" is evaluated, (break, empty, empty) is returned
+es5id: 12.8_A3
+description: Using "break" without Identifier within labeled loop
+---*/
+
+LABEL_OUT : var x=0, y=0;
+
+LABEL_DO_LOOP : do {
+ LABEL_IN : x=2;
+ break ;
+ LABEL_IN_2 : var y=2;
+
+ function IN_DO_FUNC(){}
+} while(0);
+
+LABEL_ANOTHER_LOOP : do {
+ ;
+} while(0);
+
+function OUT_FUNC(){}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ((x!==2)&&(y!==0)) {
+ throw new Test262Error('#1: x === 2 and y === 0. Actual: x ==='+x+' and y ==='+y);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A4_T1.js b/js/src/tests/test262/language/statements/break/S12.8_A4_T1.js
new file mode 100644
index 0000000000..80c6752a70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A4_T1.js
@@ -0,0 +1,37 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "break Identifier" is evaluated, (break, empty, Identifier) is
+ returned
+es5id: 12.8_A4_T1
+description: Using "break Identifier" within labaeled loop
+---*/
+
+LABEL_OUT : var x=0, y=0;
+(function(){
+LABEL_DO_LOOP : do {
+ LABEL_IN : x++;
+ if(x===10)return;
+ break LABEL_DO_LOOP;
+ LABEL_IN_2 : y++;
+
+ function IN_DO_FUNC(){}
+} while(0);
+
+LABEL_ANOTHER_LOOP : do {
+ ;
+} while(0);
+
+function OUT_FUNC(){}
+})();
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ((x!==1)&&(y!==0)) {
+ throw new Test262Error('#1: x === 1 and y === 0. Actual: x === '+x+' and y ==='+ y );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A4_T2.js b/js/src/tests/test262/language/statements/break/S12.8_A4_T2.js
new file mode 100644
index 0000000000..799cd22e53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A4_T2.js
@@ -0,0 +1,43 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "break Identifier" is evaluated, (break, empty, Identifier) is
+ returned
+es5id: 12.8_A4_T2
+description: Using embedded and labeled loops, breaking to nested loop
+---*/
+
+LABEL_OUT : var x=0, y=0, xx=0, yy=0;
+(function(){
+LABEL_DO_LOOP : do {
+ LABEL_IN : x++;
+ if(x===10)return;
+ LABEL_NESTED_LOOP : do {
+ LABEL_IN_NESTED : xx++;
+ if(xx===10)return;
+ break LABEL_NESTED_LOOP;
+ LABEL_IN_NESTED_2 : yy++;
+ } while (0);
+
+ LABEL_IN_2 : y++;
+
+ function IN_DO_FUNC(){}
+} while(0);
+
+LABEL_ANOTHER_LOOP : do {
+ ;
+} while(0);
+
+function OUT_FUNC(){}
+})();
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ((x!==1)&&(y!==1)&&(xx!==1)&(yy!==0)) {
+ throw new Test262Error('#1: x === 1 and y === 1 and xx === 1 and yy === 0. Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A4_T3.js b/js/src/tests/test262/language/statements/break/S12.8_A4_T3.js
new file mode 100644
index 0000000000..9f92491fe2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A4_T3.js
@@ -0,0 +1,43 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "break Identifier" is evaluated, (break, empty, Identifier) is
+ returned
+es5id: 12.8_A4_T3
+description: Using embedded and labeled loops, breaking to outer loop
+---*/
+
+LABEL_OUT : var x=0, y=0, xx=0, yy=0;
+(function(){
+LABEL_DO_LOOP : do {
+ LABEL_IN : x++;
+ if(x===10)return;
+ LABEL_NESTED_LOOP : do {
+ LABEL_IN_NESTED : xx++;
+ if(xx===10)return;
+ break LABEL_DO_LOOP;
+ LABEL_IN_NESTED_2 : yy++;
+ } while (0);
+
+ LABEL_IN_2 : y++;
+
+ function IN_DO_FUNC(){}
+} while(0);
+
+LABEL_ANOTHER_LOOP : do {
+ ;
+} while(0);
+
+function OUT_FUNC(){}
+})();
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ((x!==1)&&(y!==0)&&(xx!==1)&(yy!==0)) {
+ throw new Test262Error('#1: x === 1 and y === 0 and xx === 1 and yy === 0. Actual: x==='+x+' and y==='+y+' and xx==='+xx+' and yy==='+yy );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A5_T1.js b/js/src/tests/test262/language/statements/break/S12.8_A5_T1.js
new file mode 100644
index 0000000000..35d7877706
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A5_T1.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Identifier must be label in the label set of an enclosing (but not
+ crossing function boundaries) IterationStatement
+es5id: 12.8_A5_T1
+description: Checking if breaking another labeled loop fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+(function(){
+ LABEL_OUT : var x=0, y=0;
+ LABEL_DO_LOOP : do {
+ LABEL_IN : x++;
+ if(x===10)
+ return;
+ break LABEL_ANOTHER_LOOP;
+ LABEL_IN_2 : y++;
+ function IN_DO_FUNC(){}
+ } while(0);
+
+ LABEL_ANOTHER_LOOP : do {
+ ;
+ } while(0);
+
+ function OUT_FUNC(){}
+})();
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A5_T2.js b/js/src/tests/test262/language/statements/break/S12.8_A5_T2.js
new file mode 100644
index 0000000000..17e645b4ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A5_T2.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Identifier must be label in the label set of an enclosing (but not
+ crossing function boundaries) IterationStatement
+es5id: 12.8_A5_T2
+description: >
+ Checking if using function name as an Identifier appears to be
+ invalid
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+(function(){
+ LABEL_OUT : var x=0, y=0;
+ LABEL_DO_LOOP : do {
+ LABEL_IN : x++;
+ if(x===10)
+ return;
+ break IN_DO_FUNC;
+ LABEL_IN_2 : y++;
+ function IN_DO_FUNC(){}
+ } while(0);
+
+ LABEL_ANOTHER_LOOP : do {
+ ;
+ } while(0);
+
+ function OUT_FUNC(){}
+})();
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A5_T3.js b/js/src/tests/test262/language/statements/break/S12.8_A5_T3.js
new file mode 100644
index 0000000000..13f0e3d64a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A5_T3.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Identifier must be label in the label set of an enclosing (but not
+ crossing function boundaries) IterationStatement
+es5id: 12.8_A5_T3
+description: >
+ Checking if using internal loop label as an Identifier appears to
+ be invalid
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+(function(){
+ LABEL_OUT : var x=0, y=0;
+ LABEL_DO_LOOP : do {
+ LABEL_IN : x++;
+ if(x===10)
+ return;
+ break LABEL_IN;
+ LABEL_IN_2 : y++;
+
+ function IN_DO_FUNC(){}
+
+ } while(0);
+
+ LABEL_ANOTHER_LOOP : do {
+ ;
+ } while(0);
+
+ function OUT_FUNC(){}
+
+})();
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A6.js b/js/src/tests/test262/language/statements/break/S12.8_A6.js
new file mode 100644
index 0000000000..aad6dc14a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A6.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Appearing of "break" within a function call that is nested in a
+ IterationStatement yields SyntaxError
+es5id: 12.8_A6
+description: >
+ Checking if using "break Identifier" within a function body
+ appears to be invalid
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var x=0,y=0;
+
+LABEL1 : do {
+ x++;
+ (function(){break LABEL1;})();
+ y++;
+} while(0);
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A7.js b/js/src/tests/test262/language/statements/break/S12.8_A7.js
new file mode 100644
index 0000000000..6cc93e7ae5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A7.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Appearing of "break" within eval statement that is nested in an
+ IterationStatement yields SyntaxError
+es5id: 12.8_A7
+description: Using eval "eval("break LABEL1")"
+---*/
+
+var x=0,y=0;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ LABEL1 : do {
+ x++;
+ eval("break LABEL1");
+ y++;
+ } while(0);
+ throw new Test262Error('#1: eval("break LABEL1") does not lead to throwing exception');
+} catch(e){
+ if(!(e instanceof SyntaxError)){
+ throw new Test262Error("1.1: Appearing of break within eval statement inside of IterationStatement yields SyntaxError");
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A8_T1.js b/js/src/tests/test262/language/statements/break/S12.8_A8_T1.js
new file mode 100644
index 0000000000..e43cde8525
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A8_T1.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "break" within "try/catch" Block yields SyntaxError
+es5id: 12.8_A8_T1
+description: >
+ Checking if using "break Identifier" from within catch Block
+ appears to be invalid
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try{
+} catch(e){
+ break LABEL2;
+ LABEL2 : do {
+ } while(0);
+}
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A8_T2.js b/js/src/tests/test262/language/statements/break/S12.8_A8_T2.js
new file mode 100644
index 0000000000..a45c3f122e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A8_T2.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "break" within "try/catch" Block yields SyntaxError
+es5id: 12.8_A8_T2
+description: >
+ Checking if using "break Identifier" from within catch Block
+ appears to be invalid
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try{
+} catch(e){
+ break;
+ LABEL2 : do {
+ } while(0);
+}
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A9_T1.js b/js/src/tests/test262/language/statements/break/S12.8_A9_T1.js
new file mode 100644
index 0000000000..d4de2e4845
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A9_T1.js
@@ -0,0 +1,34 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "break" within "try/catch" statement that is nested in a loop is
+ allowed
+es5id: 12.8_A9_T1
+description: Using "continue Identifier" within "catch" statement
+---*/
+
+var x=0,y=0;
+
+(function(){
+FOR : for(;;){
+ try{
+ x++;
+ if(x===10)return;
+ throw 1;
+ } catch(e){
+ break FOR;
+ }
+}
+})();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x!==1) {
+ throw new Test262Error('#1: break inside of try-catch nested in loop is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/S12.8_A9_T2.js b/js/src/tests/test262/language/statements/break/S12.8_A9_T2.js
new file mode 100644
index 0000000000..3fab376942
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/S12.8_A9_T2.js
@@ -0,0 +1,34 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "break" within "try/catch" statement that is nested in a loop is
+ allowed
+es5id: 12.8_A9_T2
+description: Using "continue Identifier" within "catch" statement
+---*/
+
+var x=0,y=0;
+
+(function(){
+FOR : for(;;){
+ try{
+ x++;
+ if(x===10)return;
+ throw 1;
+ } catch(e){
+ break ;
+ }
+}
+})();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x!==1) {
+ throw new Test262Error('#1: break inside of try-catch nested in loop is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/browser.js b/js/src/tests/test262/language/statements/break/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/browser.js
diff --git a/js/src/tests/test262/language/statements/break/line-terminators.js b/js/src/tests/test262/language/statements/break/line-terminators.js
new file mode 100644
index 0000000000..8384b5e389
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/line-terminators.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Since LineTerminator between "break" and Identifier is not allowed,
+ "break" is evaluated without label
+es5id: 12.8_A2
+description: >
+ Checking by using eval, inserting LineTerminator between break and
+ Identifier
+---*/
+
+FOR1 : for(var i=1;i<2;i++){
+ LABEL1 : do {
+ break
+FOR1;
+ } while(0);
+}
+
+assert.sameValue(i, 2, '#1: Since LineTerminator(U-000A) between break and Identifier not allowed break evaluates without label');
+
+FOR2 : for(var i=1;i<2;i++){
+ LABEL2 : do {
+ break FOR2;
+ } while(0);
+}
+
+assert.sameValue(i, 2, '#2: Since LineTerminator(U-000D) between break and Identifier not allowed break evaluates without label');
+
+FOR3 : for(var i=1;i<2;i++){
+ LABEL3 : do {
+ break
FOR3;
+ } while(0);
+}
+
+assert.sameValue(i, 2, '#3: Since LineTerminator(U-2028) between break and Identifier not allowed break evaluates without label');
+
+FOR4 : for(var i=1;i<2;i++){
+ LABEL4 : do {
+ break
FOR4;
+ } while(0);
+}
+
+assert.sameValue(i, 2, '#4: Since LineTerminator(U-2029) between break and Identifier not allowed break evaluates without label');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/break/shell.js b/js/src/tests/test262/language/statements/break/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/shell.js
diff --git a/js/src/tests/test262/language/statements/break/static-init-without-label.js b/js/src/tests/test262/language/statements/break/static-init-without-label.js
new file mode 100644
index 0000000000..1ac535755c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/break/static-init-without-label.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-break-statement
+description: IterationStatement search does not traverse static initialization block boundaries (no label specified)
+info: |
+ 4.2.1 Static Semantics: Early Errors
+ BreakStatement : break ;
+
+ - It is a Syntax Error if this BreakStatement is not nested, directly or
+ indirectly (but not crossing function or static initialization block
+ boundaries), within an IterationStatement or a SwitchStatement.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+label: while(false) {
+ class C {
+ static {
+ break;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/browser.js b/js/src/tests/test262/language/statements/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/browser.js
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst-computed-yield-expr.js b/js/src/tests/test262/language/statements/class/accessor-name-inst-computed-yield-expr.js
new file mode 100644
index 0000000000..1ffff48bfd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst-computed-yield-expr.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-object-initializer-runtime-semantics-evaluation
+es6id: 12.2.6.8
+description: >
+ The `yield` keyword behaves as a YieldExpression within a generator function
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+features: [generators]
+---*/
+
+var yieldSet, C, iter;
+function* g() {
+ class C_ {
+ get [yield]() { return 'get yield'; }
+ set [yield](param) { yieldSet = param; }
+ }
+
+ C = C_;
+}
+
+iter = g();
+
+iter.next();
+iter.next('first');
+iter.next('second');
+
+assert.sameValue(C.prototype.first, 'get yield');
+
+C.prototype.second = 'set yield';
+
+assert.sameValue(yieldSet, 'set yield');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/browser.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/browser.js
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-evaluation.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-evaluation.js
new file mode 100644
index 0000000000..6b2789e7b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-evaluation.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/computed-err-evaluation.case
+// - src/accessor-names/error/cls-decl-inst.template
+/*---
+description: Abrupt completion when evaluating expression (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+---*/
+var thrower = function() {
+ throw new Test262Error();
+};
+
+
+assert.throws(Test262Error, function() {
+ class C {
+ get [thrower()]() {}
+ }
+}, '`get` accessor');
+
+assert.throws(Test262Error, function() {
+ class C {
+ set [thrower()](_) {}
+ }
+}, '`set` accessor');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-to-prop-key.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-to-prop-key.js
new file mode 100644
index 0000000000..bad284dd3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-to-prop-key.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/computed-err-to-prop-key.case
+// - src/accessor-names/error/cls-decl-inst.template
+/*---
+description: Abrupt completion when coercing to property key value (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+ 7.1.14 ToPropertyKey
+
+ 1. Let key be ? ToPrimitive(argument, hint String).
+
+ 7.1.1 ToPrimitive
+
+ [...]
+ 7. Return ? OrdinaryToPrimitive(input, hint).
+
+ 7.1.1.1 OrdinaryToPrimitive
+
+ 5. For each name in methodNames in List order, do
+ [...]
+ 6. Throw a TypeError exception.
+---*/
+var badKey = Object.create(null);
+
+
+assert.throws(TypeError, function() {
+ class C {
+ get [badKey]() {}
+ }
+}, '`get` accessor');
+
+assert.throws(TypeError, function() {
+ class C {
+ set [badKey](_) {}
+ }
+}, '`set` accessor');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-unresolvable.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-unresolvable.js
new file mode 100644
index 0000000000..55e183a385
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed-err-unresolvable.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/computed-err-unresolvable.case
+// - src/accessor-names/error/cls-decl-inst.template
+/*---
+description: Abrupt completion when resolving reference value (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+---*/
+
+assert.throws(ReferenceError, function() {
+ class C {
+ get [test262unresolvable]() {}
+ }
+}, '`get` accessor');
+
+assert.throws(ReferenceError, function() {
+ class C {
+ set [test262unresolvable](_) {}
+ }
+}, '`set` accessor');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/computed.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed.js
new file mode 100644
index 0000000000..b11ca09cff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/computed.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/computed.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (AssignmentExpression) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+var _;
+
+
+var stringSet;
+
+class C {
+ get [_ = 'str' + 'ing']() { return 'get string'; }
+ set [_ = 'str' + 'ing'](param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['string'], 'get string');
+
+C.prototype['string'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-binary.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-binary.js
new file mode 100644
index 0000000000..1dd543dfbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-binary.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-binary.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (numeric literal in binary notation) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 0b10() { return 'get string'; }
+ set 0b10(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['2'], 'get string');
+
+C.prototype['2'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-exponent.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-exponent.js
new file mode 100644
index 0000000000..f6bbea1eb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-exponent.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-exponent.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (numeric literal in exponent notation) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 1E+9() { return 'get string'; }
+ set 1E+9(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['1000000000'], 'get string');
+
+C.prototype['1000000000'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-hex.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-hex.js
new file mode 100644
index 0000000000..7ab75e0fad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-hex.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-hex.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 0x10() { return 'get string'; }
+ set 0x10(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['16'], 'get string');
+
+C.prototype['16'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-leading-decimal.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-leading-decimal.js
new file mode 100644
index 0000000000..c70cf03231
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-leading-decimal.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-leading-decimal.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (numeric literal with leading decimal point) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get .1() { return 'get string'; }
+ set .1(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['0.1'], 'get string');
+
+C.prototype['0.1'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-non-canonical.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-non-canonical.js
new file mode 100644
index 0000000000..69513c97d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-non-canonical.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-non-canonical.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (numeric literal with non-canonical representation) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 0.0000001() { return 'get string'; }
+ set 0.0000001(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['1e-7'], 'get string');
+
+C.prototype['1e-7'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-octal.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-octal.js
new file mode 100644
index 0000000000..08eff48f90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-octal.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-octal.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (numeric literal in octal notation) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 0o10() { return 'get string'; }
+ set 0o10(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['8'], 'get string');
+
+C.prototype['8'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-zero.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-zero.js
new file mode 100644
index 0000000000..d062be1fcf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-numeric-zero.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-zero.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (numeric literal zero) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 0() { return 'get string'; }
+ set 0(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['0'], 'get string');
+
+C.prototype['0'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-char-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-char-escape.js
new file mode 100644
index 0000000000..88960560e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-char-escape.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-char-escape.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal containing a character escape sequence) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 'character\tescape'() { return 'get string'; }
+ set 'character\tescape'(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['character escape'], 'get string');
+
+C.prototype['character escape'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped-ext.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped-ext.js
new file mode 100644
index 0000000000..68f36541d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped-ext.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-default-escaped-ext.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal 'default' w/ extended escape) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 'def\u{61}ult'() { return 'get string'; }
+ set 'def\u{61}ult'(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['default'], 'get string');
+
+C.prototype['default'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped.js
new file mode 100644
index 0000000000..e133e30efd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default-escaped.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-default-escaped.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal 'default' escaped) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 'def\u0061ult'() { return 'get string'; }
+ set 'def\u0061ult'(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['default'], 'get string');
+
+C.prototype['default'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default.js
new file mode 100644
index 0000000000..152e02fb3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-default.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-default.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal 'default') (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 'default'() { return 'get string'; }
+ set 'default'(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['default'], 'get string');
+
+C.prototype['default'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-double-quote.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-double-quote.js
new file mode 100644
index 0000000000..6b1b5d8361
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-double-quote.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-double-quote.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal using double quotes) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get "doubleQuote"() { return 'get string'; }
+ set "doubleQuote"(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype["doubleQuote"], 'get string');
+
+C.prototype["doubleQuote"] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-empty.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-empty.js
new file mode 100644
index 0000000000..fa579f4173
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-empty.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-empty.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal, the empty string) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get ''() { return 'get string'; }
+ set ''(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype[''], 'get string');
+
+C.prototype[''] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-hex-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-hex-escape.js
new file mode 100644
index 0000000000..37fa2404b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-hex-escape.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-hex-escape.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 'hex\x45scape'() { return 'get string'; }
+ set 'hex\x45scape'(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['hexEscape'], 'get string');
+
+C.prototype['hexEscape'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-line-continuation.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-line-continuation.js
new file mode 100644
index 0000000000..6208971eb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-line-continuation.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-line-continuation.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal containing LineContinuation) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 'line\
+Continuation'() { return 'get string'; }
+ set 'line\
+Continuation'(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['lineContinuation'], 'get string');
+
+C.prototype['lineContinuation'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-single-quote.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-single-quote.js
new file mode 100644
index 0000000000..f6ef6c5fc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-single-quote.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-single-quote.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal using single quotes) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 'singleQuote'() { return 'get string'; }
+ set 'singleQuote'(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['singleQuote'], 'get string');
+
+C.prototype['singleQuote'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-unicode-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-unicode-escape.js
new file mode 100644
index 0000000000..d14a6d3d0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/literal-string-unicode-escape.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-unicode-escape.case
+// - src/accessor-names/default/cls-decl-inst.template
+/*---
+description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Class declaration, instance method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments proto and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ get 'unicod\u{000065}Escape'() { return 'get string'; }
+ set 'unicod\u{000065}Escape'(param) { stringSet = param; }
+}
+
+assert.sameValue(C.prototype['unicodeEscape'], 'get string');
+
+C.prototype['unicodeEscape'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-inst/shell.js b/js/src/tests/test262/language/statements/class/accessor-name-inst/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-inst/shell.js
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static-computed-yield-expr.js b/js/src/tests/test262/language/statements/class/accessor-name-static-computed-yield-expr.js
new file mode 100644
index 0000000000..1f42823f34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static-computed-yield-expr.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-object-initializer-runtime-semantics-evaluation
+es6id: 12.2.6.8
+description: >
+ The `yield` keyword behaves as a YieldExpression within a generator function
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+features: [generators]
+---*/
+
+var yieldSet, C, iter;
+function* g() {
+ class C_ {
+ static get [yield]() { return 'get yield'; }
+ static set [yield](param) { yieldSet = param; }
+ }
+
+ C = C_;
+}
+
+iter = g();
+
+iter.next();
+iter.next('first');
+iter.next('second');
+
+assert.sameValue(C.first, 'get yield');
+
+C.second = 'set yield';
+
+assert.sameValue(yieldSet, 'set yield');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/browser.js b/js/src/tests/test262/language/statements/class/accessor-name-static/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/browser.js
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-evaluation.js b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-evaluation.js
new file mode 100644
index 0000000000..8541304f43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-evaluation.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/computed-err-evaluation.case
+// - src/accessor-names/error/cls-decl-static.template
+/*---
+description: Abrupt completion when evaluating expression (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+---*/
+var thrower = function() {
+ throw new Test262Error();
+};
+
+
+assert.throws(Test262Error, function() {
+ class C {
+ static get [thrower()]() {}
+ }
+}, '`get` accessor');
+
+assert.throws(Test262Error, function() {
+ class C {
+ static set [thrower()](_) {}
+ }
+}, '`set` accessor');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-to-prop-key.js b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-to-prop-key.js
new file mode 100644
index 0000000000..57e250e59c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-to-prop-key.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/computed-err-to-prop-key.case
+// - src/accessor-names/error/cls-decl-static.template
+/*---
+description: Abrupt completion when coercing to property key value (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+ 7.1.14 ToPropertyKey
+
+ 1. Let key be ? ToPrimitive(argument, hint String).
+
+ 7.1.1 ToPrimitive
+
+ [...]
+ 7. Return ? OrdinaryToPrimitive(input, hint).
+
+ 7.1.1.1 OrdinaryToPrimitive
+
+ 5. For each name in methodNames in List order, do
+ [...]
+ 6. Throw a TypeError exception.
+---*/
+var badKey = Object.create(null);
+
+
+assert.throws(TypeError, function() {
+ class C {
+ static get [badKey]() {}
+ }
+}, '`get` accessor');
+
+assert.throws(TypeError, function() {
+ class C {
+ static set [badKey](_) {}
+ }
+}, '`set` accessor');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-unresolvable.js b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-unresolvable.js
new file mode 100644
index 0000000000..c049096333
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/computed-err-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/computed-err-unresolvable.case
+// - src/accessor-names/error/cls-decl-static.template
+/*---
+description: Abrupt completion when resolving reference value (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+---*/
+
+assert.throws(ReferenceError, function() {
+ class C {
+ static get [test262unresolvable]() {}
+ }
+}, '`get` accessor');
+
+assert.throws(ReferenceError, function() {
+ class C {
+ static set [test262unresolvable](_) {}
+ }
+}, '`set` accessor');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/computed.js b/js/src/tests/test262/language/statements/class/accessor-name-static/computed.js
new file mode 100644
index 0000000000..e8284e4c2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/computed.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/computed.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (AssignmentExpression) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+var _;
+
+
+var stringSet;
+
+class C {
+ static get [_ = 'str' + 'ing']() { return 'get string'; }
+ static set [_ = 'str' + 'ing'](param) { stringSet = param; }
+}
+
+assert.sameValue(C['string'], 'get string');
+
+C['string'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-binary.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-binary.js
new file mode 100644
index 0000000000..eba3b2b1bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-binary.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-binary.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (numeric literal in binary notation) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 0b10() { return 'get string'; }
+ static set 0b10(param) { stringSet = param; }
+}
+
+assert.sameValue(C['2'], 'get string');
+
+C['2'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-exponent.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-exponent.js
new file mode 100644
index 0000000000..309c418790
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-exponent.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-exponent.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (numeric literal in exponent notation) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 1E+9() { return 'get string'; }
+ static set 1E+9(param) { stringSet = param; }
+}
+
+assert.sameValue(C['1000000000'], 'get string');
+
+C['1000000000'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-hex.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-hex.js
new file mode 100644
index 0000000000..aaeaa22988
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-hex.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-hex.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 0x10() { return 'get string'; }
+ static set 0x10(param) { stringSet = param; }
+}
+
+assert.sameValue(C['16'], 'get string');
+
+C['16'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-leading-decimal.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-leading-decimal.js
new file mode 100644
index 0000000000..21cdddc9a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-leading-decimal.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-leading-decimal.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (numeric literal with leading decimal point) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get .1() { return 'get string'; }
+ static set .1(param) { stringSet = param; }
+}
+
+assert.sameValue(C['0.1'], 'get string');
+
+C['0.1'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-non-canonical.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-non-canonical.js
new file mode 100644
index 0000000000..86d8f2fd6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-non-canonical.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-non-canonical.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (numeric literal with non-canonical representation) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 0.0000001() { return 'get string'; }
+ static set 0.0000001(param) { stringSet = param; }
+}
+
+assert.sameValue(C['1e-7'], 'get string');
+
+C['1e-7'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-octal.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-octal.js
new file mode 100644
index 0000000000..fa8b4e0505
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-octal.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-octal.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (numeric literal in octal notation) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 0o10() { return 'get string'; }
+ static set 0o10(param) { stringSet = param; }
+}
+
+assert.sameValue(C['8'], 'get string');
+
+C['8'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-zero.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-zero.js
new file mode 100644
index 0000000000..18dfed2a88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-numeric-zero.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-numeric-zero.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (numeric literal zero) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 0() { return 'get string'; }
+ static set 0(param) { stringSet = param; }
+}
+
+assert.sameValue(C['0'], 'get string');
+
+C['0'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-char-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-char-escape.js
new file mode 100644
index 0000000000..30687691d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-char-escape.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-char-escape.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal containing a character escape sequence) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 'character\tescape'() { return 'get string'; }
+ static set 'character\tescape'(param) { stringSet = param; }
+}
+
+assert.sameValue(C['character escape'], 'get string');
+
+C['character escape'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped-ext.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped-ext.js
new file mode 100644
index 0000000000..3c04d8426d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped-ext.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-default-escaped-ext.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal 'default' w/ extended escape) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 'def\u{61}ult'() { return 'get string'; }
+ static set 'def\u{61}ult'(param) { stringSet = param; }
+}
+
+assert.sameValue(C['default'], 'get string');
+
+C['default'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped.js
new file mode 100644
index 0000000000..64d6bdf455
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default-escaped.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-default-escaped.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal 'default' escaped) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 'def\u0061ult'() { return 'get string'; }
+ static set 'def\u0061ult'(param) { stringSet = param; }
+}
+
+assert.sameValue(C['default'], 'get string');
+
+C['default'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default.js
new file mode 100644
index 0000000000..88f60739e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-default.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-default.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal 'default') (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 'default'() { return 'get string'; }
+ static set 'default'(param) { stringSet = param; }
+}
+
+assert.sameValue(C['default'], 'get string');
+
+C['default'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-double-quote.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-double-quote.js
new file mode 100644
index 0000000000..b7ec6e0e8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-double-quote.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-double-quote.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal using double quotes) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get "doubleQuote"() { return 'get string'; }
+ static set "doubleQuote"(param) { stringSet = param; }
+}
+
+assert.sameValue(C["doubleQuote"], 'get string');
+
+C["doubleQuote"] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-empty.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-empty.js
new file mode 100644
index 0000000000..ed7767d1df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-empty.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-empty.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal, the empty string) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get ''() { return 'get string'; }
+ static set ''(param) { stringSet = param; }
+}
+
+assert.sameValue(C[''], 'get string');
+
+C[''] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-hex-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-hex-escape.js
new file mode 100644
index 0000000000..215a665e56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-hex-escape.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-hex-escape.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 'hex\x45scape'() { return 'get string'; }
+ static set 'hex\x45scape'(param) { stringSet = param; }
+}
+
+assert.sameValue(C['hexEscape'], 'get string');
+
+C['hexEscape'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-line-continuation.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-line-continuation.js
new file mode 100644
index 0000000000..367e8f4c3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-line-continuation.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-line-continuation.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal containing LineContinuation) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 'line\
+Continuation'() { return 'get string'; }
+ static set 'line\
+Continuation'(param) { stringSet = param; }
+}
+
+assert.sameValue(C['lineContinuation'], 'get string');
+
+C['lineContinuation'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-single-quote.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-single-quote.js
new file mode 100644
index 0000000000..f0c2272add
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-single-quote.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-single-quote.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal using single quotes) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 'singleQuote'() { return 'get string'; }
+ static set 'singleQuote'(param) { stringSet = param; }
+}
+
+assert.sameValue(C['singleQuote'], 'get string');
+
+C['singleQuote'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-unicode-escape.js b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-unicode-escape.js
new file mode 100644
index 0000000000..a428e5ba96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/literal-string-unicode-escape.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/literal-string-unicode-escape.case
+// - src/accessor-names/default/cls-decl-static.template
+/*---
+description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Class declaration, static method)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class]
+flags: [generated]
+info: |
+ [...]
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ [...]
+ b. Else,
+ a. Let status be the result of performing PropertyDefinitionEvaluation
+ for m with arguments F and false.
+
+
+ 12.2.6.7 Runtime Semantics: Evaluation
+
+ [...]
+
+ ComputedPropertyName : [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+---*/
+
+var stringSet;
+
+class C {
+ static get 'unicod\u{000065}Escape'() { return 'get string'; }
+ static set 'unicod\u{000065}Escape'(param) { stringSet = param; }
+}
+
+assert.sameValue(C['unicodeEscape'], 'get string');
+
+C['unicodeEscape'] = 'set string';
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/accessor-name-static/shell.js b/js/src/tests/test262/language/statements/class/accessor-name-static/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/accessor-name-static/shell.js
diff --git a/js/src/tests/test262/language/statements/class/arguments/access.js b/js/src/tests/test262/language/statements/class/arguments/access.js
new file mode 100644
index 0000000000..24cd6a15b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/arguments/access.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class arguments access
+---*/
+var constructCounts = {
+ base: 0,
+ subclass: 0,
+ subclass2: 0
+};
+
+class Base {
+ constructor() {
+ constructCounts.base++;
+ assert.sameValue(arguments.length, 2, "The value of `arguments.length` is `2`");
+ assert.sameValue(arguments[0], 1, "The value of `arguments[0]` is `1`");
+ assert.sameValue(arguments[1], 2, "The value of `arguments[1]` is `2`");
+ }
+}
+
+var b = new Base(1, 2);
+
+class Subclass extends Base {
+ constructor() {
+ constructCounts.subclass++;
+ assert.sameValue(arguments.length, 2, "The value of `arguments.length` is `2`");
+ assert.sameValue(arguments[0], 3, "The value of `arguments[0]` is `3`");
+ assert.sameValue(arguments[1], 4, "The value of `arguments[1]` is `4`");
+ super(1, 2);
+ }
+}
+
+var s = new Subclass(3, 4);
+assert.sameValue(Subclass.length, 0, "The value of `Subclass.length` is `0`, because there are 0 formal parameters");
+
+class Subclass2 extends Base {
+ constructor(x, y) {
+ constructCounts.subclass2++;
+ assert.sameValue(arguments.length, 2, "The value of `arguments.length` is `2`");
+ assert.sameValue(arguments[0], 3, "The value of `arguments[0]` is `3`");
+ assert.sameValue(arguments[1], 4, "The value of `arguments[1]` is `4`");
+ super(1, 2);
+ }
+}
+
+var s2 = new Subclass2(3, 4);
+assert.sameValue(Subclass2.length, 2, "The value of `Subclass2.length` is `2`, because there are 2 formal parameters");
+
+
+assert.sameValue(constructCounts.base, 3, "The value of `constructCounts.base` is `3`");
+assert.sameValue(constructCounts.subclass, 1, "The value of `constructCounts.subclass` is `1`");
+assert.sameValue(constructCounts.subclass2, 1, "The value of `constructCounts.subclass2` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/arguments/browser.js b/js/src/tests/test262/language/statements/class/arguments/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/arguments/browser.js
diff --git a/js/src/tests/test262/language/statements/class/arguments/default-constructor.js b/js/src/tests/test262/language/statements/class/arguments/default-constructor.js
new file mode 100644
index 0000000000..f30ec66b5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/arguments/default-constructor.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class default constructor arguments
+---*/
+var args, that;
+class Base {
+ constructor() {
+ that = this;
+ args = arguments;
+ }
+}
+class Derived extends Base {}
+
+new Derived;
+assert.sameValue(args.length, 0, "The value of `args.length` is `0`");
+
+new Derived(0, 1, 2);
+assert.sameValue(args.length, 3, "The value of `args.length` is `3`");
+assert.sameValue(
+ that instanceof Derived,
+ true,
+ "The result of `that instanceof Derived` is `true`"
+);
+
+var arr = new Array(100);
+var obj = {};
+assert.throws(TypeError, function() {Derived.apply(obj, arr);});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/arguments/shell.js b/js/src/tests/test262/language/statements/class/arguments/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/arguments/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-meth-escaped-async.js b/js/src/tests/test262/language/statements/class/async-gen-meth-escaped-async.js
new file mode 100644
index 0000000000..247290d7a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-meth-escaped-async.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-grammar-notation
+description: >
+ The `async` contextual keyword must not contain Unicode escape sequences.
+info: |
+ Terminal symbols are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ \u0061sync* m(){}
+};
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..949ef653e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/array-destructuring-param-strict-body.js
@@ -0,0 +1,138 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth-static.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async *method([element]) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..c1aa9803dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ var \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-binding-identifier.js
new file mode 100644
index 0000000000..d7f1e1cfba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ var await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..808d003b1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ void \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-identifier-reference.js
new file mode 100644
index 0000000000..0a231fb8ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ void await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..3cc2db647d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ \u0061wait: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-label-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-label-identifier.js
new file mode 100644
index 0000000000..c511ce78db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/await-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ await: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-abrupt.js
new file mode 100644
index 0000000000..81e14dc50e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-abrupt.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..49010f9797
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,92 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Use of initializer when argument value is not `undefined` (static class declaration async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+
+var callCount = 0;
+class C {
+ static async *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(false, '', NaN, 0, null, obj).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..608b9cb883
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-arg-val-undefined.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Use of initializer when argument value is `undefined` (static class declaration async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(undefined, void 0).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-duplicates.js
new file mode 100644
index 0000000000..9b7901cd65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-duplicates.js
@@ -0,0 +1,67 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth-static.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async *method(x = 0, x) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-later.js
new file mode 100644
index 0000000000..30fc7fa7c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-later.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+class C {
+ static async *method(x = y, y) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..daf60509b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-prior.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (static class declaration async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+class C {
+ static async *method(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(3).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-self.js
new file mode 100644
index 0000000000..9f2bc4dfdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-ref-self.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Referencing a parameter from within its own initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+class C {
+ static async *method(x = x) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-rest.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-rest.js
new file mode 100644
index 0000000000..5e6b021d1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-rest.js
@@ -0,0 +1,71 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth-static.template
+/*---
+description: RestParameter does not support an initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async *method(...x = []) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..16ae5a99e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/dflt-params-trailing-comma.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/cls-decl-async-gen-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (static class declaration async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(42, undefined, 1).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/cls-decl-async-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/cls-decl-async-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..ccf94751ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/cls-decl-async-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.template
+/*---
+description: Forbidden extension, f.arguments (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method() {
+ assert.sameValue(this.method.hasOwnProperty("arguments"), false);
+ callCount++;
+ }
+}
+
+C.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/cls-decl-async-gen-meth-static-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/cls-decl-async-gen-meth-static-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..8e4893e5cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/cls-decl-async-gen-meth-static-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method() {
+ assert.sameValue(this.method.hasOwnProperty("caller"), false);
+ callCount++;
+ }
+}
+
+C.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..4071306341
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+class C {
+ static async *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..7c47646f0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+class C {
+ static async *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..c845f26f16
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/cls-decl-async-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+class C {
+ static async *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..0669b18670
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/object-destructuring-param-strict-body.js
@@ -0,0 +1,138 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth-static.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async *method({property}) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..5ac5a17650
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/params-trailing-comma-multiple.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/cls-decl-async-gen-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (static class declaration async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(42, 39, 1).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 2, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/params-trailing-comma-single.js
new file mode 100644
index 0000000000..ce92295b3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/params-trailing-comma-single.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/cls-decl-async-gen-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (static class declaration async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(42, 39).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/rest-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/rest-param-strict-body.js
new file mode 100644
index 0000000000..6f77dcec53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/rest-param-strict-body.js
@@ -0,0 +1,138 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth-static.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async *method(a,...rest) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..cbc14b1619
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,64 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth-static.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async *method(...a,) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..04f56c8bd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ var yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..f3b028e636
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ var yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..61bb80ffeb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ void yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..3e6df8cc98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ void yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..ed8c94e6ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ yi\u0065ld: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-label-identifier.js
new file mode 100644
index 0000000000..58f5930948
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *gen() {
+ yield: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..de3f96587b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,55 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-spread-strict.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [object-spread, async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..7ef3a6f717
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-identifier-strict-strict.js
@@ -0,0 +1,46 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-strict.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-catch.js
new file mode 100644
index 0000000000..2c9fde7744
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-catch.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-catch.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}).catch(rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+});
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js
new file mode 100644
index 0000000000..347dfc59cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-async-iterator.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: yield * [Promise.reject(value)] is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ for await (let line of readFile()) {
+ yield line;
+ }
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js
new file mode 100644
index 0000000000..09cbb76b40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-sync-iterator.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: yield Promise.reject(value) in for-await-of is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ for await (let value of iterable) {
+ yield value;
+ }
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-yield-star-async-iterator.js
new file mode 100644
index 0000000000..bd83eced36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-yield-star-async-iterator.js
@@ -0,0 +1,55 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-async-iterator.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield * readFile();
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-yield-star-sync-iterator.js
new file mode 100644
index 0000000000..e081278277
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next-yield-star-sync-iterator.js
@@ -0,0 +1,54 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-sync-iterator.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield * iterable;
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next.js
new file mode 100644
index 0000000000..e3cd184f98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-promise-reject-next.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..a45a13e0bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-arr-multiple.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-multiple.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Use yield value in a array spread position (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield [...yield yield];
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+
+item.then(({ done, value }) => {
+ item = iter.next(value);
+
+ item.then(({ done, value }) => {
+ assert.compareArray(value, arr);
+ assert.sameValue(done, false);
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-arr-single.js
new file mode 100644
index 0000000000..21f3704f58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-arr-single.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-single.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Use yield value in a array spread position (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield [...yield];
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next(false);
+var item = iter.next(arr);
+
+item.then(({ done, value }) => {
+ assert.notSameValue(value, arr, 'value is a new array');
+ assert(Array.isArray(value), 'value is an Array exotic object');
+ assert.sameValue(value.length, 3)
+ assert.sameValue(value[0], 'a');
+ assert.sameValue(value[1], 'b');
+ assert.sameValue(value[2], 'c');
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-obj.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-obj.js
new file mode 100644
index 0000000000..dc5be5b91e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-spread-obj.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-obj.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Use yield value in a object spread position (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [object-spread, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+item.then(({ done, value }) => {
+ assert.sameValue(value.x, 42);
+ assert.sameValue(value.y, 39);
+ assert.sameValue(Object.keys(value).length, 2);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-next.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-next.js
new file mode 100644
index 0000000000..05ee32010d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-next.js
@@ -0,0 +1,226 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-next.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Execution order for yield* with async iterator and next() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({ name: "get [Symbol.iterator]" });
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({
+ name: "get [Symbol.asyncIterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.asyncIterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-promise-1",
+ get then() {
+ log.push({
+ name: "get next then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "next-promise-2",
+ get then() {
+ log.push({
+ name: "get next then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+ assert.sameValue(log[1].thisValue, obj, "get [Symbol.asyncIterator] thisValue");
+
+ assert.sameValue(log[2].name, "call [Symbol.asyncIterator]");
+ assert.sameValue(log[2].thisValue, obj, "[Symbol.asyncIterator] thisValue");
+ assert.sameValue(log[2].args.length, 0, "[Symbol.asyncIterator] args.length");
+
+ assert.sameValue(log[3].name, "get next");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "get next thisValue");
+
+ assert.sameValue(log[4].name, "call next");
+ assert.sameValue(log[4].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[4].args.length, 1, "next args.length");
+ assert.sameValue(log[4].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[5].name, "get next then (1)");
+ assert.sameValue(log[5].thisValue.name, "next-promise-1", "get next then thisValue");
+
+ assert.sameValue(log[6].name, "call next then (1)");
+ assert.sameValue(log[6].thisValue.name, "next-promise-1", "next then thisValue");
+ assert.sameValue(log[6].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[6].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[6].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[7].name, "get next done (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[8].name, "get next value (1)");
+ assert.sameValue(log[8].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 9, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[9].name, "call next");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[9].args.length, 1, "next args.length");
+ assert.sameValue(log[9].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[10].name, "get next then (2)");
+ assert.sameValue(log[10].thisValue.name, "next-promise-2", "get next then thisValue");
+
+ assert.sameValue(log[11].name, "call next then (2)");
+ assert.sameValue(log[11].thisValue.name, "next-promise-2", "next then thisValue");
+ assert.sameValue(log[11].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[12].name, "get next done (2)");
+ assert.sameValue(log[12].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[13].name, "get next value (2)");
+ assert.sameValue(log[13].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-return.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-return.js
new file mode 100644
index 0000000000..4b3cc6a36d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-return.js
@@ -0,0 +1,242 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-return.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: execution order for yield* with async iterator and return() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator, « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. If generatorKind is async, then set value to ? Await(value).
+ 3. Return Completion{[[Type]]: return, [[Value]]: value, [[Target]]: empty}.
+ ix. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var returnCount = 0;
+ return {
+ name: 'asyncIterator',
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-promise-1",
+ get then() {
+ log.push({
+ name: "get return then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "return-promise-2",
+ get then() {
+ log.push({
+ name: "get return then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return then (1)");
+ assert.sameValue(log[4].thisValue.name, "return-promise-1", "get return then thisValue");
+
+ assert.sameValue(log[5].name, "call return then (1)");
+ assert.sameValue(log[5].thisValue.name, "return-promise-1", "return then thisValue");
+ assert.sameValue(log[5].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[6].name, "get return done (1)");
+ assert.sameValue(log[6].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[7].name, "get return value (1)");
+ assert.sameValue(log[7].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.return("return-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get return");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[9].name, "call return");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[9].args.length, 1, "return args.length");
+ assert.sameValue(log[9].args[0], "return-arg-2", "return args[0]");
+
+ assert.sameValue(log[10].name, "get return then (2)");
+ assert.sameValue(log[10].thisValue.name, "return-promise-2", "get return then thisValue");
+
+ assert.sameValue(log[11].name, "call return then (2)");
+ assert.sameValue(log[11].thisValue.name, "return-promise-2", "return then thisValue");
+ assert.sameValue(log[11].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[12].name, "get return done (2)");
+ assert.sameValue(log[12].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[13].name, "get return value (2)");
+ assert.sameValue(log[13].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 14, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-throw.js
new file mode 100644
index 0000000000..15c8c04084
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-async-throw.js
@@ -0,0 +1,250 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: execution order for yield* with async iterator and throw() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Let resultValue be Return ? IteratorValue(innerResult).
+ b. If generatorKind is async, then set resultValue to ? Await(resultValue).
+ c. Return resultValue.
+ 7. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var throwCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-promise-1",
+ get then() {
+ log.push({
+ name: "get throw then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "throw-promise-2",
+ get then() {
+ log.push({
+ name: "get throw then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw then (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-promise-1", "get throw thisValue");
+
+ assert.sameValue(log[5].name, "call throw then (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-promise-1", "throw thisValue");
+ assert.sameValue(log[5].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[6].name, "get throw done (1)");
+ assert.sameValue(log[6].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[7].name, "get throw value (1)");
+ assert.sameValue(log[7].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.throw("throw-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get throw");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[9].name, "call throw");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[9].args.length, 1, "throw args.length");
+ assert.sameValue(log[9].args[0], "throw-arg-2", "throw args[0]");
+
+ assert.sameValue(log[10].name, "get throw then (2)");
+ assert.sameValue(log[10].thisValue.name, "throw-promise-2", "get throw thisValue");
+
+ assert.sameValue(log[11].name, "call throw then (2)");
+ assert.sameValue(log[11].thisValue.name, "throw-promise-2", "throw thisValue");
+ assert.sameValue(log[11].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[12].name, "get throw done (2)");
+ assert.sameValue(log[12].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[13].name, "get throw value (2)");
+ assert.sameValue(log[13].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-expr-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-expr-abrupt.js
new file mode 100644
index 0000000000..6389d5345b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-expr-abrupt.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-expr-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while getting yield* operand (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ ...
+
+---*/
+var obj = {};
+var abrupt = function() {
+ throw obj;
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* abrupt();
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, obj, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-get-abrupt.js
new file mode 100644
index 0000000000..48307a3ce3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-get-abrupt.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while getting [Symbol.asyncIterator] (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ get [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..3403913eaa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-boolean-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-number-throw.js
new file mode 100644
index 0000000000..979a5d2798
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-number-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-object-throw.js
new file mode 100644
index 0000000000..37be5fcdf5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-object-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-string-throw.js
new file mode 100644
index 0000000000..c536648457
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-string-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..6acc648eb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-not-callable-symbol-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: Symbol.asyncIterator
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-null-sync-get-abrupt.js
new file mode 100644
index 0000000000..37e1fe413e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-null-sync-get-abrupt.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while getting @@iterator after null @@asyncIterator (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-abrupt.js
new file mode 100644
index 0000000000..17bd7eeed7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-abrupt.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while calling [Symbol.asyncIterator] (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-boolean-throw.js
new file mode 100644
index 0000000000..6d73237afe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-boolean-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - boolean (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-null-throw.js
new file mode 100644
index 0000000000..eab29d7628
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-null-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - null (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-number-throw.js
new file mode 100644
index 0000000000..2affab6fed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-number-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - number (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return 42;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-string-throw.js
new file mode 100644
index 0000000000..6fb7db7086
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-string-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - string (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return '42';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-symbol-throw.js
new file mode 100644
index 0000000000..e2d4c6438d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-symbol-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - symbol (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return Symbol.asyncIterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-undefined-throw.js
new file mode 100644
index 0000000000..0271cdef4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-returns-undefined-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - undefined (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js
new file mode 100644
index 0000000000..82f09b446e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-get-abrupt.js
new file mode 100644
index 0000000000..33d910c1a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-get-abrupt.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while getting [Symbol.iterator] (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..256bfc66e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-number-throw.js
new file mode 100644
index 0000000000..ab6f71205f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-number-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-object-throw.js
new file mode 100644
index 0000000000..ff0f0108f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-object-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-string-throw.js
new file mode 100644
index 0000000000..eabfeae9d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-string-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..387dd91524
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: Symbol.iterator
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-abrupt.js
new file mode 100644
index 0000000000..8ebcd59b6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-abrupt.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while calling [Symbol.iterator] (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-boolean-throw.js
new file mode 100644
index 0000000000..fc863e3bfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-boolean-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - boolean (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-null-throw.js
new file mode 100644
index 0000000000..b5d48b88ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-null-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - null (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-number-throw.js
new file mode 100644
index 0000000000..cdc15f4b09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-number-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - number (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return 0;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-string-throw.js
new file mode 100644
index 0000000000..9370a13561
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-string-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - string (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return '';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-symbol-throw.js
new file mode 100644
index 0000000000..e04e09b272
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-symbol-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - symbol (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return Symbol.iterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-undefined-throw.js
new file mode 100644
index 0000000000..afdf0ef493
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-getiter-sync-returns-undefined-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - undefined (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-done-get-abrupt.js
new file mode 100644
index 0000000000..c601d51199
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-done-get-abrupt.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-done-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while getting done (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get done() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-returns-abrupt.js
new file mode 100644
index 0000000000..1a6db5d8a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-returns-abrupt.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while calling next (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-value-get-abrupt.js
new file mode 100644
index 0000000000..0b5990c744
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-call-value-get-abrupt.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-value-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while getting value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ done: true,
+ get value() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-get-abrupt.js
new file mode 100644
index 0000000000..d27e07f33b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-get-abrupt.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Abrupt completion while getting next (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ get next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-non-object-ignores-then.js
new file mode 100644
index 0000000000..53a7eff8e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-non-object-ignores-then.js
@@ -0,0 +1,92 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-non-object-ignores-then.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: If next() value is not-object, do not access respective then property (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+
+---*/
+Number.prototype.then = function() {
+ throw new Test262Error('Number#then should not be used');
+};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return 42;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, 'TypeError');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..d6bcf220ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-boolean-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Not-callable next value in a yield star position - boolean (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: true
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-null-throw.js
new file mode 100644
index 0000000000..b2c8f1e8a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-null-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-null-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Not-callable next value in a yield star position - null (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: null
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-number-throw.js
new file mode 100644
index 0000000000..dbbf208489
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-number-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Not-callable next value in a yield star position - number (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: 42
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-object-throw.js
new file mode 100644
index 0000000000..298c964de5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-object-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Not-callable next value in a yield star position - object (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: {}
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-string-throw.js
new file mode 100644
index 0000000000..9ebbf19402
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-string-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Not-callable next value in a yield star position - string (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: ''
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..b61aeb91d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-symbol-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Not-callable next value in a yield star position - symbol (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: Symbol('oi')
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-undefined-throw.js
new file mode 100644
index 0000000000..74031fa546
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-not-callable-undefined-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Not-callable next value in a yield star position - undefined (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: undefined
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-get-abrupt.js
new file mode 100644
index 0000000000..573faffd03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-get-abrupt.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Return abrupt after getting next().then (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js
new file mode 100644
index 0000000000..05c76f2658
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (boolean) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: true,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js
new file mode 100644
index 0000000000..c789fadca3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (null) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: null,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js
new file mode 100644
index 0000000000..ef1ebee1d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (number) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: 39,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js
new file mode 100644
index 0000000000..f56613fafe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (object) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: {},
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js
new file mode 100644
index 0000000000..5d9ee1aaa1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (string) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: '',
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js
new file mode 100644
index 0000000000..baf92f8f13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (symbol) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: Symbol('oi'),
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js
new file mode 100644
index 0000000000..db0df04520
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (undefined) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: undefined,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-returns-abrupt.js
new file mode 100644
index 0000000000..92987f9a33
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-next-then-returns-abrupt.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: Return abrupt after calling next().then (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-next.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-next.js
new file mode 100644
index 0000000000..b6bb6ad955
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-next.js
@@ -0,0 +1,229 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-next.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: execution order for yield* with sync iterator and next() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ 5. Let received be NormalCompletion(undefined).
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]).
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ vii. Let received be GeneratorYield(innerResult).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.next ( value )
+
+ ...
+ 5. Let nextResult be IteratorNext(syncIterator, value).
+ ...
+ 7. Let nextValue be IteratorValue(nextResult).
+ ...
+ 9. Let nextDone be IteratorComplete(nextResult).
+ ...
+ 12. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « nextValue »).
+ ...
+ 14. Set onFulfilled.[[Done]] to nextDone.
+ 15. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+ Async Iterator Value Unwrap Functions
+
+ 1. Return ! CreateIterResultObject(value, F.[[Done]]).
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({
+ name: "get [Symbol.iterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.iterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ };
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({ name: "get [Symbol.asyncIterator]" });
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+
+ assert.sameValue(log[2].name, "get [Symbol.iterator]");
+ assert.sameValue(log[2].thisValue, obj, "get [Symbol.iterator] thisValue");
+
+ assert.sameValue(log[3].name, "call [Symbol.iterator]");
+ assert.sameValue(log[3].thisValue, obj, "[Symbol.iterator] thisValue");
+ assert.sameValue(log[3].args.length, 0, "[Symbol.iterator] args.length");
+
+ assert.sameValue(log[4].name, "get next");
+ assert.sameValue(log[4].thisValue.name, "syncIterator", "get next thisValue");
+
+ assert.sameValue(log[5].name, "call next");
+ assert.sameValue(log[5].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[5].args.length, 1, "next args.length");
+ assert.sameValue(log[5].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[6].name, "get next done (1)");
+ assert.sameValue(log[6].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[7].name, "get next value (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[8].name, "call next");
+ assert.sameValue(log[8].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[8].args.length, 1, "next args.length");
+ assert.sameValue(log[8].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[9].name, "get next done (2)");
+ assert.sameValue(log[9].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[10].name, "get next value (2)");
+ assert.sameValue(log[10].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[11].name, "after yield*");
+ assert.sameValue(log[11].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 12, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-return.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-return.js
new file mode 100644
index 0000000000..f83ce21dd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-return.js
@@ -0,0 +1,204 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-return.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: execution order for yield* with sync iterator and return() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator,
+ « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to
+ ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. Return Completion{[[Type]]: return, [[Value]]: value,
+ [[Target]]: empty}.
+ ix. Let received be GeneratorYield(innerResult).
+
+ %AsyncFromSyncIteratorPrototype%.return ( value )
+
+ 5. Let return be GetMethod(syncIterator, "return").
+ ...
+ ...
+ 8. Let returnResult be Call(return, syncIterator, « value »).
+ ...
+ 11. Let returnValue be IteratorValue(returnResult).
+ ..
+ 13. Let returnDone be IteratorComplete(returnResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, « returnValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to returnDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var returnCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return done (1)");
+ assert.sameValue(log[4].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[5].name, "get return value (1)");
+ assert.sameValue(log[5].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.return().then(v => {
+ assert.sameValue(log[6].name, "get return");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[7].name, "call return");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "get return thisValue");
+ assert.sameValue(log[7].args.length, 1, "return args.length");
+ assert.sameValue(log[7].args[0], undefined, "return args[0]");
+
+ assert.sameValue(log[8].name, "get return done (2)");
+ assert.sameValue(log[8].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[9].name, "get return value (2)");
+ assert.sameValue(log[9].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 10, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-throw.js
new file mode 100644
index 0000000000..6924d9f8e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method-static/yield-star-sync-throw.js
@@ -0,0 +1,210 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-throw.case
+// - src/async-generators/default/async-class-decl-static-method.template
+/*---
+description: execution order for yield* with sync iterator and throw() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Return ? IteratorValue(innerResult).
+ 7. Let received be GeneratorYield(innerResult).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.throw ( value )
+
+ ...
+ 5. Let throw be GetMethod(syncIterator, "throw").
+ ...
+ 8. Let throwResult be Call(throw, syncIterator, « value »).
+ ...
+ 11. Let throwValue be IteratorValue(throwResult).
+ ...
+ 13. Let throwDone be IteratorComplete(throwResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « throwValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to throwDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var throwCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { static async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw done (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[5].name, "get throw value (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.throw().then(v => {
+ assert.sameValue(log[6].name, "get throw");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[7].name, "call throw");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[7].args.length, 1, "throw args.length");
+ assert.sameValue(log[7].args[0], undefined, "throw args[0]");
+
+ assert.sameValue(log[8].name, "get throw done (2)");
+ assert.sameValue(log[8].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[9].name, "get throw value (2)");
+ assert.sameValue(log[9].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[10].name, "after yield*");
+ assert.sameValue(log[10].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 11, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-gen-method/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..afe29a17e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/array-destructuring-param-strict-body.js
@@ -0,0 +1,137 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method([element]) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..c769ed5e60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ var \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier.js
new file mode 100644
index 0000000000..b8da3a80d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ var await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..8bbc5763e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ void \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference.js
new file mode 100644
index 0000000000..c941d9c970
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ void await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..a80f495432
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ \u0061wait: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier.js
new file mode 100644
index 0000000000..f7dd596937
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ await: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-abrupt.js
new file mode 100644
index 0000000000..d1bcfa11ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-abrupt.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/cls-decl-async-gen-meth.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+var callCount = 0;
+class C {
+ async *method(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(Test262Error, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..ee15d9a365
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,91 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: Use of initializer when argument value is not `undefined` (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+var callCount = 0;
+class C {
+ async *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(false, '', NaN, 0, null, obj).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..711588c5a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-undefined.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: Use of initializer when argument value is `undefined` (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+var callCount = 0;
+class C {
+ async *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(undefined, void 0).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-duplicates.js
new file mode 100644
index 0000000000..0f0499f102
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-duplicates.js
@@ -0,0 +1,66 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method(x = 0, x) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-later.js
new file mode 100644
index 0000000000..934b90117e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-later.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/cls-decl-async-gen-meth.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ async *method(x = y, y) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..f8d6fdb234
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-prior.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ async *method(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(3).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-self.js
new file mode 100644
index 0000000000..233d3c84b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-self.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/cls-decl-async-gen-meth.template
+/*---
+description: Referencing a parameter from within its own initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ async *method(x = x) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-rest.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-rest.js
new file mode 100644
index 0000000000..11481afb99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-rest.js
@@ -0,0 +1,70 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: RestParameter does not support an initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method(...x = []) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..a156db4c70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ async *method(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(42, undefined, 1).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..25bfc4645e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, f.arguments (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class, generators]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ async *method() {
+ assert.sameValue(this.method.hasOwnProperty("arguments"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..87675f55e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class, generators]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ async *method() {
+ assert.sameValue(this.method.hasOwnProperty("caller"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..1ee1d902c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ async *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..1cc848438f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ async *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..f1c8cb25fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ async *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-gen-method/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..12171b4e5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/object-destructuring-param-strict-body.js
@@ -0,0 +1,137 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method({property}) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..e86210f4f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-multiple.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ async *method(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(42, 39, 1).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 2, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-single.js
new file mode 100644
index 0000000000..a84e93b285
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-single.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ async *method(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(42, 39).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/rest-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-gen-method/rest-param-strict-body.js
new file mode 100644
index 0000000000..93b4172858
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/rest-param-strict-body.js
@@ -0,0 +1,137 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method(a,...rest) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/class/async-gen-method/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..ac3e44e824
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method(...a,) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..c516f6d840
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ var yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..e0ee916ba1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ var yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..1280b4655f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ void yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..6fe5770f86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ void yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..5bdce639e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ yi\u0065ld: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier.js
new file mode 100644
index 0000000000..ce338ce1b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ yield: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..635f0c848c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,55 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-spread-strict.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [object-spread, async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..8fd9382ede
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-strict-strict.js
@@ -0,0 +1,46 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-strict.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-catch.js
new file mode 100644
index 0000000000..64f693bd72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-catch.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-catch.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}).catch(rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+});
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js
new file mode 100644
index 0000000000..83ecb6da04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-async-iterator.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield * [Promise.reject(value)] is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ for await (let line of readFile()) {
+ yield line;
+ }
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js
new file mode 100644
index 0000000000..45989ca753
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-sync-iterator.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield Promise.reject(value) in for-await-of is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ for await (let value of iterable) {
+ yield value;
+ }
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js
new file mode 100644
index 0000000000..e7d1b5dbe7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js
@@ -0,0 +1,55 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-async-iterator.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield * readFile();
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js
new file mode 100644
index 0000000000..f6614c70fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js
@@ -0,0 +1,54 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-sync-iterator.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield * iterable;
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next.js
new file mode 100644
index 0000000000..6d10c0e0d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..1396fedca9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-multiple.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-multiple.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Use yield value in a array spread position (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield [...yield yield];
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+
+item.then(({ done, value }) => {
+ item = iter.next(value);
+
+ item.then(({ done, value }) => {
+ assert.compareArray(value, arr);
+ assert.sameValue(done, false);
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-single.js
new file mode 100644
index 0000000000..55b7f0855a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-single.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-single.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Use yield value in a array spread position (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield [...yield];
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next(false);
+var item = iter.next(arr);
+
+item.then(({ done, value }) => {
+ assert.notSameValue(value, arr, 'value is a new array');
+ assert(Array.isArray(value), 'value is an Array exotic object');
+ assert.sameValue(value.length, 3)
+ assert.sameValue(value[0], 'a');
+ assert.sameValue(value[1], 'b');
+ assert.sameValue(value[2], 'c');
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-obj.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-obj.js
new file mode 100644
index 0000000000..0e00dd9637
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-obj.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-obj.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Use yield value in a object spread position (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [object-spread, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+item.then(({ done, value }) => {
+ assert.sameValue(value.x, 42);
+ assert.sameValue(value.y, 39);
+ assert.sameValue(Object.keys(value).length, 2);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-next.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-next.js
new file mode 100644
index 0000000000..84ecde54f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-next.js
@@ -0,0 +1,226 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-next.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Execution order for yield* with async iterator and next() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({ name: "get [Symbol.iterator]" });
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({
+ name: "get [Symbol.asyncIterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.asyncIterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-promise-1",
+ get then() {
+ log.push({
+ name: "get next then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "next-promise-2",
+ get then() {
+ log.push({
+ name: "get next then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+ assert.sameValue(log[1].thisValue, obj, "get [Symbol.asyncIterator] thisValue");
+
+ assert.sameValue(log[2].name, "call [Symbol.asyncIterator]");
+ assert.sameValue(log[2].thisValue, obj, "[Symbol.asyncIterator] thisValue");
+ assert.sameValue(log[2].args.length, 0, "[Symbol.asyncIterator] args.length");
+
+ assert.sameValue(log[3].name, "get next");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "get next thisValue");
+
+ assert.sameValue(log[4].name, "call next");
+ assert.sameValue(log[4].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[4].args.length, 1, "next args.length");
+ assert.sameValue(log[4].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[5].name, "get next then (1)");
+ assert.sameValue(log[5].thisValue.name, "next-promise-1", "get next then thisValue");
+
+ assert.sameValue(log[6].name, "call next then (1)");
+ assert.sameValue(log[6].thisValue.name, "next-promise-1", "next then thisValue");
+ assert.sameValue(log[6].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[6].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[6].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[7].name, "get next done (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[8].name, "get next value (1)");
+ assert.sameValue(log[8].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 9, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[9].name, "call next");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[9].args.length, 1, "next args.length");
+ assert.sameValue(log[9].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[10].name, "get next then (2)");
+ assert.sameValue(log[10].thisValue.name, "next-promise-2", "get next then thisValue");
+
+ assert.sameValue(log[11].name, "call next then (2)");
+ assert.sameValue(log[11].thisValue.name, "next-promise-2", "next then thisValue");
+ assert.sameValue(log[11].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[12].name, "get next done (2)");
+ assert.sameValue(log[12].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[13].name, "get next value (2)");
+ assert.sameValue(log[13].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-return.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-return.js
new file mode 100644
index 0000000000..f006307f4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-return.js
@@ -0,0 +1,242 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-return.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with async iterator and return() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator, « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. If generatorKind is async, then set value to ? Await(value).
+ 3. Return Completion{[[Type]]: return, [[Value]]: value, [[Target]]: empty}.
+ ix. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var returnCount = 0;
+ return {
+ name: 'asyncIterator',
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-promise-1",
+ get then() {
+ log.push({
+ name: "get return then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "return-promise-2",
+ get then() {
+ log.push({
+ name: "get return then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return then (1)");
+ assert.sameValue(log[4].thisValue.name, "return-promise-1", "get return then thisValue");
+
+ assert.sameValue(log[5].name, "call return then (1)");
+ assert.sameValue(log[5].thisValue.name, "return-promise-1", "return then thisValue");
+ assert.sameValue(log[5].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[6].name, "get return done (1)");
+ assert.sameValue(log[6].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[7].name, "get return value (1)");
+ assert.sameValue(log[7].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.return("return-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get return");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[9].name, "call return");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[9].args.length, 1, "return args.length");
+ assert.sameValue(log[9].args[0], "return-arg-2", "return args[0]");
+
+ assert.sameValue(log[10].name, "get return then (2)");
+ assert.sameValue(log[10].thisValue.name, "return-promise-2", "get return then thisValue");
+
+ assert.sameValue(log[11].name, "call return then (2)");
+ assert.sameValue(log[11].thisValue.name, "return-promise-2", "return then thisValue");
+ assert.sameValue(log[11].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[12].name, "get return done (2)");
+ assert.sameValue(log[12].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[13].name, "get return value (2)");
+ assert.sameValue(log[13].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 14, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-throw.js
new file mode 100644
index 0000000000..b7af5893bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-throw.js
@@ -0,0 +1,250 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with async iterator and throw() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Let resultValue be Return ? IteratorValue(innerResult).
+ b. If generatorKind is async, then set resultValue to ? Await(resultValue).
+ c. Return resultValue.
+ 7. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var throwCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-promise-1",
+ get then() {
+ log.push({
+ name: "get throw then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "throw-promise-2",
+ get then() {
+ log.push({
+ name: "get throw then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw then (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-promise-1", "get throw thisValue");
+
+ assert.sameValue(log[5].name, "call throw then (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-promise-1", "throw thisValue");
+ assert.sameValue(log[5].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[6].name, "get throw done (1)");
+ assert.sameValue(log[6].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[7].name, "get throw value (1)");
+ assert.sameValue(log[7].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.throw("throw-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get throw");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[9].name, "call throw");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[9].args.length, 1, "throw args.length");
+ assert.sameValue(log[9].args[0], "throw-arg-2", "throw args[0]");
+
+ assert.sameValue(log[10].name, "get throw then (2)");
+ assert.sameValue(log[10].thisValue.name, "throw-promise-2", "get throw thisValue");
+
+ assert.sameValue(log[11].name, "call throw then (2)");
+ assert.sameValue(log[11].thisValue.name, "throw-promise-2", "throw thisValue");
+ assert.sameValue(log[11].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[12].name, "get throw done (2)");
+ assert.sameValue(log[12].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[13].name, "get throw value (2)");
+ assert.sameValue(log[13].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-expr-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-expr-abrupt.js
new file mode 100644
index 0000000000..9fa5fa10eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-expr-abrupt.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-expr-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting yield* operand (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ ...
+
+---*/
+var obj = {};
+var abrupt = function() {
+ throw obj;
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* abrupt();
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, obj, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-get-abrupt.js
new file mode 100644
index 0000000000..e3e4865196
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-get-abrupt.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting [Symbol.asyncIterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ get [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..ee931b78bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js
new file mode 100644
index 0000000000..02cef73682
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js
new file mode 100644
index 0000000000..7394078578
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js
new file mode 100644
index 0000000000..f672cfd0bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..c0fd63751f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: Symbol.asyncIterator
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js
new file mode 100644
index 0000000000..87e5dd619b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting @@iterator after null @@asyncIterator (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js
new file mode 100644
index 0000000000..0ba984c4de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while calling [Symbol.asyncIterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js
new file mode 100644
index 0000000000..35f08fbfd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - boolean (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js
new file mode 100644
index 0000000000..46e9d344df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - null (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js
new file mode 100644
index 0000000000..a92c451abd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - number (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return 42;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js
new file mode 100644
index 0000000000..f6ff86e9c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - string (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return '42';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js
new file mode 100644
index 0000000000..6d3abc9a26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - symbol (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return Symbol.asyncIterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js
new file mode 100644
index 0000000000..3f821ab7e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - undefined (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js
new file mode 100644
index 0000000000..39524b5304
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js
new file mode 100644
index 0000000000..d0b336e722
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting [Symbol.iterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..6f44d3ee98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js
new file mode 100644
index 0000000000..3fb3df0fa8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js
new file mode 100644
index 0000000000..4dcf06dc35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js
new file mode 100644
index 0000000000..ae77bebeaa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..af6649ac1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: Symbol.iterator
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js
new file mode 100644
index 0000000000..c7c1894a08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while calling [Symbol.iterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js
new file mode 100644
index 0000000000..116f08fe59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - boolean (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js
new file mode 100644
index 0000000000..7471f6b535
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - null (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js
new file mode 100644
index 0000000000..cf39a2c8c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - number (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return 0;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js
new file mode 100644
index 0000000000..5bd0727fef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - string (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return '';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js
new file mode 100644
index 0000000000..9943d01a31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - symbol (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return Symbol.iterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js
new file mode 100644
index 0000000000..316be8f17e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - undefined (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-done-get-abrupt.js
new file mode 100644
index 0000000000..c3789c2873
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-done-get-abrupt.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-done-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting done (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get done() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-returns-abrupt.js
new file mode 100644
index 0000000000..5018bbb2be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-returns-abrupt.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while calling next (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-value-get-abrupt.js
new file mode 100644
index 0000000000..e5c8b1b039
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-value-get-abrupt.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-value-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ done: true,
+ get value() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-get-abrupt.js
new file mode 100644
index 0000000000..2fb2a77100
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-get-abrupt.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting next (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ get next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-non-object-ignores-then.js
new file mode 100644
index 0000000000..0e47083f23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-non-object-ignores-then.js
@@ -0,0 +1,92 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-non-object-ignores-then.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: If next() value is not-object, do not access respective then property (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+
+---*/
+Number.prototype.then = function() {
+ throw new Test262Error('Number#then should not be used');
+};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return 42;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, 'TypeError');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..40dfa0aa49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - boolean (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: true
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-null-throw.js
new file mode 100644
index 0000000000..f24943e9ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-null-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-null-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - null (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: null
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-number-throw.js
new file mode 100644
index 0000000000..64a27fae1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-number-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - number (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: 42
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-object-throw.js
new file mode 100644
index 0000000000..a1ef33d2bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-object-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - object (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: {}
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-string-throw.js
new file mode 100644
index 0000000000..be3c40ec57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-string-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - string (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: ''
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..8d5c129490
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - symbol (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: Symbol('oi')
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js
new file mode 100644
index 0000000000..0a755d6f73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - undefined (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: undefined
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-get-abrupt.js
new file mode 100644
index 0000000000..c233ce580a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-get-abrupt.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Return abrupt after getting next().then (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js
new file mode 100644
index 0000000000..d9086dcba6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (boolean) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: true,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js
new file mode 100644
index 0000000000..e1fa7fde10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (null) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: null,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js
new file mode 100644
index 0000000000..c1d0811a23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (number) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: 39,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js
new file mode 100644
index 0000000000..71d346bc80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (object) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: {},
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js
new file mode 100644
index 0000000000..d957d8af7b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (string) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: '',
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js
new file mode 100644
index 0000000000..339c5f09f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (symbol) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: Symbol('oi'),
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js
new file mode 100644
index 0000000000..4153342a2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (undefined) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: undefined,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-returns-abrupt.js
new file mode 100644
index 0000000000..a8c6fa6699
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-returns-abrupt.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Return abrupt after calling next().then (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-next.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-next.js
new file mode 100644
index 0000000000..8f5fc9702e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-next.js
@@ -0,0 +1,229 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-next.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with sync iterator and next() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ 5. Let received be NormalCompletion(undefined).
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]).
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ vii. Let received be GeneratorYield(innerResult).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.next ( value )
+
+ ...
+ 5. Let nextResult be IteratorNext(syncIterator, value).
+ ...
+ 7. Let nextValue be IteratorValue(nextResult).
+ ...
+ 9. Let nextDone be IteratorComplete(nextResult).
+ ...
+ 12. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « nextValue »).
+ ...
+ 14. Set onFulfilled.[[Done]] to nextDone.
+ 15. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+ Async Iterator Value Unwrap Functions
+
+ 1. Return ! CreateIterResultObject(value, F.[[Done]]).
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({
+ name: "get [Symbol.iterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.iterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ };
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({ name: "get [Symbol.asyncIterator]" });
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+
+ assert.sameValue(log[2].name, "get [Symbol.iterator]");
+ assert.sameValue(log[2].thisValue, obj, "get [Symbol.iterator] thisValue");
+
+ assert.sameValue(log[3].name, "call [Symbol.iterator]");
+ assert.sameValue(log[3].thisValue, obj, "[Symbol.iterator] thisValue");
+ assert.sameValue(log[3].args.length, 0, "[Symbol.iterator] args.length");
+
+ assert.sameValue(log[4].name, "get next");
+ assert.sameValue(log[4].thisValue.name, "syncIterator", "get next thisValue");
+
+ assert.sameValue(log[5].name, "call next");
+ assert.sameValue(log[5].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[5].args.length, 1, "next args.length");
+ assert.sameValue(log[5].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[6].name, "get next done (1)");
+ assert.sameValue(log[6].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[7].name, "get next value (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[8].name, "call next");
+ assert.sameValue(log[8].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[8].args.length, 1, "next args.length");
+ assert.sameValue(log[8].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[9].name, "get next done (2)");
+ assert.sameValue(log[9].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[10].name, "get next value (2)");
+ assert.sameValue(log[10].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[11].name, "after yield*");
+ assert.sameValue(log[11].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 12, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-return.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-return.js
new file mode 100644
index 0000000000..707b4d6f5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-return.js
@@ -0,0 +1,204 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-return.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with sync iterator and return() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator,
+ « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to
+ ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. Return Completion{[[Type]]: return, [[Value]]: value,
+ [[Target]]: empty}.
+ ix. Let received be GeneratorYield(innerResult).
+
+ %AsyncFromSyncIteratorPrototype%.return ( value )
+
+ 5. Let return be GetMethod(syncIterator, "return").
+ ...
+ ...
+ 8. Let returnResult be Call(return, syncIterator, « value »).
+ ...
+ 11. Let returnValue be IteratorValue(returnResult).
+ ..
+ 13. Let returnDone be IteratorComplete(returnResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, « returnValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to returnDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var returnCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return done (1)");
+ assert.sameValue(log[4].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[5].name, "get return value (1)");
+ assert.sameValue(log[5].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.return().then(v => {
+ assert.sameValue(log[6].name, "get return");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[7].name, "call return");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "get return thisValue");
+ assert.sameValue(log[7].args.length, 1, "return args.length");
+ assert.sameValue(log[7].args[0], undefined, "return args[0]");
+
+ assert.sameValue(log[8].name, "get return done (2)");
+ assert.sameValue(log[8].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[9].name, "get return value (2)");
+ assert.sameValue(log[9].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 10, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-throw.js
new file mode 100644
index 0000000000..4721201d4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-throw.js
@@ -0,0 +1,210 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with sync iterator and throw() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Return ? IteratorValue(innerResult).
+ 7. Let received be GeneratorYield(innerResult).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.throw ( value )
+
+ ...
+ 5. Let throw be GetMethod(syncIterator, "throw").
+ ...
+ 8. Let throwResult be Call(throw, syncIterator, « value »).
+ ...
+ 11. Let throwValue be IteratorValue(throwResult).
+ ...
+ 13. Let throwDone be IteratorComplete(throwResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « throwValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to throwDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var throwCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw done (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[5].name, "get throw value (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.throw().then(v => {
+ assert.sameValue(log[6].name, "get throw");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[7].name, "call throw");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[7].args.length, 1, "throw args.length");
+ assert.sameValue(log[7].args[0], undefined, "throw args[0]");
+
+ assert.sameValue(log[8].name, "get throw done (2)");
+ assert.sameValue(log[8].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[9].name, "get throw value (2)");
+ assert.sameValue(log[9].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[10].name, "after yield*");
+ assert.sameValue(log[10].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 11, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-meth-escaped-async.js b/js/src/tests/test262/language/statements/class/async-meth-escaped-async.js
new file mode 100644
index 0000000000..55b5bc1790
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-meth-escaped-async.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-grammar-notation
+description: >
+ The `async` contextual keyword must not contain Unicode escape sequences.
+info: |
+ Terminal symbols are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ \u0061sync m(){}
+};
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-method-static/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..3f3fcca036
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/array-destructuring-param-strict-body.js
@@ -0,0 +1,135 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-meth-static.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method([element]) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-method-static/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..c4764c5a6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/await-as-binding-identifier-escaped.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier-escaped.case
+// - src/async-functions/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method() {
+ var \u0061wait;
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/async-method-static/await-as-binding-identifier.js
new file mode 100644
index 0000000000..9e1d40d72d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/await-as-binding-identifier.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier.case
+// - src/async-functions/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method() {
+ var await;
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/async-method-static/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..c345544674
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/await-as-identifier-reference-escaped.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference-escaped.case
+// - src/async-functions/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method() {
+ void \u0061wait;
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/async-method-static/await-as-identifier-reference.js
new file mode 100644
index 0000000000..208b4624ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/await-as-identifier-reference.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference.case
+// - src/async-functions/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method() {
+ void await;
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-method-static/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..b3ebdadd40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/await-as-label-identifier-escaped.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier-escaped.case
+// - src/async-functions/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method() {
+ \u0061wait: ;
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/await-as-label-identifier.js b/js/src/tests/test262/language/statements/class/async-method-static/await-as-label-identifier.js
new file mode 100644
index 0000000000..93610ded3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/await-as-label-identifier.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier.case
+// - src/async-functions/syntax/async-class-decl-static-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method() {
+ await: ;
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/browser.js b/js/src/tests/test262/language/statements/class/async-method-static/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-abrupt.js
new file mode 100644
index 0000000000..432afbeed3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-abrupt.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/cls-decl-async-meth-static.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async method(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+ }
+}
+
+C.method()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, Test262Error))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..ace02e7cb4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/cls-decl-async-meth-static.template
+/*---
+description: Use of initializer when argument value is not `undefined` (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+
+var callCount = 0;
+class C {
+ static async method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(false, '', NaN, 0, null, obj).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..50a0547e03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-arg-val-undefined.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/cls-decl-async-meth-static.template
+/*---
+description: Use of initializer when argument value is `undefined` (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(undefined, void 0).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-duplicates.js
new file mode 100644
index 0000000000..1aa5b503e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-duplicates.js
@@ -0,0 +1,64 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/cls-decl-async-meth-static.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method(x = 0, x) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-later.js
new file mode 100644
index 0000000000..f2f225fad3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-later.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/cls-decl-async-meth-static.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+class C {
+ static async method(x = y, y) {
+
+ callCount = callCount + 1;
+ }
+}
+
+C.method()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, ReferenceError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..e66cf5a357
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-prior.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/cls-decl-async-meth-static.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+class C {
+ static async method(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(3).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-self.js
new file mode 100644
index 0000000000..a38fd6dc54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-ref-self.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/cls-decl-async-meth-static.template
+/*---
+description: Referencing a parameter from within its own initializer (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+class C {
+ static async method(x = x) {
+
+ callCount = callCount + 1;
+ }
+}
+
+C.method()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, ReferenceError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-rest.js b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-rest.js
new file mode 100644
index 0000000000..126f505a86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-rest.js
@@ -0,0 +1,68 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/cls-decl-async-meth-static.template
+/*---
+description: RestParameter does not support an initializer (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method(...x = []) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..005f2fcc09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/dflt-params-trailing-comma.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/cls-decl-async-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+class C {
+ static async method(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(42, undefined, 1).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/cls-decl-async-meth-static-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/cls-decl-async-meth-static-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..c619167177
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/cls-decl-async-meth-static-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template
+/*---
+description: Forbidden extension, f.arguments (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async method() {
+ assert.sameValue(this.method.hasOwnProperty("arguments"), false);
+ callCount++;
+ }
+}
+
+C.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/cls-decl-async-meth-static-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/cls-decl-async-meth-static-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..6424d9cf31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/cls-decl-async-meth-static-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async method() {
+ assert.sameValue(this.method.hasOwnProperty("caller"), false);
+ callCount++;
+ }
+}
+
+C.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..ba4b0c81c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+class C {
+ static async method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..328536d3ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+class C {
+ static async method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..94bb78a47a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/cls-decl-async-meth-static-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [arrow-function, async-functions, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+class C {
+ static async method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-method-static/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..981b36d107
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/object-destructuring-param-strict-body.js
@@ -0,0 +1,135 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-meth-static.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method({property}) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/class/async-method-static/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..5893063cbf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/params-trailing-comma-multiple.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/cls-decl-async-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+class C {
+ static async method(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(42, 39, 1).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 2, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/class/async-method-static/params-trailing-comma-single.js
new file mode 100644
index 0000000000..ddc52c4af0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/params-trailing-comma-single.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/cls-decl-async-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+class C {
+ static async method(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+ref(42, 39).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/rest-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-method-static/rest-param-strict-body.js
new file mode 100644
index 0000000000..94e556e31a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/rest-param-strict-body.js
@@ -0,0 +1,135 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-meth-static.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method(a,...rest) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/class/async-method-static/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..39b5166cf1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/cls-decl-async-meth-static.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class declaration async method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async method(...a,) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow-returns-arguments-from-parent-function.js
new file mode 100644
index 0000000000..014ac6e200
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow-returns-arguments-from-parent-function.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-arguments-from-parent-function.case
+// - src/async-functions/evaluation/async-class-decl-static-method.template
+/*---
+description: Async function returns an async function. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async method(x) {
+ let a = arguments;
+ return async () => a === arguments;
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method;
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, true);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow-returns-newtarget.js
new file mode 100644
index 0000000000..5f62fd347e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow-returns-newtarget.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-newtarget.case
+// - src/async-functions/evaluation/async-class-decl-static-method.template
+/*---
+description: Async function returns an async function. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async method(x) {
+ return async () => new.target;
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method;
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow.js b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow.js
new file mode 100644
index 0000000000..718b3a1780
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-arrow.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow.case
+// - src/async-functions/evaluation/async-class-decl-static-method.template
+/*---
+description: Async function returns an async function. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async method(x) {
+ return async () => x;
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method;
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-function-returns-arguments-from-own-function.js
new file mode 100644
index 0000000000..30f95d44a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-function-returns-arguments-from-own-function.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-arguments-from-own-function.case
+// - src/async-functions/evaluation/async-class-decl-static-method.template
+/*---
+description: Async function returns an async function. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async method(x) {
+ let a = arguments;
+ return async function() { return a === arguments; };
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method;
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, false);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-function-returns-newtarget.js
new file mode 100644
index 0000000000..35d0fc10f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-function-returns-newtarget.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-newtarget.case
+// - src/async-functions/evaluation/async-class-decl-static-method.template
+/*---
+description: Async function returns an async function. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async method(x) {
+ return async function() { return new.target; };
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method;
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/returns-async-function.js b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-function.js
new file mode 100644
index 0000000000..f7f91ce8c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/returns-async-function.js
@@ -0,0 +1,40 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function.case
+// - src/async-functions/evaluation/async-class-decl-static-method.template
+/*---
+description: Async function returns an async function. (Static async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async method(x) {
+ return async function() { return x; };
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method;
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method-static/shell.js b/js/src/tests/test262/language/statements/class/async-method-static/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method-static/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-method/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-method/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..3beeff44be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/array-destructuring-param-strict-body.js
@@ -0,0 +1,136 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-meth.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method([element]) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-method/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..37f594452e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/await-as-binding-identifier-escaped.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier-escaped.case
+// - src/async-functions/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method() {
+ var \u0061wait;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/async-method/await-as-binding-identifier.js
new file mode 100644
index 0000000000..d5316d1f95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/await-as-binding-identifier.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier.case
+// - src/async-functions/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method() {
+ var await;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/async-method/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..d50ac7bbf1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/await-as-identifier-reference-escaped.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference-escaped.case
+// - src/async-functions/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method() {
+ void \u0061wait;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/async-method/await-as-identifier-reference.js
new file mode 100644
index 0000000000..33d12e86cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/await-as-identifier-reference.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference.case
+// - src/async-functions/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method() {
+ void await;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-method/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..cb57855059
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/await-as-label-identifier-escaped.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier-escaped.case
+// - src/async-functions/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method() {
+ \u0061wait: ;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/await-as-label-identifier.js b/js/src/tests/test262/language/statements/class/async-method/await-as-label-identifier.js
new file mode 100644
index 0000000000..514d8fa7d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/await-as-label-identifier.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier.case
+// - src/async-functions/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method() {
+ await: ;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/browser.js b/js/src/tests/test262/language/statements/class/async-method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-method/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/class/async-method/dflt-params-abrupt.js
new file mode 100644
index 0000000000..aaac592903
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/dflt-params-abrupt.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/cls-decl-async-meth.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async method(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, Test262Error))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/class/async-method/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..bed4014129
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/cls-decl-async-meth.template
+/*---
+description: Use of initializer when argument value is not `undefined` (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+
+var callCount = 0;
+class C {
+ async method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(false, '', NaN, 0, null, obj).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
diff --git a/js/src/tests/test262/language/statements/class/async-method/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/class/async-method/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..1081d0286d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/dflt-params-arg-val-undefined.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/cls-decl-async-meth.template
+/*---
+description: Use of initializer when argument value is `undefined` (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(undefined, void 0).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/class/async-method/dflt-params-duplicates.js
new file mode 100644
index 0000000000..929fa6fe0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/dflt-params-duplicates.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/cls-decl-async-meth.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method(x = 0, x) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-later.js
new file mode 100644
index 0000000000..6354543331
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-later.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/cls-decl-async-meth.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+class C {
+ async method(x = y, y) {
+
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, ReferenceError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..4ccffdb34a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-prior.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/cls-decl-async-meth.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+class C {
+ async method(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(3).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-self.js
new file mode 100644
index 0000000000..60d0a36730
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/dflt-params-ref-self.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/cls-decl-async-meth.template
+/*---
+description: Referencing a parameter from within its own initializer (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+class C {
+ async method(x = x) {
+
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, ReferenceError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/dflt-params-rest.js b/js/src/tests/test262/language/statements/class/async-method/dflt-params-rest.js
new file mode 100644
index 0000000000..053a8ea6e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/dflt-params-rest.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/cls-decl-async-meth.template
+/*---
+description: RestParameter does not support an initializer (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method(...x = []) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/class/async-method/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..c37207785a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/dflt-params-trailing-comma.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/cls-decl-async-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+class C {
+ async method(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(42, undefined, 1).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/cls-decl-async-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/cls-decl-async-meth-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..741a765447
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/cls-decl-async-meth-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template
+/*---
+description: Forbidden extension, f.arguments (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async method() {
+ assert.sameValue(this.method.hasOwnProperty("arguments"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/cls-decl-async-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/cls-decl-async-meth-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..dd2def5668
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/cls-decl-async-meth-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template
+/*---
+description: Forbidden extension, o.caller (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async method() {
+ assert.sameValue(this.method.hasOwnProperty("caller"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..affd996b64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template
+/*---
+description: Forbidden extension, o.caller (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+class C {
+ async method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..e144379c64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template
+/*---
+description: Forbidden extension, o.caller (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+class C {
+ async method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..6691fb340c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/cls-decl-async-meth-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template
+/*---
+description: Forbidden extension, o.caller (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+class C {
+ async method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-method/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-method/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..cf462c5e84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/object-destructuring-param-strict-body.js
@@ -0,0 +1,136 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-meth.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method({property}) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/class/async-method/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..3ed41638d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/params-trailing-comma-multiple.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/cls-decl-async-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+class C {
+ async method(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(42, 39, 1).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 2, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-method/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/class/async-method/params-trailing-comma-single.js
new file mode 100644
index 0000000000..7f9df37483
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/params-trailing-comma-single.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/cls-decl-async-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+class C {
+ async method(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(42, 39).then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-method/rest-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-method/rest-param-strict-body.js
new file mode 100644
index 0000000000..0309fc746a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/rest-param-strict-body.js
@@ -0,0 +1,136 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-meth.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method(a,...rest) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/class/async-method/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..0599033ac7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,61 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/cls-decl-async-meth.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class declaration async method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise
+ let strict be false.
+ 4. Let scope be the LexicalEnvironment of the running execution context.
+ 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody,
+ scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async method(...a,) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-method/returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/statements/class/async-method/returns-async-arrow-returns-arguments-from-parent-function.js
new file mode 100644
index 0000000000..0cdf4958cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/returns-async-arrow-returns-arguments-from-parent-function.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-arguments-from-parent-function.case
+// - src/async-functions/evaluation/async-class-decl-method.template
+/*---
+description: Async function returns an async function. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async method(x) {
+ let a = arguments;
+ return async () => a === arguments;
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, true);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/statements/class/async-method/returns-async-arrow-returns-newtarget.js
new file mode 100644
index 0000000000..d61779e664
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/returns-async-arrow-returns-newtarget.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-newtarget.case
+// - src/async-functions/evaluation/async-class-decl-method.template
+/*---
+description: Async function returns an async function. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async method(x) {
+ return async () => new.target;
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/returns-async-arrow.js b/js/src/tests/test262/language/statements/class/async-method/returns-async-arrow.js
new file mode 100644
index 0000000000..aacd815b31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/returns-async-arrow.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow.case
+// - src/async-functions/evaluation/async-class-decl-method.template
+/*---
+description: Async function returns an async function. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async method(x) {
+ return async () => x;
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/statements/class/async-method/returns-async-function-returns-arguments-from-own-function.js
new file mode 100644
index 0000000000..98a0426f37
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/returns-async-function-returns-arguments-from-own-function.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-arguments-from-own-function.case
+// - src/async-functions/evaluation/async-class-decl-method.template
+/*---
+description: Async function returns an async function. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async method(x) {
+ let a = arguments;
+ return async function() { return a === arguments; };
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, false);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/statements/class/async-method/returns-async-function-returns-newtarget.js
new file mode 100644
index 0000000000..cb0f41d3ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/returns-async-function-returns-newtarget.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-newtarget.case
+// - src/async-functions/evaluation/async-class-decl-method.template
+/*---
+description: Async function returns an async function. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async method(x) {
+ return async function() { return new.target; };
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/returns-async-function.js b/js/src/tests/test262/language/statements/class/async-method/returns-async-function.js
new file mode 100644
index 0000000000..6ad1e995de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/returns-async-function.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function.case
+// - src/async-functions/evaluation/async-class-decl-method.template
+/*---
+description: Async function returns an async function. (Async method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async method(x) {
+ return async function() { return x; };
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-method/shell.js b/js/src/tests/test262/language/statements/class/async-method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-method/shell.js
diff --git a/js/src/tests/test262/language/statements/class/browser.js b/js/src/tests/test262/language/statements/class/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/browser.js
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-await-escaped-module.js b/js/src/tests/test262/language/statements/class/class-name-ident-await-escaped-module.js
new file mode 100644
index 0000000000..bded6b457b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-await-escaped-module.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `await` with escape sequence is a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if the goal symbol of the syntactic grammar is Module
+ and the StringValue of IdentifierName is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+class aw\u0061it {}
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-await-escaped.js b/js/src/tests/test262/language/statements/class/class-name-ident-await-escaped.js
new file mode 100644
index 0000000000..6cf03b3ef0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-await-escaped.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `await` with escape sequence is a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if the goal symbol of the syntactic grammar is Module
+ and the StringValue of IdentifierName is "await".
+---*/
+
+class aw\u0061it {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-await-module.js b/js/src/tests/test262/language/statements/class/class-name-ident-await-module.js
new file mode 100644
index 0000000000..5b5b4d7424
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-await-module.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `await` is a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ IdentifierReference : await
+
+ It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+class await {}
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-await.js b/js/src/tests/test262/language/statements/class/class-name-ident-await.js
new file mode 100644
index 0000000000..aca98d4766
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-await.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `await` is a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ IdentifierReference : await
+
+ It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
+---*/
+
+class await {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-let-escaped.js b/js/src/tests/test262/language/statements/class/class-name-ident-let-escaped.js
new file mode 100644
index 0000000000..47dd2701a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-let-escaped.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `let` with escape sequence is not a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if this phrase is contained in strict mode code and the
+ StringValue of IdentifierName is: "implements", "interface", "let", "package",
+ "private", "protected", "public", "static", or "yield".
+
+ 10.2.1 Strict Mode Code
+
+ All parts of a ClassDeclaration or a ClassExpression are strict mode code.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class l\u0065t {}
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-let.js b/js/src/tests/test262/language/statements/class/class-name-ident-let.js
new file mode 100644
index 0000000000..16bb5d0190
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-let.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `let` is not a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if this phrase is contained in strict mode code and the
+ StringValue of IdentifierName is: "implements", "interface", "let", "package",
+ "private", "protected", "public", "static", or "yield".
+
+ 10.2.1 Strict Mode Code
+
+ All parts of a ClassDeclaration or a ClassExpression are strict mode code.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class let {}
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-static-escaped.js b/js/src/tests/test262/language/statements/class/class-name-ident-static-escaped.js
new file mode 100644
index 0000000000..5c41524021
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-static-escaped.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `static` with escape sequence is not a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if this phrase is contained in strict mode code and the
+ StringValue of IdentifierName is: "implements", "interface", "let", "package",
+ "private", "protected", "public", "static", or "yield".
+
+ 10.2.1 Strict Mode Code
+
+ All parts of a ClassDeclaration or a ClassExpression are strict mode code.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class st\u0061tic {}
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-static.js b/js/src/tests/test262/language/statements/class/class-name-ident-static.js
new file mode 100644
index 0000000000..3ad03ceb52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-static.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `static` is not a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if this phrase is contained in strict mode code and the
+ StringValue of IdentifierName is: "implements", "interface", "let", "package",
+ "private", "protected", "public", "static", or "yield".
+
+ 10.2.1 Strict Mode Code
+
+ All parts of a ClassDeclaration or a ClassExpression are strict mode code.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class static {}
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-yield-escaped.js b/js/src/tests/test262/language/statements/class/class-name-ident-yield-escaped.js
new file mode 100644
index 0000000000..79d93b963c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-yield-escaped.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `yield` with escape sequence is not a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if this phrase is contained in strict mode code and the
+ StringValue of IdentifierName is: "implements", "interface", "let", "package",
+ "private", "protected", "public", "static", or "yield".
+
+ 10.2.1 Strict Mode Code
+
+ All parts of a ClassDeclaration or a ClassExpression are strict mode code.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class yi\u0065ld {}
diff --git a/js/src/tests/test262/language/statements/class/class-name-ident-yield.js b/js/src/tests/test262/language/statements/class/class-name-ident-yield.js
new file mode 100644
index 0000000000..ad79976e01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/class-name-ident-yield.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions
+description: >
+ `yield` is not a valid class-name identifier.
+info: |
+ 12.1.1 Static Semantics: Early Errors
+
+ IdentifierReference : yield
+
+ It is a Syntax Error if the code matched by this production is contained in strict mode code.
+
+ 10.2.1 Strict Mode Code
+
+ All parts of a ClassDeclaration or a ClassExpression are strict mode code.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class yield {}
diff --git a/js/src/tests/test262/language/statements/class/classelementname-abrupt-completion.js b/js/src/tests/test262/language/statements/class/classelementname-abrupt-completion.js
new file mode 100644
index 0000000000..365825d9f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/classelementname-abrupt-completion.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Class definition should error if evaluation of ClassElementName errors
+esid: sec-runtime-semantics-classdefinitionevaluation
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of e is false, then
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+
+ Runtime Semantics: ClassElementEvaluation
+ ...
+ ClassElement : FieldDefinition ;
+ 1. Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
+
+ Runtime Semantics: ClassFieldDefinitionEvaluation
+ With parameters isStatic and homeObject.
+ FieldDefinition : ClassElementNameInitializer
+ 1. Let fieldName be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(fieldName).
+
+features: [class, class-fields-public]
+---*/
+
+function f() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ class C {
+ [f()]
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-additive-expression-add.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-additive-expression-add.js
new file mode 100644
index 0000000000..0c03860f13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-additive-expression-add.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-additive-expression-add.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from additive expression "add" (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1 + 1]() {
+ return 2;
+ }
+
+ set [1 + 1](v) {
+ return 2;
+ }
+
+ static get [1 + 1]() {
+ return 2;
+ }
+
+ static set [1 + 1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 + 1],
+ 2
+);
+assert.sameValue(
+ c[1 + 1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[1 + 1],
+ 2
+);
+assert.sameValue(
+ C[1 + 1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(1 + 1)],
+ 2
+);
+assert.sameValue(
+ c[String(1 + 1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(1 + 1)],
+ 2
+);
+assert.sameValue(
+ C[String(1 + 1)] = 2,
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-additive-expression-subtract.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-additive-expression-subtract.js
new file mode 100644
index 0000000000..1687b05265
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-additive-expression-subtract.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-additive-expression-subtract.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from additive expression "subtract" (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1 - 1]() {
+ return 0;
+ }
+
+ set [1 - 1](v) {
+ return 0;
+ }
+
+ static get [1 - 1]() {
+ return 0;
+ }
+
+ static set [1 - 1](v) {
+ return 0;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 - 1],
+ 0
+);
+assert.sameValue(
+ c[1 - 1] = 0,
+ 0
+);
+
+assert.sameValue(
+ C[1 - 1],
+ 0
+);
+assert.sameValue(
+ C[1 - 1] = 0,
+ 0
+);
+assert.sameValue(
+ c[String(1 - 1)],
+ 0
+);
+assert.sameValue(
+ c[String(1 - 1)] = 0,
+ 0
+);
+
+assert.sameValue(
+ C[String(1 - 1)],
+ 0
+);
+assert.sameValue(
+ C[String(1 - 1)] = 0,
+ 0
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-arrow-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-arrow-function-expression.js
new file mode 100644
index 0000000000..35c62752f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-arrow-function-expression.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-arrow-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from arrow function (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [() => { }]() {
+ return 1;
+ }
+
+ set [() => { }](v) {
+ return 1;
+ }
+
+ static get [() => { }]() {
+ return 1;
+ }
+
+ static set [() => { }](v) {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[() => { }],
+ 1
+);
+assert.sameValue(
+ c[() => { }] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[() => { }],
+ 1
+);
+assert.sameValue(
+ C[() => { }] = 1,
+ 1
+);
+assert.sameValue(
+ c[String(() => { })],
+ 1
+);
+assert.sameValue(
+ c[String(() => { })] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[String(() => { })],
+ 1
+);
+assert.sameValue(
+ C[String(() => { })] = 1,
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-assignment.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-assignment.js
new file mode 100644
index 0000000000..03e77aa351
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-assignment.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from assignment expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ get [x = 1]() {
+ return 2;
+ }
+
+ set [x = 1](v) {
+ return 2;
+ }
+
+ static get [x = 1]() {
+ return 2;
+ }
+
+ static set [x = 1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x = 1],
+ 2
+);
+assert.sameValue(
+ c[x = 1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[x = 1],
+ 2
+);
+assert.sameValue(
+ C[x = 1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(x = 1)],
+ 2
+);
+assert.sameValue(
+ c[String(x = 1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(x = 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x = 1)] = 2,
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-bitwise-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-bitwise-or.js
new file mode 100644
index 0000000000..b4596691f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-bitwise-or.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-bitwise-or.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from assignment expression bitwise or (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ get [x |= 1]() {
+ return 2;
+ }
+
+ set [x |= 1](v) {
+ return 2;
+ }
+
+ static get [x |= 1]() {
+ return 2;
+ }
+
+ static set [x |= 1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x |= 1],
+ 2
+);
+assert.sameValue(
+ c[x |= 1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[x |= 1],
+ 2
+);
+assert.sameValue(
+ C[x |= 1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(x |= 1)],
+ 2
+);
+assert.sameValue(
+ c[String(x |= 1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(x |= 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x |= 1)] = 2,
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-coalesce.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-coalesce.js
new file mode 100644
index 0000000000..4cebeb89d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-coalesce.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from assignment expression coalesce (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = null;
+
+
+class C {
+ get [x ??= 1]() {
+ return 2;
+ }
+
+ set [x ??= 1](v) {
+ return 2;
+ }
+
+ static get [x ??= 1]() {
+ return 2;
+ }
+
+ static set [x ??= 1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ??= 1],
+ 2
+);
+assert.sameValue(
+ c[x ??= 1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[x ??= 1],
+ 2
+);
+assert.sameValue(
+ C[x ??= 1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(x ??= 1)],
+ 2
+);
+assert.sameValue(
+ c[String(x ??= 1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(x ??= 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x ??= 1)] = 2,
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-logical-and.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-logical-and.js
new file mode 100644
index 0000000000..4ed3d8ada7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-logical-and.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-and.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from assignment expression logical and (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ get [x &&= 1]() {
+ return 2;
+ }
+
+ set [x &&= 1](v) {
+ return 2;
+ }
+
+ static get [x &&= 1]() {
+ return 2;
+ }
+
+ static set [x &&= 1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x &&= 1],
+ 2
+);
+assert.sameValue(
+ c[x &&= 1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[x &&= 1],
+ 2
+);
+assert.sameValue(
+ C[x &&= 1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(x &&= 1)],
+ 2
+);
+assert.sameValue(
+ c[String(x &&= 1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(x &&= 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x &&= 1)] = 2,
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-logical-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-logical-or.js
new file mode 100644
index 0000000000..f6735ff285
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-assignment-expression-logical-or.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-or.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from assignment expression logical or (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ get [x ||= 1]() {
+ return 2;
+ }
+
+ set [x ||= 1](v) {
+ return 2;
+ }
+
+ static get [x ||= 1]() {
+ return 2;
+ }
+
+ static set [x ||= 1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ||= 1],
+ 2
+);
+assert.sameValue(
+ c[x ||= 1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[x ||= 1],
+ 2
+);
+assert.sameValue(
+ C[x ||= 1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(x ||= 1)],
+ 2
+);
+assert.sameValue(
+ c[String(x ||= 1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(x ||= 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x ||= 1)] = 2,
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-async-arrow-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-async-arrow-function-expression.js
new file mode 100644
index 0000000000..188e1bad9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-async-arrow-function-expression.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-async-arrow-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from function expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [async () => {}]() {
+ return 1;
+ }
+
+ set [async () => {}](v) {
+ return 1;
+ }
+
+ static get [async () => {}]() {
+ return 1;
+ }
+
+ static set [async () => {}](v) {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[async () => {}],
+ 1
+);
+assert.sameValue(
+ c[async () => {}] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[async () => {}],
+ 1
+);
+assert.sameValue(
+ C[async () => {}] = 1,
+ 1
+);
+assert.sameValue(
+ c[String(async () => {})],
+ 1
+);
+assert.sameValue(
+ c[String(async () => {})] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[String(async () => {})],
+ 1
+);
+assert.sameValue(
+ C[String(async () => {})] = 1,
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-await-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-await-expression.js
new file mode 100644
index 0000000000..f6ae5c0905
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-await-expression.js
@@ -0,0 +1,98 @@
+// |reftest| module async
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-await-expression.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, top-level-await]
+flags: [generated, async, module]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+try {
+
+
+class C {
+ get [await 9]() {
+ return 9;
+ }
+
+ set [await 9](v) {
+ return 9;
+ }
+
+ static get [await 9]() {
+ return 9;
+ }
+
+ static set [await 9](v) {
+ return 9;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[await 9],
+ 9
+);
+assert.sameValue(
+ c[await 9] = 9,
+ 9
+);
+
+assert.sameValue(
+ C[await 9],
+ 9
+);
+assert.sameValue(
+ C[await 9] = 9,
+ 9
+);
+assert.sameValue(
+ c[String(await 9)],
+ 9
+);
+assert.sameValue(
+ c[String(await 9)] = 9,
+ 9
+);
+
+assert.sameValue(
+ C[String(await 9)],
+ 9
+);
+assert.sameValue(
+ C[String(await 9)] = 9,
+ 9
+);
+
+} catch (e) {
+ $DONE(e);
+}
+$DONE();
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-condition-expression-false.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-condition-expression-false.js
new file mode 100644
index 0000000000..0e4a243c48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-condition-expression-false.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-condition-expression-false.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [false ? 1 : 2]() {
+ return 1;
+ }
+
+ set [false ? 1 : 2](v) {
+ return 1;
+ }
+
+ static get [false ? 1 : 2]() {
+ return 1;
+ }
+
+ static set [false ? 1 : 2](v) {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[false ? 1 : 2],
+ 1
+);
+assert.sameValue(
+ c[false ? 1 : 2] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[false ? 1 : 2],
+ 1
+);
+assert.sameValue(
+ C[false ? 1 : 2] = 1,
+ 1
+);
+assert.sameValue(
+ c[String(false ? 1 : 2)],
+ 1
+);
+assert.sameValue(
+ c[String(false ? 1 : 2)] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[String(false ? 1 : 2)],
+ 1
+);
+assert.sameValue(
+ C[String(false ? 1 : 2)] = 1,
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-condition-expression-true.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-condition-expression-true.js
new file mode 100644
index 0000000000..95837e2f4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-condition-expression-true.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-condition-expression-true.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [true ? 1 : 2]() {
+ return 2;
+ }
+
+ set [true ? 1 : 2](v) {
+ return 2;
+ }
+
+ static get [true ? 1 : 2]() {
+ return 2;
+ }
+
+ static set [true ? 1 : 2](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[true ? 1 : 2],
+ 2
+);
+assert.sameValue(
+ c[true ? 1 : 2] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[true ? 1 : 2],
+ 2
+);
+assert.sameValue(
+ C[true ? 1 : 2] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(true ? 1 : 2)],
+ 2
+);
+assert.sameValue(
+ c[String(true ? 1 : 2)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(true ? 1 : 2)],
+ 2
+);
+assert.sameValue(
+ C[String(true ? 1 : 2)] = 2,
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-decimal-e-notational-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-decimal-e-notational-literal.js
new file mode 100644
index 0000000000..775ad6ec7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-decimal-e-notational-literal.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-decimal-e-notational-literal.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from decimal e notational literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1.e1]() {
+ return 2;
+ }
+
+ set [1.e1](v) {
+ return 2;
+ }
+
+ static get [1.e1]() {
+ return 2;
+ }
+
+ static set [1.e1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1.e1],
+ 2
+);
+assert.sameValue(
+ c[1.e1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[1.e1],
+ 2
+);
+assert.sameValue(
+ C[1.e1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(1.e1)],
+ 2
+);
+assert.sameValue(
+ c[String(1.e1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(1.e1)],
+ 2
+);
+assert.sameValue(
+ C[String(1.e1)] = 2,
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-decimal-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-decimal-literal.js
new file mode 100644
index 0000000000..94171ec027
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-decimal-literal.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-decimal-literal.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from decimal literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1.1]() {
+ return 2;
+ }
+
+ set [1.1](v) {
+ return 2;
+ }
+
+ static get [1.1]() {
+ return 2;
+ }
+
+ static set [1.1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1.1],
+ 2
+);
+assert.sameValue(
+ c[1.1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[1.1],
+ 2
+);
+assert.sameValue(
+ C[1.1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(1.1)],
+ 2
+);
+assert.sameValue(
+ c[String(1.1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(1.1)],
+ 2
+);
+assert.sameValue(
+ C[String(1.1)] = 2,
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-exponetiation-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-exponetiation-expression.js
new file mode 100644
index 0000000000..a90ad74977
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-exponetiation-expression.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-exponetiation-expression.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from exponentiation expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, exponentiation]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [2 ** 2]() {
+ return 4;
+ }
+
+ set [2 ** 2](v) {
+ return 4;
+ }
+
+ static get [2 ** 2]() {
+ return 4;
+ }
+
+ static set [2 ** 2](v) {
+ return 4;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[2 ** 2],
+ 4
+);
+assert.sameValue(
+ c[2 ** 2] = 4,
+ 4
+);
+
+assert.sameValue(
+ C[2 ** 2],
+ 4
+);
+assert.sameValue(
+ C[2 ** 2] = 4,
+ 4
+);
+assert.sameValue(
+ c[String(2 ** 2)],
+ 4
+);
+assert.sameValue(
+ c[String(2 ** 2)] = 4,
+ 4
+);
+
+assert.sameValue(
+ C[String(2 ** 2)],
+ 4
+);
+assert.sameValue(
+ C[String(2 ** 2)] = 4,
+ 4
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-coalesce.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-coalesce.js
new file mode 100644
index 0000000000..3df04c728b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-coalesce.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-coalesce.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from coalesce (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x;
+
+
+class C {
+ get [x ?? 1]() {
+ return 2;
+ }
+
+ set [x ?? 1](v) {
+ return 2;
+ }
+
+ static get [x ?? 1]() {
+ return 2;
+ }
+
+ static set [x ?? 1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ?? 1],
+ 2
+);
+assert.sameValue(
+ c[x ?? 1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[x ?? 1],
+ 2
+);
+assert.sameValue(
+ C[x ?? 1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(x ?? 1)],
+ 2
+);
+assert.sameValue(
+ c[String(x ?? 1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(x ?? 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x ?? 1)] = 2,
+ 2
+);
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-logical-and.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-logical-and.js
new file mode 100644
index 0000000000..24a267a167
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-logical-and.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-logical-and.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from logical and (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ get [x && 1]() {
+ return 2;
+ }
+
+ set [x && 1](v) {
+ return 2;
+ }
+
+ static get [x && 1]() {
+ return 2;
+ }
+
+ static set [x && 1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x && 1],
+ 2
+);
+assert.sameValue(
+ c[x && 1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[x && 1],
+ 2
+);
+assert.sameValue(
+ C[x && 1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(x && 1)],
+ 2
+);
+assert.sameValue(
+ c[String(x && 1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(x && 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x && 1)] = 2,
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-logical-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-logical-or.js
new file mode 100644
index 0000000000..98866bc591
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-expression-logical-or.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-logical-or.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from logical or (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ get [x || 1]() {
+ return 2;
+ }
+
+ set [x || 1](v) {
+ return 2;
+ }
+
+ static get [x || 1]() {
+ return 2;
+ }
+
+ static set [x || 1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x || 1],
+ 2
+);
+assert.sameValue(
+ c[x || 1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[x || 1],
+ 2
+);
+assert.sameValue(
+ C[x || 1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(x || 1)],
+ 2
+);
+assert.sameValue(
+ c[String(x || 1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(x || 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x || 1)] = 2,
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-function-declaration.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-function-declaration.js
new file mode 100644
index 0000000000..e97802248c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-function-declaration.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-function-declaration.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from function (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function f() {}
+
+
+class C {
+ get [f()]() {
+ return 1;
+ }
+
+ set [f()](v) {
+ return 1;
+ }
+
+ static get [f()]() {
+ return 1;
+ }
+
+ static set [f()](v) {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[f()],
+ 1
+);
+assert.sameValue(
+ c[f()] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[f()],
+ 1
+);
+assert.sameValue(
+ C[f()] = 1,
+ 1
+);
+assert.sameValue(
+ c[String(f())],
+ 1
+);
+assert.sameValue(
+ c[String(f())] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[String(f())],
+ 1
+);
+assert.sameValue(
+ C[String(f())] = 1,
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-function-expression.js
new file mode 100644
index 0000000000..0d63210a14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-function-expression.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from function expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [function () {}]() {
+ return 1;
+ }
+
+ set [function () {}](v) {
+ return 1;
+ }
+
+ static get [function () {}]() {
+ return 1;
+ }
+
+ static set [function () {}](v) {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[function () {}],
+ 1
+);
+assert.sameValue(
+ c[function () {}] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[function () {}],
+ 1
+);
+assert.sameValue(
+ C[function () {}] = 1,
+ 1
+);
+assert.sameValue(
+ c[String(function () {})],
+ 1
+);
+assert.sameValue(
+ c[String(function () {})] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[String(function () {})],
+ 1
+);
+assert.sameValue(
+ C[String(function () {})] = 1,
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-generator-function-declaration.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-generator-function-declaration.js
new file mode 100644
index 0000000000..4cbe0999b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-generator-function-declaration.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from generator function (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function * g() { return 1; }
+
+
+class C {
+ get [g()]() {
+ return 1;
+ }
+
+ set [g()](v) {
+ return 1;
+ }
+
+ static get [g()]() {
+ return 1;
+ }
+
+ static set [g()](v) {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[g()],
+ 1
+);
+assert.sameValue(
+ c[g()] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[g()],
+ 1
+);
+assert.sameValue(
+ C[g()] = 1,
+ 1
+);
+assert.sameValue(
+ c[String(g())],
+ 1
+);
+assert.sameValue(
+ c[String(g())] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[String(g())],
+ 1
+);
+assert.sameValue(
+ C[String(g())] = 1,
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-identifier.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-identifier.js
new file mode 100644
index 0000000000..147cb9176f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-identifier.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-identifier.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from string literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 1;
+
+
+
+class C {
+ get [x]() {
+ return '2';
+ }
+
+ set [x](v) {
+ return '2';
+ }
+
+ static get [x]() {
+ return '2';
+ }
+
+ static set [x](v) {
+ return '2';
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x],
+ '2'
+);
+assert.sameValue(
+ c[x] = '2',
+ '2'
+);
+
+assert.sameValue(
+ C[x],
+ '2'
+);
+assert.sameValue(
+ C[x] = '2',
+ '2'
+);
+assert.sameValue(
+ c[String(x)],
+ '2'
+);
+assert.sameValue(
+ c[String(x)] = '2',
+ '2'
+);
+
+assert.sameValue(
+ C[String(x)],
+ '2'
+);
+assert.sameValue(
+ C[String(x)] = '2',
+ '2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-integer-e-notational-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-integer-e-notational-literal.js
new file mode 100644
index 0000000000..bedc60dc61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-integer-e-notational-literal.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-integer-e-notational-literal.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from numeric literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1]() {
+ return 2;
+ }
+
+ set [1](v) {
+ return 2;
+ }
+
+ static get [1]() {
+ return 2;
+ }
+
+ static set [1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1],
+ 2
+);
+assert.sameValue(
+ c[1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[1],
+ 2
+);
+assert.sameValue(
+ C[1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(1)],
+ 2
+);
+assert.sameValue(
+ c[String(1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(1)],
+ 2
+);
+assert.sameValue(
+ C[String(1)] = 2,
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-integer-separators.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-integer-separators.js
new file mode 100644
index 0000000000..22d12be97c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-integer-separators.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-integer-separators.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from integer with separators (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1_2_3_4_5_6_7_8]() {
+ return 1_2_3_4_5_6_7_8;
+ }
+
+ set [1_2_3_4_5_6_7_8](v) {
+ return 1_2_3_4_5_6_7_8;
+ }
+
+ static get [1_2_3_4_5_6_7_8]() {
+ return 1_2_3_4_5_6_7_8;
+ }
+
+ static set [1_2_3_4_5_6_7_8](v) {
+ return 1_2_3_4_5_6_7_8;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1_2_3_4_5_6_7_8],
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ c[1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8,
+ 1_2_3_4_5_6_7_8
+);
+
+assert.sameValue(
+ C[1_2_3_4_5_6_7_8],
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ C[1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8,
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ c[String(1_2_3_4_5_6_7_8)],
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ c[String(1_2_3_4_5_6_7_8)] = 1_2_3_4_5_6_7_8,
+ 1_2_3_4_5_6_7_8
+);
+
+assert.sameValue(
+ C[String(1_2_3_4_5_6_7_8)],
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ C[String(1_2_3_4_5_6_7_8)] = 1_2_3_4_5_6_7_8,
+ 1_2_3_4_5_6_7_8
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-math.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-math.js
new file mode 100644
index 0000000000..aae0475f47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-math.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-math.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from math (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, exponentiation]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1 + 2 - 3 * 4 / 5 ** 6]() {
+ return 2.999232;
+ }
+
+ set [1 + 2 - 3 * 4 / 5 ** 6](v) {
+ return 2.999232;
+ }
+
+ static get [1 + 2 - 3 * 4 / 5 ** 6]() {
+ return 2.999232;
+ }
+
+ static set [1 + 2 - 3 * 4 / 5 ** 6](v) {
+ return 2.999232;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 + 2 - 3 * 4 / 5 ** 6],
+ 2.999232
+);
+assert.sameValue(
+ c[1 + 2 - 3 * 4 / 5 ** 6] = 2.999232,
+ 2.999232
+);
+
+assert.sameValue(
+ C[1 + 2 - 3 * 4 / 5 ** 6],
+ 2.999232
+);
+assert.sameValue(
+ C[1 + 2 - 3 * 4 / 5 ** 6] = 2.999232,
+ 2.999232
+);
+assert.sameValue(
+ c[String(1 + 2 - 3 * 4 / 5 ** 6)],
+ 2.999232
+);
+assert.sameValue(
+ c[String(1 + 2 - 3 * 4 / 5 ** 6)] = 2.999232,
+ 2.999232
+);
+
+assert.sameValue(
+ C[String(1 + 2 - 3 * 4 / 5 ** 6)],
+ 2.999232
+);
+assert.sameValue(
+ C[String(1 + 2 - 3 * 4 / 5 ** 6)] = 2.999232,
+ 2.999232
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-multiplicative-expression-div.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-multiplicative-expression-div.js
new file mode 100644
index 0000000000..9d5acec131
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-multiplicative-expression-div.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-multiplicative-expression-div.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from multiplicative expression "divide" (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1 / 1]() {
+ return 1;
+ }
+
+ set [1 / 1](v) {
+ return 1;
+ }
+
+ static get [1 / 1]() {
+ return 1;
+ }
+
+ static set [1 / 1](v) {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 / 1],
+ 1
+);
+assert.sameValue(
+ c[1 / 1] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[1 / 1],
+ 1
+);
+assert.sameValue(
+ C[1 / 1] = 1,
+ 1
+);
+assert.sameValue(
+ c[String(1 / 1)],
+ 1
+);
+assert.sameValue(
+ c[String(1 / 1)] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[String(1 / 1)],
+ 1
+);
+assert.sameValue(
+ C[String(1 / 1)] = 1,
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-multiplicative-expression-mult.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-multiplicative-expression-mult.js
new file mode 100644
index 0000000000..174dd1cd91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-multiplicative-expression-mult.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1 * 1]() {
+ return 1;
+ }
+
+ set [1 * 1](v) {
+ return 1;
+ }
+
+ static get [1 * 1]() {
+ return 1;
+ }
+
+ static set [1 * 1](v) {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 * 1],
+ 1
+);
+assert.sameValue(
+ c[1 * 1] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[1 * 1],
+ 1
+);
+assert.sameValue(
+ C[1 * 1] = 1,
+ 1
+);
+assert.sameValue(
+ c[String(1 * 1)],
+ 1
+);
+assert.sameValue(
+ c[String(1 * 1)] = 1,
+ 1
+);
+
+assert.sameValue(
+ C[String(1 * 1)],
+ 1
+);
+assert.sameValue(
+ C[String(1 * 1)] = 1,
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-null.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-null.js
new file mode 100644
index 0000000000..9c2ff4f83e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-null.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-null.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [null]() {
+ return null;
+ }
+
+ set [null](v) {
+ return null;
+ }
+
+ static get [null]() {
+ return null;
+ }
+
+ static set [null](v) {
+ return null;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[null],
+ null
+);
+assert.sameValue(
+ c[null] = null,
+ null
+);
+
+assert.sameValue(
+ C[null],
+ null
+);
+assert.sameValue(
+ C[null] = null,
+ null
+);
+assert.sameValue(
+ c[String(null)],
+ null
+);
+assert.sameValue(
+ c[String(null)] = null,
+ null
+);
+
+assert.sameValue(
+ C[String(null)],
+ null
+);
+assert.sameValue(
+ C[String(null)] = null,
+ null
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-numeric-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-numeric-literal.js
new file mode 100644
index 0000000000..60255b701f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-numeric-literal.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-numeric-literal.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from numeric literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get [1]() {
+ return 2;
+ }
+
+ set [1](v) {
+ return 2;
+ }
+
+ static get [1]() {
+ return 2;
+ }
+
+ static set [1](v) {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1],
+ 2
+);
+assert.sameValue(
+ c[1] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[1],
+ 2
+);
+assert.sameValue(
+ C[1] = 2,
+ 2
+);
+assert.sameValue(
+ c[String(1)],
+ 2
+);
+assert.sameValue(
+ c[String(1)] = 2,
+ 2
+);
+
+assert.sameValue(
+ C[String(1)],
+ 2
+);
+assert.sameValue(
+ C[String(1)] = 2,
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-string-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-string-literal.js
new file mode 100644
index 0000000000..f12c05f7dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-string-literal.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-string-literal.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from string literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ get ['1']() {
+ return '2';
+ }
+
+ set ['1'](v) {
+ return '2';
+ }
+
+ static get ['1']() {
+ return '2';
+ }
+
+ static set ['1'](v) {
+ return '2';
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c['1'],
+ '2'
+);
+assert.sameValue(
+ c['1'] = '2',
+ '2'
+);
+
+assert.sameValue(
+ C['1'],
+ '2'
+);
+assert.sameValue(
+ C['1'] = '2',
+ '2'
+);
+assert.sameValue(
+ c[String('1')],
+ '2'
+);
+assert.sameValue(
+ c[String('1')] = '2',
+ '2'
+);
+
+assert.sameValue(
+ C[String('1')],
+ '2'
+);
+assert.sameValue(
+ C[String('1')] = '2',
+ '2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-yield-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-yield-expression.js
new file mode 100644
index 0000000000..c3b76eb7c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-accessors-computed-property-name-from-yield-expression.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-yield-expression.case
+// - src/computed-property-names/evaluation/class-declaration-accessors.template
+/*---
+description: Computed property name from yield expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function * g() {
+
+
+class C {
+ get [yield 9]() {
+ return 9;
+ }
+
+ set [yield 9](v) {
+ return 9;
+ }
+
+ static get [yield 9]() {
+ return 9;
+ }
+
+ static set [yield 9](v) {
+ return 9;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[yield 9],
+ 9
+);
+assert.sameValue(
+ c[yield 9] = 9,
+ 9
+);
+
+assert.sameValue(
+ C[yield 9],
+ 9
+);
+assert.sameValue(
+ C[yield 9] = 9,
+ 9
+);
+assert.sameValue(
+ c[String(yield 9)],
+ 9
+);
+assert.sameValue(
+ c[String(yield 9)] = 9,
+ 9
+);
+
+assert.sameValue(
+ C[String(yield 9)],
+ 9
+);
+assert.sameValue(
+ C[String(yield 9)] = 9,
+ 9
+);
+
+}
+var iter = g();
+while (iter.next().done === false) ;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-additive-expression-add.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-additive-expression-add.js
new file mode 100644
index 0000000000..57a374324e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-additive-expression-add.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-additive-expression-add.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from additive expression "add" (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1 + 1]() {
+ return 2;
+ }
+ static [1 + 1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 + 1](),
+ 2
+);
+assert.sameValue(
+ C[1 + 1](),
+ 2
+);
+assert.sameValue(
+ c[String(1 + 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1 + 1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-additive-expression-subtract.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-additive-expression-subtract.js
new file mode 100644
index 0000000000..ec491a4fd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-additive-expression-subtract.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-additive-expression-subtract.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from additive expression "subtract" (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1 - 1]() {
+ return 0;
+ }
+ static [1 - 1]() {
+ return 0;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 - 1](),
+ 0
+);
+assert.sameValue(
+ C[1 - 1](),
+ 0
+);
+assert.sameValue(
+ c[String(1 - 1)](),
+ 0
+);
+assert.sameValue(
+ C[String(1 - 1)](),
+ 0
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-arrow-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-arrow-function-expression.js
new file mode 100644
index 0000000000..e583c3d74b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-arrow-function-expression.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-arrow-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from arrow function (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [() => { }]() {
+ return 1;
+ }
+ static [() => { }]() {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[() => { }](),
+ 1
+);
+assert.sameValue(
+ C[() => { }](),
+ 1
+);
+assert.sameValue(
+ c[String(() => { })](),
+ 1
+);
+assert.sameValue(
+ C[String(() => { })](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-assignment.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-assignment.js
new file mode 100644
index 0000000000..85bc1dfd24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-assignment.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from assignment expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ [x = 1]() {
+ return 2;
+ }
+ static [x = 1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x = 1](),
+ 2
+);
+assert.sameValue(
+ C[x = 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x = 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x = 1)](),
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-bitwise-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-bitwise-or.js
new file mode 100644
index 0000000000..b5f4a9aeca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-bitwise-or.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-bitwise-or.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from assignment expression bitwise or (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ [x |= 1]() {
+ return 2;
+ }
+ static [x |= 1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x |= 1](),
+ 2
+);
+assert.sameValue(
+ C[x |= 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x |= 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x |= 1)](),
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-coalesce.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-coalesce.js
new file mode 100644
index 0000000000..07ef956289
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-coalesce.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from assignment expression coalesce (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = null;
+
+
+class C {
+ [x ??= 1]() {
+ return 2;
+ }
+ static [x ??= 1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ??= 1](),
+ 2
+);
+assert.sameValue(
+ C[x ??= 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x ??= 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x ??= 1)](),
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-logical-and.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-logical-and.js
new file mode 100644
index 0000000000..a3e1d17fb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-logical-and.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-and.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from assignment expression logical and (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ [x &&= 1]() {
+ return 2;
+ }
+ static [x &&= 1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x &&= 1](),
+ 2
+);
+assert.sameValue(
+ C[x &&= 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x &&= 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x &&= 1)](),
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-logical-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-logical-or.js
new file mode 100644
index 0000000000..86ad101180
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-assignment-expression-logical-or.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-or.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from assignment expression logical or (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ [x ||= 1]() {
+ return 2;
+ }
+ static [x ||= 1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ||= 1](),
+ 2
+);
+assert.sameValue(
+ C[x ||= 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x ||= 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x ||= 1)](),
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-async-arrow-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-async-arrow-function-expression.js
new file mode 100644
index 0000000000..0579c324dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-async-arrow-function-expression.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-async-arrow-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from function expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [async () => {}]() {
+ return 1;
+ }
+ static [async () => {}]() {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[async () => {}](),
+ 1
+);
+assert.sameValue(
+ C[async () => {}](),
+ 1
+);
+assert.sameValue(
+ c[String(async () => {})](),
+ 1
+);
+assert.sameValue(
+ C[String(async () => {})](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-await-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-await-expression.js
new file mode 100644
index 0000000000..a38011aa2e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-await-expression.js
@@ -0,0 +1,71 @@
+// |reftest| module async
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-await-expression.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, top-level-await]
+flags: [generated, async, module]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+try {
+
+
+class C {
+ [await 9]() {
+ return 9;
+ }
+ static [await 9]() {
+ return 9;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[await 9](),
+ 9
+);
+assert.sameValue(
+ C[await 9](),
+ 9
+);
+assert.sameValue(
+ c[String(await 9)](),
+ 9
+);
+assert.sameValue(
+ C[String(await 9)](),
+ 9
+);
+
+} catch (e) {
+ $DONE(e);
+}
+$DONE();
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-condition-expression-false.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-condition-expression-false.js
new file mode 100644
index 0000000000..f4715db2c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-condition-expression-false.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-condition-expression-false.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [false ? 1 : 2]() {
+ return 1;
+ }
+ static [false ? 1 : 2]() {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[false ? 1 : 2](),
+ 1
+);
+assert.sameValue(
+ C[false ? 1 : 2](),
+ 1
+);
+assert.sameValue(
+ c[String(false ? 1 : 2)](),
+ 1
+);
+assert.sameValue(
+ C[String(false ? 1 : 2)](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-condition-expression-true.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-condition-expression-true.js
new file mode 100644
index 0000000000..889e80a7a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-condition-expression-true.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-condition-expression-true.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [true ? 1 : 2]() {
+ return 2;
+ }
+ static [true ? 1 : 2]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[true ? 1 : 2](),
+ 2
+);
+assert.sameValue(
+ C[true ? 1 : 2](),
+ 2
+);
+assert.sameValue(
+ c[String(true ? 1 : 2)](),
+ 2
+);
+assert.sameValue(
+ C[String(true ? 1 : 2)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-decimal-e-notational-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-decimal-e-notational-literal.js
new file mode 100644
index 0000000000..fcfcad1e75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-decimal-e-notational-literal.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-decimal-e-notational-literal.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from decimal e notational literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1.e1]() {
+ return 2;
+ }
+ static [1.e1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1.e1](),
+ 2
+);
+assert.sameValue(
+ C[1.e1](),
+ 2
+);
+assert.sameValue(
+ c[String(1.e1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1.e1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-decimal-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-decimal-literal.js
new file mode 100644
index 0000000000..554345d4f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-decimal-literal.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-decimal-literal.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from decimal literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1.1]() {
+ return 2;
+ }
+ static [1.1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1.1](),
+ 2
+);
+assert.sameValue(
+ C[1.1](),
+ 2
+);
+assert.sameValue(
+ c[String(1.1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1.1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-exponetiation-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-exponetiation-expression.js
new file mode 100644
index 0000000000..ac090d918c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-exponetiation-expression.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-exponetiation-expression.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from exponentiation expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, exponentiation]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [2 ** 2]() {
+ return 4;
+ }
+ static [2 ** 2]() {
+ return 4;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[2 ** 2](),
+ 4
+);
+assert.sameValue(
+ C[2 ** 2](),
+ 4
+);
+assert.sameValue(
+ c[String(2 ** 2)](),
+ 4
+);
+assert.sameValue(
+ C[String(2 ** 2)](),
+ 4
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-coalesce.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-coalesce.js
new file mode 100644
index 0000000000..ac6cafbecb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-coalesce.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-coalesce.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from coalesce (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x;
+
+
+class C {
+ [x ?? 1]() {
+ return 2;
+ }
+ static [x ?? 1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ?? 1](),
+ 2
+);
+assert.sameValue(
+ C[x ?? 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x ?? 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x ?? 1)](),
+ 2
+);
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-logical-and.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-logical-and.js
new file mode 100644
index 0000000000..f66cf31eef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-logical-and.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-logical-and.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from logical and (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ [x && 1]() {
+ return 2;
+ }
+ static [x && 1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x && 1](),
+ 2
+);
+assert.sameValue(
+ C[x && 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x && 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x && 1)](),
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-logical-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-logical-or.js
new file mode 100644
index 0000000000..a25598f806
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-expression-logical-or.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-logical-or.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from logical or (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+class C {
+ [x || 1]() {
+ return 2;
+ }
+ static [x || 1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x || 1](),
+ 2
+);
+assert.sameValue(
+ C[x || 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x || 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x || 1)](),
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-function-declaration.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-function-declaration.js
new file mode 100644
index 0000000000..fb7d91ad3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-function-declaration.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-function-declaration.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from function (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function f() {}
+
+
+class C {
+ [f()]() {
+ return 1;
+ }
+ static [f()]() {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[f()](),
+ 1
+);
+assert.sameValue(
+ C[f()](),
+ 1
+);
+assert.sameValue(
+ c[String(f())](),
+ 1
+);
+assert.sameValue(
+ C[String(f())](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-function-expression.js
new file mode 100644
index 0000000000..96da957346
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-function-expression.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from function expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [function () {}]() {
+ return 1;
+ }
+ static [function () {}]() {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[function () {}](),
+ 1
+);
+assert.sameValue(
+ C[function () {}](),
+ 1
+);
+assert.sameValue(
+ c[String(function () {})](),
+ 1
+);
+assert.sameValue(
+ C[String(function () {})](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-generator-function-declaration.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-generator-function-declaration.js
new file mode 100644
index 0000000000..977e2b510e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-generator-function-declaration.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from generator function (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function * g() { return 1; }
+
+
+class C {
+ [g()]() {
+ return 1;
+ }
+ static [g()]() {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[g()](),
+ 1
+);
+assert.sameValue(
+ C[g()](),
+ 1
+);
+assert.sameValue(
+ c[String(g())](),
+ 1
+);
+assert.sameValue(
+ C[String(g())](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-identifier.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-identifier.js
new file mode 100644
index 0000000000..a10cb61e94
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-identifier.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-identifier.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from string literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 1;
+
+
+
+class C {
+ [x]() {
+ return '2';
+ }
+ static [x]() {
+ return '2';
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x](),
+ '2'
+);
+assert.sameValue(
+ C[x](),
+ '2'
+);
+assert.sameValue(
+ c[String(x)](),
+ '2'
+);
+assert.sameValue(
+ C[String(x)](),
+ '2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-integer-e-notational-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-integer-e-notational-literal.js
new file mode 100644
index 0000000000..452d9c3a11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-integer-e-notational-literal.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-integer-e-notational-literal.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from numeric literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1]() {
+ return 2;
+ }
+ static [1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1](),
+ 2
+);
+assert.sameValue(
+ C[1](),
+ 2
+);
+assert.sameValue(
+ c[String(1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-integer-separators.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-integer-separators.js
new file mode 100644
index 0000000000..44aa87db00
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-integer-separators.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-integer-separators.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from integer with separators (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1_2_3_4_5_6_7_8]() {
+ return 1_2_3_4_5_6_7_8;
+ }
+ static [1_2_3_4_5_6_7_8]() {
+ return 1_2_3_4_5_6_7_8;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1_2_3_4_5_6_7_8](),
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ C[1_2_3_4_5_6_7_8](),
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ c[String(1_2_3_4_5_6_7_8)](),
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ C[String(1_2_3_4_5_6_7_8)](),
+ 1_2_3_4_5_6_7_8
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-math.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-math.js
new file mode 100644
index 0000000000..e146251c4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-math.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-math.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from math (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, exponentiation]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1 + 2 - 3 * 4 / 5 ** 6]() {
+ return 2.999232;
+ }
+ static [1 + 2 - 3 * 4 / 5 ** 6]() {
+ return 2.999232;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 + 2 - 3 * 4 / 5 ** 6](),
+ 2.999232
+);
+assert.sameValue(
+ C[1 + 2 - 3 * 4 / 5 ** 6](),
+ 2.999232
+);
+assert.sameValue(
+ c[String(1 + 2 - 3 * 4 / 5 ** 6)](),
+ 2.999232
+);
+assert.sameValue(
+ C[String(1 + 2 - 3 * 4 / 5 ** 6)](),
+ 2.999232
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-multiplicative-expression-div.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-multiplicative-expression-div.js
new file mode 100644
index 0000000000..0d26171ee7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-multiplicative-expression-div.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-multiplicative-expression-div.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from multiplicative expression "divide" (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1 / 1]() {
+ return 1;
+ }
+ static [1 / 1]() {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 / 1](),
+ 1
+);
+assert.sameValue(
+ C[1 / 1](),
+ 1
+);
+assert.sameValue(
+ c[String(1 / 1)](),
+ 1
+);
+assert.sameValue(
+ C[String(1 / 1)](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-multiplicative-expression-mult.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-multiplicative-expression-mult.js
new file mode 100644
index 0000000000..f95ec64b93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-multiplicative-expression-mult.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1 * 1]() {
+ return 1;
+ }
+ static [1 * 1]() {
+ return 1;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 * 1](),
+ 1
+);
+assert.sameValue(
+ C[1 * 1](),
+ 1
+);
+assert.sameValue(
+ c[String(1 * 1)](),
+ 1
+);
+assert.sameValue(
+ C[String(1 * 1)](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-null.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-null.js
new file mode 100644
index 0000000000..ea49134f50
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-null.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-null.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [null]() {
+ return null;
+ }
+ static [null]() {
+ return null;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[null](),
+ null
+);
+assert.sameValue(
+ C[null](),
+ null
+);
+assert.sameValue(
+ c[String(null)](),
+ null
+);
+assert.sameValue(
+ C[String(null)](),
+ null
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-numeric-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-numeric-literal.js
new file mode 100644
index 0000000000..cda6602bc7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-numeric-literal.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-numeric-literal.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from numeric literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ [1]() {
+ return 2;
+ }
+ static [1]() {
+ return 2;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1](),
+ 2
+);
+assert.sameValue(
+ C[1](),
+ 2
+);
+assert.sameValue(
+ c[String(1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-string-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-string-literal.js
new file mode 100644
index 0000000000..09c7f5ce57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-string-literal.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-string-literal.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from string literal (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+class C {
+ ['1']() {
+ return '2';
+ }
+ static ['1']() {
+ return '2';
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c['1'](),
+ '2'
+);
+assert.sameValue(
+ C['1'](),
+ '2'
+);
+assert.sameValue(
+ c[String('1')](),
+ '2'
+);
+assert.sameValue(
+ C[String('1')](),
+ '2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-yield-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-yield-expression.js
new file mode 100644
index 0000000000..3ad6aa530a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-computed-property-name-from-yield-expression.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-yield-expression.case
+// - src/computed-property-names/evaluation/class-declaration.template
+/*---
+description: Computed property name from yield expression (ComputedPropertyName in ClassDeclaration)
+esid: prod-ComputedPropertyName
+features: [computed-property-names]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function * g() {
+
+
+class C {
+ [yield 9]() {
+ return 9;
+ }
+ static [yield 9]() {
+ return 9;
+ }
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[yield 9](),
+ 9
+);
+assert.sameValue(
+ C[yield 9](),
+ 9
+);
+assert.sameValue(
+ c[String(yield 9)](),
+ 9
+);
+assert.sameValue(
+ C[String(yield 9)](),
+ 9
+);
+
+}
+var iter = g();
+while (iter.next().done === false) ;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-additive-expression-add.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-additive-expression-add.js
new file mode 100644
index 0000000000..ea6ffb3850
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-additive-expression-add.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-additive-expression-add.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from additive expression "add" (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 + 1] = 2;
+
+ static [1 + 1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 + 1],
+ 2
+);
+assert.sameValue(
+ C[1 + 1],
+ 2
+);
+assert.sameValue(
+ c[String(1 + 1)],
+ 2
+);
+assert.sameValue(
+ C[String(1 + 1)],
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-additive-expression-subtract.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-additive-expression-subtract.js
new file mode 100644
index 0000000000..98eef5ec8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-additive-expression-subtract.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-additive-expression-subtract.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from additive expression "subtract" (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 - 1] = 0;
+
+ static [1 - 1] = 0;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 - 1],
+ 0
+);
+assert.sameValue(
+ C[1 - 1],
+ 0
+);
+assert.sameValue(
+ c[String(1 - 1)],
+ 0
+);
+assert.sameValue(
+ C[String(1 - 1)],
+ 0
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-arrow-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-arrow-function-expression.js
new file mode 100644
index 0000000000..7a295dd4eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-arrow-function-expression.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-arrow-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from arrow function (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [() => { }] = 1;
+
+ static [() => { }] = 1;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[() => { }],
+ 1
+);
+assert.sameValue(
+ C[() => { }],
+ 1
+);
+assert.sameValue(
+ c[String(() => { })],
+ 1
+);
+assert.sameValue(
+ C[String(() => { })],
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-assignment.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-assignment.js
new file mode 100644
index 0000000000..bb04fb5d34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-assignment.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from assignment expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x = 1] = 2;
+
+ static [x = 1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x = 1],
+ 2
+);
+assert.sameValue(
+ C[x = 1],
+ 2
+);
+assert.sameValue(
+ c[String(x = 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x = 1)],
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-bitwise-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-bitwise-or.js
new file mode 100644
index 0000000000..736ca0d344
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-bitwise-or.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-bitwise-or.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from assignment expression bitwise or (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x |= 1] = 2;
+
+ static [x |= 1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x |= 1],
+ 2
+);
+assert.sameValue(
+ C[x |= 1],
+ 2
+);
+assert.sameValue(
+ c[String(x |= 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x |= 1)],
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-coalesce.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-coalesce.js
new file mode 100644
index 0000000000..1c726926e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-coalesce.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from assignment expression coalesce (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = null;
+
+
+let C = class {
+ [x ??= 1] = 2;
+
+ static [x ??= 1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ??= 1],
+ 2
+);
+assert.sameValue(
+ C[x ??= 1],
+ 2
+);
+assert.sameValue(
+ c[String(x ??= 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x ??= 1)],
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-logical-and.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-logical-and.js
new file mode 100644
index 0000000000..692d88d7b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-logical-and.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-and.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from assignment expression logical and (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x &&= 1] = 2;
+
+ static [x &&= 1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x &&= 1],
+ 2
+);
+assert.sameValue(
+ C[x &&= 1],
+ 2
+);
+assert.sameValue(
+ c[String(x &&= 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x &&= 1)],
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-logical-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-logical-or.js
new file mode 100644
index 0000000000..a92aa655b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-assignment-expression-logical-or.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-or.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from assignment expression logical or (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x ||= 1] = 2;
+
+ static [x ||= 1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ||= 1],
+ 2
+);
+assert.sameValue(
+ C[x ||= 1],
+ 2
+);
+assert.sameValue(
+ c[String(x ||= 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x ||= 1)],
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-async-arrow-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-async-arrow-function-expression.js
new file mode 100644
index 0000000000..2b28a7eddd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-async-arrow-function-expression.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-async-arrow-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from function expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [async () => {}] = 1;
+
+ static [async () => {}] = 1;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[async () => {}],
+ 1
+);
+assert.sameValue(
+ C[async () => {}],
+ 1
+);
+assert.sameValue(
+ c[String(async () => {})],
+ 1
+);
+assert.sameValue(
+ C[String(async () => {})],
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-await-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-await-expression.js
new file mode 100644
index 0000000000..25ef78cae5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-await-expression.js
@@ -0,0 +1,68 @@
+// |reftest| module async
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-await-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, top-level-await, class-fields-public, class-static-fields-public]
+flags: [generated, async, module]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+try {
+
+
+let C = class {
+ [await 9] = 9;
+
+ static [await 9] = 9;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[await 9],
+ 9
+);
+assert.sameValue(
+ C[await 9],
+ 9
+);
+assert.sameValue(
+ c[String(await 9)],
+ 9
+);
+assert.sameValue(
+ C[String(await 9)],
+ 9
+);
+
+} catch (e) {
+ $DONE(e);
+}
+$DONE();
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-condition-expression-false.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-condition-expression-false.js
new file mode 100644
index 0000000000..e03c8b7f89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-condition-expression-false.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-condition-expression-false.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [false ? 1 : 2] = 1;
+
+ static [false ? 1 : 2] = 1;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[false ? 1 : 2],
+ 1
+);
+assert.sameValue(
+ C[false ? 1 : 2],
+ 1
+);
+assert.sameValue(
+ c[String(false ? 1 : 2)],
+ 1
+);
+assert.sameValue(
+ C[String(false ? 1 : 2)],
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-condition-expression-true.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-condition-expression-true.js
new file mode 100644
index 0000000000..ad0ab90036
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-condition-expression-true.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-condition-expression-true.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [true ? 1 : 2] = 2;
+
+ static [true ? 1 : 2] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[true ? 1 : 2],
+ 2
+);
+assert.sameValue(
+ C[true ? 1 : 2],
+ 2
+);
+assert.sameValue(
+ c[String(true ? 1 : 2)],
+ 2
+);
+assert.sameValue(
+ C[String(true ? 1 : 2)],
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-decimal-e-notational-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-decimal-e-notational-literal.js
new file mode 100644
index 0000000000..8c2c102ea3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-decimal-e-notational-literal.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-decimal-e-notational-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from decimal e notational literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1.e1] = 2;
+
+ static [1.e1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1.e1],
+ 2
+);
+assert.sameValue(
+ C[1.e1],
+ 2
+);
+assert.sameValue(
+ c[String(1.e1)],
+ 2
+);
+assert.sameValue(
+ C[String(1.e1)],
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-decimal-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-decimal-literal.js
new file mode 100644
index 0000000000..661b7f5fd4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-decimal-literal.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-decimal-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from decimal literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1.1] = 2;
+
+ static [1.1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1.1],
+ 2
+);
+assert.sameValue(
+ C[1.1],
+ 2
+);
+assert.sameValue(
+ c[String(1.1)],
+ 2
+);
+assert.sameValue(
+ C[String(1.1)],
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-exponetiation-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-exponetiation-expression.js
new file mode 100644
index 0000000000..3e8f3e6018
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-exponetiation-expression.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-exponetiation-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from exponentiation expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, exponentiation, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [2 ** 2] = 4;
+
+ static [2 ** 2] = 4;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[2 ** 2],
+ 4
+);
+assert.sameValue(
+ C[2 ** 2],
+ 4
+);
+assert.sameValue(
+ c[String(2 ** 2)],
+ 4
+);
+assert.sameValue(
+ C[String(2 ** 2)],
+ 4
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-coalesce.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-coalesce.js
new file mode 100644
index 0000000000..e8fd6d9cac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-coalesce.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-coalesce.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from coalesce (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x;
+
+
+let C = class {
+ [x ?? 1] = 2;
+
+ static [x ?? 1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ?? 1],
+ 2
+);
+assert.sameValue(
+ C[x ?? 1],
+ 2
+);
+assert.sameValue(
+ c[String(x ?? 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x ?? 1)],
+ 2
+);
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-logical-and.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-logical-and.js
new file mode 100644
index 0000000000..12d8b5a909
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-logical-and.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-logical-and.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from logical and (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x && 1] = 2;
+
+ static [x && 1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x && 1],
+ 2
+);
+assert.sameValue(
+ C[x && 1],
+ 2
+);
+assert.sameValue(
+ c[String(x && 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x && 1)],
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-logical-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-logical-or.js
new file mode 100644
index 0000000000..8e8bfc82aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-expression-logical-or.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-logical-or.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from logical or (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x || 1] = 2;
+
+ static [x || 1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x || 1],
+ 2
+);
+assert.sameValue(
+ C[x || 1],
+ 2
+);
+assert.sameValue(
+ c[String(x || 1)],
+ 2
+);
+assert.sameValue(
+ C[String(x || 1)],
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-function-declaration.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-function-declaration.js
new file mode 100644
index 0000000000..aeeb9adbc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-function-declaration.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-function-declaration.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from function (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function f() {}
+
+
+let C = class {
+ [f()] = 1;
+
+ static [f()] = 1;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[f()],
+ 1
+);
+assert.sameValue(
+ C[f()],
+ 1
+);
+assert.sameValue(
+ c[String(f())],
+ 1
+);
+assert.sameValue(
+ C[String(f())],
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-function-expression.js
new file mode 100644
index 0000000000..9eaea1afdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-function-expression.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from function expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [function () {}] = 1;
+
+ static [function () {}] = 1;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[function () {}],
+ 1
+);
+assert.sameValue(
+ C[function () {}],
+ 1
+);
+assert.sameValue(
+ c[String(function () {})],
+ 1
+);
+assert.sameValue(
+ C[String(function () {})],
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-generator-function-declaration.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-generator-function-declaration.js
new file mode 100644
index 0000000000..35ff6866b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-generator-function-declaration.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from generator function (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function * g() { return 1; }
+
+
+let C = class {
+ [g()] = 1;
+
+ static [g()] = 1;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[g()],
+ 1
+);
+assert.sameValue(
+ C[g()],
+ 1
+);
+assert.sameValue(
+ c[String(g())],
+ 1
+);
+assert.sameValue(
+ C[String(g())],
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-identifier.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-identifier.js
new file mode 100644
index 0000000000..2d39292d1b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-identifier.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-identifier.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from string literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 1;
+
+
+
+let C = class {
+ [x] = '2';
+
+ static [x] = '2';
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x],
+ '2'
+);
+assert.sameValue(
+ C[x],
+ '2'
+);
+assert.sameValue(
+ c[String(x)],
+ '2'
+);
+assert.sameValue(
+ C[String(x)],
+ '2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-integer-e-notational-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-integer-e-notational-literal.js
new file mode 100644
index 0000000000..a8696e07cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-integer-e-notational-literal.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-integer-e-notational-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1] = 2;
+
+ static [1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1],
+ 2
+);
+assert.sameValue(
+ C[1],
+ 2
+);
+assert.sameValue(
+ c[String(1)],
+ 2
+);
+assert.sameValue(
+ C[String(1)],
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-integer-separators.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-integer-separators.js
new file mode 100644
index 0000000000..012230a62e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-integer-separators.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-integer-separators.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from integer with separators (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8;
+
+ static [1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1_2_3_4_5_6_7_8],
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ C[1_2_3_4_5_6_7_8],
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ c[String(1_2_3_4_5_6_7_8)],
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ C[String(1_2_3_4_5_6_7_8)],
+ 1_2_3_4_5_6_7_8
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-math.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-math.js
new file mode 100644
index 0000000000..b506f576fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-math.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-math.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from math (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, exponentiation, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 + 2 - 3 * 4 / 5 ** 6] = 2.999232;
+
+ static [1 + 2 - 3 * 4 / 5 ** 6] = 2.999232;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 + 2 - 3 * 4 / 5 ** 6],
+ 2.999232
+);
+assert.sameValue(
+ C[1 + 2 - 3 * 4 / 5 ** 6],
+ 2.999232
+);
+assert.sameValue(
+ c[String(1 + 2 - 3 * 4 / 5 ** 6)],
+ 2.999232
+);
+assert.sameValue(
+ C[String(1 + 2 - 3 * 4 / 5 ** 6)],
+ 2.999232
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-multiplicative-expression-div.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-multiplicative-expression-div.js
new file mode 100644
index 0000000000..7a779fca7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-multiplicative-expression-div.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-multiplicative-expression-div.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from multiplicative expression "divide" (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 / 1] = 1;
+
+ static [1 / 1] = 1;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 / 1],
+ 1
+);
+assert.sameValue(
+ C[1 / 1],
+ 1
+);
+assert.sameValue(
+ c[String(1 / 1)],
+ 1
+);
+assert.sameValue(
+ C[String(1 / 1)],
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-multiplicative-expression-mult.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-multiplicative-expression-mult.js
new file mode 100644
index 0000000000..25ee51bee9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-multiplicative-expression-mult.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 * 1] = 1;
+
+ static [1 * 1] = 1;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 * 1],
+ 1
+);
+assert.sameValue(
+ C[1 * 1],
+ 1
+);
+assert.sameValue(
+ c[String(1 * 1)],
+ 1
+);
+assert.sameValue(
+ C[String(1 * 1)],
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-null.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-null.js
new file mode 100644
index 0000000000..50b533c9d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-null.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-null.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [null] = null;
+
+ static [null] = null;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[null],
+ null
+);
+assert.sameValue(
+ C[null],
+ null
+);
+assert.sameValue(
+ c[String(null)],
+ null
+);
+assert.sameValue(
+ C[String(null)],
+ null
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-numeric-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-numeric-literal.js
new file mode 100644
index 0000000000..2f66cd4384
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-numeric-literal.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-numeric-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1] = 2;
+
+ static [1] = 2;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1],
+ 2
+);
+assert.sameValue(
+ C[1],
+ 2
+);
+assert.sameValue(
+ c[String(1)],
+ 2
+);
+assert.sameValue(
+ C[String(1)],
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-string-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-string-literal.js
new file mode 100644
index 0000000000..d3e613bed3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-string-literal.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-string-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from string literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ ['1'] = '2';
+
+ static ['1'] = '2';
+};
+
+let c = new C();
+
+assert.sameValue(
+ c['1'],
+ '2'
+);
+assert.sameValue(
+ C['1'],
+ '2'
+);
+assert.sameValue(
+ c[String('1')],
+ '2'
+);
+assert.sameValue(
+ C[String('1')],
+ '2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-yield-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-yield-expression.js
new file mode 100644
index 0000000000..b48c6f884c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-computed-property-name-from-yield-expression.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-yield-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields.template
+/*---
+description: Computed property name from yield expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function * g() {
+
+
+let C = class {
+ [yield 9] = 9;
+
+ static [yield 9] = 9;
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[yield 9],
+ 9
+);
+assert.sameValue(
+ C[yield 9],
+ 9
+);
+assert.sameValue(
+ c[String(yield 9)],
+ 9
+);
+assert.sameValue(
+ C[String(yield 9)],
+ 9
+);
+
+}
+var iter = g();
+while (iter.next().done === false) ;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-additive-expression-add.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-additive-expression-add.js
new file mode 100644
index 0000000000..71eec0118a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-additive-expression-add.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-additive-expression-add.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from additive expression "add" (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 + 1] = () => {
+ return 2;
+ };
+
+ static [1 + 1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 + 1](),
+ 2
+);
+assert.sameValue(
+ C[1 + 1](),
+ 2
+);
+assert.sameValue(
+ c[String(1 + 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1 + 1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-additive-expression-subtract.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-additive-expression-subtract.js
new file mode 100644
index 0000000000..97dbdbf6e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-additive-expression-subtract.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-additive-expression-subtract.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from additive expression "subtract" (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 - 1] = () => {
+ return 0;
+ };
+
+ static [1 - 1] = () => {
+ return 0;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 - 1](),
+ 0
+);
+assert.sameValue(
+ C[1 - 1](),
+ 0
+);
+assert.sameValue(
+ c[String(1 - 1)](),
+ 0
+);
+assert.sameValue(
+ C[String(1 - 1)](),
+ 0
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-arrow-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-arrow-function-expression.js
new file mode 100644
index 0000000000..c0c57223a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-arrow-function-expression.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-arrow-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from arrow function (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [() => { }] = () => {
+ return 1;
+ };
+
+ static [() => { }] = () => {
+ return 1;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[() => { }](),
+ 1
+);
+assert.sameValue(
+ C[() => { }](),
+ 1
+);
+assert.sameValue(
+ c[String(() => { })](),
+ 1
+);
+assert.sameValue(
+ C[String(() => { })](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-assignment.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-assignment.js
new file mode 100644
index 0000000000..d5724dedda
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-assignment.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from assignment expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x = 1] = () => {
+ return 2;
+ };
+
+ static [x = 1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x = 1](),
+ 2
+);
+assert.sameValue(
+ C[x = 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x = 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x = 1)](),
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-bitwise-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-bitwise-or.js
new file mode 100644
index 0000000000..0363c3513d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-bitwise-or.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-bitwise-or.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from assignment expression bitwise or (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x |= 1] = () => {
+ return 2;
+ };
+
+ static [x |= 1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x |= 1](),
+ 2
+);
+assert.sameValue(
+ C[x |= 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x |= 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x |= 1)](),
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-coalesce.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-coalesce.js
new file mode 100644
index 0000000000..3dee6a5629
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-coalesce.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from assignment expression coalesce (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = null;
+
+
+let C = class {
+ [x ??= 1] = () => {
+ return 2;
+ };
+
+ static [x ??= 1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ??= 1](),
+ 2
+);
+assert.sameValue(
+ C[x ??= 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x ??= 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x ??= 1)](),
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-logical-and.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-logical-and.js
new file mode 100644
index 0000000000..f2299078af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-logical-and.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-and.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from assignment expression logical and (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x &&= 1] = () => {
+ return 2;
+ };
+
+ static [x &&= 1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x &&= 1](),
+ 2
+);
+assert.sameValue(
+ C[x &&= 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x &&= 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x &&= 1)](),
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-logical-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-logical-or.js
new file mode 100644
index 0000000000..bad6dbd0aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-assignment-expression-logical-or.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-or.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from assignment expression logical or (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x ||= 1] = () => {
+ return 2;
+ };
+
+ static [x ||= 1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ||= 1](),
+ 2
+);
+assert.sameValue(
+ C[x ||= 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x ||= 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x ||= 1)](),
+ 2
+);
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-async-arrow-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-async-arrow-function-expression.js
new file mode 100644
index 0000000000..1205a426ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-async-arrow-function-expression.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-async-arrow-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from function expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [async () => {}] = () => {
+ return 1;
+ };
+
+ static [async () => {}] = () => {
+ return 1;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[async () => {}](),
+ 1
+);
+assert.sameValue(
+ C[async () => {}](),
+ 1
+);
+assert.sameValue(
+ c[String(async () => {})](),
+ 1
+);
+assert.sameValue(
+ C[String(async () => {})](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-await-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-await-expression.js
new file mode 100644
index 0000000000..195a54bafc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-await-expression.js
@@ -0,0 +1,72 @@
+// |reftest| module async
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-await-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, top-level-await, class-fields-public, class-static-fields-public]
+flags: [generated, async, module]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+try {
+
+
+let C = class {
+ [await 9] = () => {
+ return 9;
+ };
+
+ static [await 9] = () => {
+ return 9;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[await 9](),
+ 9
+);
+assert.sameValue(
+ C[await 9](),
+ 9
+);
+assert.sameValue(
+ c[String(await 9)](),
+ 9
+);
+assert.sameValue(
+ C[String(await 9)](),
+ 9
+);
+
+} catch (e) {
+ $DONE(e);
+}
+$DONE();
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-condition-expression-false.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-condition-expression-false.js
new file mode 100644
index 0000000000..bd79d94e1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-condition-expression-false.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-condition-expression-false.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [false ? 1 : 2] = () => {
+ return 1;
+ };
+
+ static [false ? 1 : 2] = () => {
+ return 1;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[false ? 1 : 2](),
+ 1
+);
+assert.sameValue(
+ C[false ? 1 : 2](),
+ 1
+);
+assert.sameValue(
+ c[String(false ? 1 : 2)](),
+ 1
+);
+assert.sameValue(
+ C[String(false ? 1 : 2)](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-condition-expression-true.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-condition-expression-true.js
new file mode 100644
index 0000000000..ebab97ae18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-condition-expression-true.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-condition-expression-true.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [true ? 1 : 2] = () => {
+ return 2;
+ };
+
+ static [true ? 1 : 2] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[true ? 1 : 2](),
+ 2
+);
+assert.sameValue(
+ C[true ? 1 : 2](),
+ 2
+);
+assert.sameValue(
+ c[String(true ? 1 : 2)](),
+ 2
+);
+assert.sameValue(
+ C[String(true ? 1 : 2)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-decimal-e-notational-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-decimal-e-notational-literal.js
new file mode 100644
index 0000000000..3f58d25b79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-decimal-e-notational-literal.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-decimal-e-notational-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from decimal e notational literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1.e1] = () => {
+ return 2;
+ };
+
+ static [1.e1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1.e1](),
+ 2
+);
+assert.sameValue(
+ C[1.e1](),
+ 2
+);
+assert.sameValue(
+ c[String(1.e1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1.e1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-decimal-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-decimal-literal.js
new file mode 100644
index 0000000000..3d97072386
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-decimal-literal.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-decimal-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from decimal literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1.1] = () => {
+ return 2;
+ };
+
+ static [1.1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1.1](),
+ 2
+);
+assert.sameValue(
+ C[1.1](),
+ 2
+);
+assert.sameValue(
+ c[String(1.1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1.1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-exponetiation-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-exponetiation-expression.js
new file mode 100644
index 0000000000..524720575e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-exponetiation-expression.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-exponetiation-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from exponentiation expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, exponentiation, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [2 ** 2] = () => {
+ return 4;
+ };
+
+ static [2 ** 2] = () => {
+ return 4;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[2 ** 2](),
+ 4
+);
+assert.sameValue(
+ C[2 ** 2](),
+ 4
+);
+assert.sameValue(
+ c[String(2 ** 2)](),
+ 4
+);
+assert.sameValue(
+ C[String(2 ** 2)](),
+ 4
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-coalesce.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-coalesce.js
new file mode 100644
index 0000000000..a7cf9a1929
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-coalesce.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-coalesce.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from coalesce (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x;
+
+
+let C = class {
+ [x ?? 1] = () => {
+ return 2;
+ };
+
+ static [x ?? 1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x ?? 1](),
+ 2
+);
+assert.sameValue(
+ C[x ?? 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x ?? 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x ?? 1)](),
+ 2
+);
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-logical-and.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-logical-and.js
new file mode 100644
index 0000000000..5c4ba7c819
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-logical-and.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-logical-and.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from logical and (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x && 1] = () => {
+ return 2;
+ };
+
+ static [x && 1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x && 1](),
+ 2
+);
+assert.sameValue(
+ C[x && 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x && 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x && 1)](),
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-logical-or.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-logical-or.js
new file mode 100644
index 0000000000..0f960760fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-expression-logical-or.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-expression-logical-or.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from logical or (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 0;
+
+
+let C = class {
+ [x || 1] = () => {
+ return 2;
+ };
+
+ static [x || 1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x || 1](),
+ 2
+);
+assert.sameValue(
+ C[x || 1](),
+ 2
+);
+assert.sameValue(
+ c[String(x || 1)](),
+ 2
+);
+assert.sameValue(
+ C[String(x || 1)](),
+ 2
+);
+
+assert.sameValue(x, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-function-declaration.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-function-declaration.js
new file mode 100644
index 0000000000..27d7dcd92d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-function-declaration.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-function-declaration.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from function (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function f() {}
+
+
+let C = class {
+ [f()] = () => {
+ return 1;
+ };
+
+ static [f()] = () => {
+ return 1;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[f()](),
+ 1
+);
+assert.sameValue(
+ C[f()](),
+ 1
+);
+assert.sameValue(
+ c[String(f())](),
+ 1
+);
+assert.sameValue(
+ C[String(f())](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-function-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-function-expression.js
new file mode 100644
index 0000000000..087ffd71fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-function-expression.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-function-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from function expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [function () {}] = () => {
+ return 1;
+ };
+
+ static [function () {}] = () => {
+ return 1;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[function () {}](),
+ 1
+);
+assert.sameValue(
+ C[function () {}](),
+ 1
+);
+assert.sameValue(
+ c[String(function () {})](),
+ 1
+);
+assert.sameValue(
+ C[String(function () {})](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-generator-function-declaration.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-generator-function-declaration.js
new file mode 100644
index 0000000000..cee833fe26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-generator-function-declaration.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from generator function (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function * g() { return 1; }
+
+
+let C = class {
+ [g()] = () => {
+ return 1;
+ };
+
+ static [g()] = () => {
+ return 1;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[g()](),
+ 1
+);
+assert.sameValue(
+ C[g()](),
+ 1
+);
+assert.sameValue(
+ c[String(g())](),
+ 1
+);
+assert.sameValue(
+ C[String(g())](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-identifier.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-identifier.js
new file mode 100644
index 0000000000..5fed37d68f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-identifier.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-identifier.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from string literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+let x = 1;
+
+
+
+let C = class {
+ [x] = () => {
+ return '2';
+ };
+
+ static [x] = () => {
+ return '2';
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[x](),
+ '2'
+);
+assert.sameValue(
+ C[x](),
+ '2'
+);
+assert.sameValue(
+ c[String(x)](),
+ '2'
+);
+assert.sameValue(
+ C[String(x)](),
+ '2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-integer-e-notational-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-integer-e-notational-literal.js
new file mode 100644
index 0000000000..40eb283d21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-integer-e-notational-literal.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-integer-e-notational-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1] = () => {
+ return 2;
+ };
+
+ static [1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1](),
+ 2
+);
+assert.sameValue(
+ C[1](),
+ 2
+);
+assert.sameValue(
+ c[String(1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-integer-separators.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-integer-separators.js
new file mode 100644
index 0000000000..1683c8839f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-integer-separators.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-integer-separators.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from integer with separators (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1_2_3_4_5_6_7_8] = () => {
+ return 1_2_3_4_5_6_7_8;
+ };
+
+ static [1_2_3_4_5_6_7_8] = () => {
+ return 1_2_3_4_5_6_7_8;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1_2_3_4_5_6_7_8](),
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ C[1_2_3_4_5_6_7_8](),
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ c[String(1_2_3_4_5_6_7_8)](),
+ 1_2_3_4_5_6_7_8
+);
+assert.sameValue(
+ C[String(1_2_3_4_5_6_7_8)](),
+ 1_2_3_4_5_6_7_8
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-math.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-math.js
new file mode 100644
index 0000000000..a2c3cd15f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-math.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-math.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from math (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, exponentiation, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 + 2 - 3 * 4 / 5 ** 6] = () => {
+ return 2.999232;
+ };
+
+ static [1 + 2 - 3 * 4 / 5 ** 6] = () => {
+ return 2.999232;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 + 2 - 3 * 4 / 5 ** 6](),
+ 2.999232
+);
+assert.sameValue(
+ C[1 + 2 - 3 * 4 / 5 ** 6](),
+ 2.999232
+);
+assert.sameValue(
+ c[String(1 + 2 - 3 * 4 / 5 ** 6)](),
+ 2.999232
+);
+assert.sameValue(
+ C[String(1 + 2 - 3 * 4 / 5 ** 6)](),
+ 2.999232
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-multiplicative-expression-div.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-multiplicative-expression-div.js
new file mode 100644
index 0000000000..60660f747c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-multiplicative-expression-div.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-multiplicative-expression-div.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from multiplicative expression "divide" (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 / 1] = () => {
+ return 1;
+ };
+
+ static [1 / 1] = () => {
+ return 1;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 / 1](),
+ 1
+);
+assert.sameValue(
+ C[1 / 1](),
+ 1
+);
+assert.sameValue(
+ c[String(1 / 1)](),
+ 1
+);
+assert.sameValue(
+ C[String(1 / 1)](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-multiplicative-expression-mult.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-multiplicative-expression-mult.js
new file mode 100644
index 0000000000..40a2ae3d4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-multiplicative-expression-mult.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1 * 1] = () => {
+ return 1;
+ };
+
+ static [1 * 1] = () => {
+ return 1;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1 * 1](),
+ 1
+);
+assert.sameValue(
+ C[1 * 1](),
+ 1
+);
+assert.sameValue(
+ c[String(1 * 1)](),
+ 1
+);
+assert.sameValue(
+ C[String(1 * 1)](),
+ 1
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-null.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-null.js
new file mode 100644
index 0000000000..10fd20ff21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-null.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-null.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from condition expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [null] = () => {
+ return null;
+ };
+
+ static [null] = () => {
+ return null;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[null](),
+ null
+);
+assert.sameValue(
+ C[null](),
+ null
+);
+assert.sameValue(
+ c[String(null)](),
+ null
+);
+assert.sameValue(
+ C[String(null)](),
+ null
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-numeric-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-numeric-literal.js
new file mode 100644
index 0000000000..64cb221ce7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-numeric-literal.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-numeric-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ [1] = () => {
+ return 2;
+ };
+
+ static [1] = () => {
+ return 2;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[1](),
+ 2
+);
+assert.sameValue(
+ C[1](),
+ 2
+);
+assert.sameValue(
+ c[String(1)](),
+ 2
+);
+assert.sameValue(
+ C[String(1)](),
+ 2
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-string-literal.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-string-literal.js
new file mode 100644
index 0000000000..a12c751807
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-string-literal.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-string-literal.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from string literal (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+
+
+let C = class {
+ ['1'] = () => {
+ return '2';
+ };
+
+ static ['1'] = () => {
+ return '2';
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c['1'](),
+ '2'
+);
+assert.sameValue(
+ C['1'](),
+ '2'
+);
+assert.sameValue(
+ c[String('1')](),
+ '2'
+);
+assert.sameValue(
+ C[String('1')](),
+ '2'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-yield-expression.js b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-yield-expression.js
new file mode 100644
index 0000000000..24ab16a2c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-yield-expression.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/computed-property-names/computed-property-name-from-yield-expression.case
+// - src/computed-property-names/evaluation/class-declaration-fields-methods.template
+/*---
+description: Computed property name from yield expression (ComputedPropertyName in ClassExpression)
+esid: prod-ComputedPropertyName
+features: [computed-property-names, class-fields-public, class-static-fields-public]
+flags: [generated]
+info: |
+ ClassExpression:
+ classBindingIdentifier opt ClassTail
+
+ ClassTail:
+ ClassHeritage opt { ClassBody opt }
+
+ ClassBody:
+ ClassElementList
+
+ ClassElementList:
+ ClassElement
+
+ ClassElement:
+ MethodDefinition
+
+ MethodDefinition:
+ PropertyName ...
+ get PropertyName ...
+ set PropertyName ...
+
+ PropertyName:
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+---*/
+function * g() {
+
+
+let C = class {
+ [yield 9] = () => {
+ return 9;
+ };
+
+ static [yield 9] = () => {
+ return 9;
+ };
+};
+
+let c = new C();
+
+assert.sameValue(
+ c[yield 9](),
+ 9
+);
+assert.sameValue(
+ C[yield 9](),
+ 9
+);
+assert.sameValue(
+ c[String(yield 9)](),
+ 9
+);
+assert.sameValue(
+ C[String(yield 9)](),
+ 9
+);
+
+}
+var iter = g();
+while (iter.next().done === false) ;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/cptn-decl.js b/js/src/tests/test262/language/statements/class/cptn-decl.js
new file mode 100644
index 0000000000..f3beb693c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/cptn-decl.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2017 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-runtime-semantics-evaluation
+description: Class declaration completion value is empty.
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Perform ? BindingClassDeclarationEvaluation of this ClassDeclaration.
+ 2. Return NormalCompletion(empty).
+---*/
+
+assert.sameValue(eval('class C {}'), undefined);
+assert.sameValue(eval('1; class C {}'), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/browser.js b/js/src/tests/test262/language/statements/class/decorator/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/browser.js
diff --git a/js/src/tests/test262/language/statements/class/decorator/shell.js b/js/src/tests/test262/language/statements/class/decorator/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/shell.js
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/browser.js b/js/src/tests/test262/language/statements/class/decorator/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/browser.js
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/browser.js b/js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/browser.js
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/decorator-member-expr-private-identifier.js b/js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/decorator-member-expr-private-identifier.js
new file mode 100644
index 0000000000..11587354a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/decorator-member-expr-private-identifier.js
@@ -0,0 +1,57 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-member-expr-private-identifier.case
+// - src/decorator/syntax/class-valid/cls-decl-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class declaration in class body.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated]
+info: |
+ ClassDeclaration[Yield, Await, Default] :
+ DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] DecoratorList[?Yield, ?Await]opt class ClassTail[?Yield, ?Await]
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ DecoratorMemberExpression[Yield, Await] :
+ PrivateIdentifier
+
+ PrivateIdentifier ::
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #$() {}
+ static #_() {}
+ static #\u{6F}() {}
+ static #\u2118() {}
+ static #ZW_\u200C_NJ() {}
+ static #ZW_\u200D_J() {}
+ static #yield() {}
+ static #await() {}
+
+ static {
+ @#$
+ @#_
+ @#\u{6F}
+ @#\u2118
+ @#ZW_\u200C_NJ
+ @#ZW_\u200D_J
+ @#yield
+ @#await class C {}
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/shell.js b/js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/class-valid/shell.js
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/shell.js b/js/src/tests/test262/language/statements/class/decorator/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/shell.js
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/browser.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/browser.js
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-call-expr-identifier-reference.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-call-expr-identifier-reference.js
new file mode 100644
index 0000000000..b50802ba42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-call-expr-identifier-reference.js
@@ -0,0 +1,88 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-call-expr-identifier-reference.case
+// - src/decorator/syntax/valid/cls-element-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorCallExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated]
+info: |
+ ClassElement[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt MethodDefinition[?Yield, ?Await]
+ DecoratorList[?Yield, ?Await]opt static MethodDefinition[?Yield, ?Await]
+ DecoratorList[?Yield, ?Await]opt FieldDefinition[?Yield, ?Await] ;
+ DecoratorList[?Yield, ?Await]opt static FieldDefinition[?Yield, ?Await] ;
+ ClassStaticBlock
+ ;
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ DecoratorCallExpression[Yield, Await] :
+ DecoratorMemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+ DecoratorMemberExpression[Yield, Await] :
+ IdentifierReference[?Yield, ?Await]
+ PrivateIdentifier
+ DecoratorMemberExpression[?Yield, ?Await] . IdentifierName
+
+ IdentifierReference[Yield, Await] :
+ Identifier
+ [~Yield] yield
+ [~Await] await
+
+---*/
+function decorator() {
+ return () => {};
+}
+var $ = decorator;
+var _ = decorator;
+var \u{6F} = decorator;
+var \u2118 = decorator;
+var ZW_\u200C_NJ = decorator;
+var ZW_\u200D_J = decorator;
+var await = decorator;
+
+
+
+class C {
+ @$()
+ @_()
+ @\u{6F}()
+ @\u2118()
+ @ZW_\u200C_NJ()
+ @ZW_\u200D_J()
+ @await() method() {}
+ @$()
+ @_()
+ @\u{6F}()
+ @\u2118()
+ @ZW_\u200C_NJ()
+ @ZW_\u200D_J()
+ @await() static method() {}
+ @$()
+ @_()
+ @\u{6F}()
+ @\u2118()
+ @ZW_\u200C_NJ()
+ @ZW_\u200D_J()
+ @await() field;
+ @$()
+ @_()
+ @\u{6F}()
+ @\u2118()
+ @ZW_\u200C_NJ()
+ @ZW_\u200D_J()
+ @await() static field;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-member-expr-decorator-member-expr.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-member-expr-decorator-member-expr.js
new file mode 100644
index 0000000000..38db55bc84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-member-expr-decorator-member-expr.js
@@ -0,0 +1,84 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-member-expr-decorator-member-expr.case
+// - src/decorator/syntax/valid/cls-element-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated]
+info: |
+ ClassElement[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt MethodDefinition[?Yield, ?Await]
+ DecoratorList[?Yield, ?Await]opt static MethodDefinition[?Yield, ?Await]
+ DecoratorList[?Yield, ?Await]opt FieldDefinition[?Yield, ?Await] ;
+ DecoratorList[?Yield, ?Await]opt static FieldDefinition[?Yield, ?Await] ;
+ ClassStaticBlock
+ ;
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ DecoratorMemberExpression[Yield, Await] :
+ IdentifierReference[?Yield, ?Await]
+ PrivateIdentifier
+ DecoratorMemberExpression[?Yield, ?Await] . IdentifierName
+
+---*/
+let ns = {
+ $() {},
+ _() {},
+ \u{6F}() {},
+ \u2118() {},
+ ZW_\u200C_NJ() {},
+ ZW_\u200D_J() {},
+ yield() {},
+ await() {},
+}
+
+
+
+class C {
+ @ns.$
+ @ns._
+ @ns.\u{6F}
+ @ns.\u2118
+ @ns.ZW_\u200C_NJ
+ @ns.ZW_\u200D_J
+ @ns.yield
+ @ns.await method() {}
+ @ns.$
+ @ns._
+ @ns.\u{6F}
+ @ns.\u2118
+ @ns.ZW_\u200C_NJ
+ @ns.ZW_\u200D_J
+ @ns.yield
+ @ns.await static method() {}
+ @ns.$
+ @ns._
+ @ns.\u{6F}
+ @ns.\u2118
+ @ns.ZW_\u200C_NJ
+ @ns.ZW_\u200D_J
+ @ns.yield
+ @ns.await field;
+ @ns.$
+ @ns._
+ @ns.\u{6F}
+ @ns.\u2118
+ @ns.ZW_\u200C_NJ
+ @ns.ZW_\u200D_J
+ @ns.yield
+ @ns.await static field;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-member-expr-identifier-reference.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-member-expr-identifier-reference.js
new file mode 100644
index 0000000000..468d3e2b2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-member-expr-identifier-reference.js
@@ -0,0 +1,77 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-member-expr-identifier-reference.case
+// - src/decorator/syntax/valid/cls-element-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated]
+info: |
+ ClassElement[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt MethodDefinition[?Yield, ?Await]
+ DecoratorList[?Yield, ?Await]opt static MethodDefinition[?Yield, ?Await]
+ DecoratorList[?Yield, ?Await]opt FieldDefinition[?Yield, ?Await] ;
+ DecoratorList[?Yield, ?Await]opt static FieldDefinition[?Yield, ?Await] ;
+ ClassStaticBlock
+ ;
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ IdentifierReference[Yield, Await] :
+ Identifier
+ [~Yield] yield
+ [~Await] await
+
+---*/
+function $() {}
+function _() {}
+function \u{6F}() {}
+function \u2118() {}
+function ZW_\u200C_NJ() {}
+function ZW_\u200D_J() {}
+function await() {}
+
+
+
+class C {
+ @$
+ @_
+ @\u{6F}
+ @\u2118
+ @ZW_\u200C_NJ
+ @ZW_\u200D_J
+ @await method() {}
+ @$
+ @_
+ @\u{6F}
+ @\u2118
+ @ZW_\u200C_NJ
+ @ZW_\u200D_J
+ @await static method() {}
+ @$
+ @_
+ @\u{6F}
+ @\u2118
+ @ZW_\u200C_NJ
+ @ZW_\u200D_J
+ @await field;
+ @$
+ @_
+ @\u{6F}
+ @\u2118
+ @ZW_\u200C_NJ
+ @ZW_\u200D_J
+ @await static field;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-parenthesized-expr-identifier-reference.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-parenthesized-expr-identifier-reference.js
new file mode 100644
index 0000000000..8acb98f1c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/class-element-decorator-parenthesized-expr-identifier-reference.js
@@ -0,0 +1,90 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-parenthesized-expr-identifier-reference.case
+// - src/decorator/syntax/valid/cls-element-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorParenthesizedExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated]
+info: |
+ ClassElement[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt MethodDefinition[?Yield, ?Await]
+ DecoratorList[?Yield, ?Await]opt static MethodDefinition[?Yield, ?Await]
+ DecoratorList[?Yield, ?Await]opt FieldDefinition[?Yield, ?Await] ;
+ DecoratorList[?Yield, ?Await]opt static FieldDefinition[?Yield, ?Await] ;
+ ClassStaticBlock
+ ;
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ DecoratorParenthesizedExpression[Yield, Await] :
+ ( Expression[+In, ?Yield, ?Await] )
+
+ PrimaryExpression[Yield, Await] :
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+function $() {}
+function _() {}
+function \u{6F}() {}
+function \u2118() {}
+function ZW_\u200C_NJ() {}
+function ZW_\u200D_J() {}
+function await() {}
+
+
+
+class C {
+ @($)
+ @(_)
+ @(\u{6F})
+ @(\u2118)
+ @(ZW_\u200C_NJ)
+ @(ZW_\u200D_J)
+ @(await) method() {}
+ @($)
+ @(_)
+ @(\u{6F})
+ @(\u2118)
+ @(ZW_\u200C_NJ)
+ @(ZW_\u200D_J)
+ @(await) static method() {}
+ @($)
+ @(_)
+ @(\u{6F})
+ @(\u2118)
+ @(ZW_\u200C_NJ)
+ @(ZW_\u200D_J)
+ @(await) field;
+ @($)
+ @(_)
+ @(\u{6F})
+ @(\u2118)
+ @(ZW_\u200C_NJ)
+ @(ZW_\u200D_J)
+ @(await) static field;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-call-expr-identifier-reference-yield.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-call-expr-identifier-reference-yield.js
new file mode 100644
index 0000000000..f86f894f1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-call-expr-identifier-reference-yield.js
@@ -0,0 +1,48 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-call-expr-identifier-reference-yield.case
+// - src/decorator/syntax/valid/cls-decl-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorCallExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration[Yield, Await, Default] :
+ DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] DecoratorList[?Yield, ?Await]opt class ClassTail[?Yield, ?Await]
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ DecoratorCallExpression[Yield, Await] :
+ DecoratorMemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+ DecoratorMemberExpression[Yield, Await] :
+ IdentifierReference[?Yield, ?Await]
+ PrivateIdentifier
+ DecoratorMemberExpression[?Yield, ?Await] . IdentifierName
+
+ IdentifierReference[Yield, Await] :
+ [~Yield] yield
+ ...
+
+---*/
+function decorator() {
+ return () => {};
+}
+var yield = decorator;
+
+
+
+@yield() class C {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-call-expr-identifier-reference.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-call-expr-identifier-reference.js
new file mode 100644
index 0000000000..217747833b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-call-expr-identifier-reference.js
@@ -0,0 +1,61 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-call-expr-identifier-reference.case
+// - src/decorator/syntax/valid/cls-decl-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorCallExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated]
+info: |
+ ClassDeclaration[Yield, Await, Default] :
+ DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] DecoratorList[?Yield, ?Await]opt class ClassTail[?Yield, ?Await]
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ DecoratorCallExpression[Yield, Await] :
+ DecoratorMemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+ DecoratorMemberExpression[Yield, Await] :
+ IdentifierReference[?Yield, ?Await]
+ PrivateIdentifier
+ DecoratorMemberExpression[?Yield, ?Await] . IdentifierName
+
+ IdentifierReference[Yield, Await] :
+ Identifier
+ [~Yield] yield
+ [~Await] await
+
+---*/
+function decorator() {
+ return () => {};
+}
+var $ = decorator;
+var _ = decorator;
+var \u{6F} = decorator;
+var \u2118 = decorator;
+var ZW_\u200C_NJ = decorator;
+var ZW_\u200D_J = decorator;
+var await = decorator;
+
+
+
+@$()
+@_()
+@\u{6F}()
+@\u2118()
+@ZW_\u200C_NJ()
+@ZW_\u200D_J()
+@await() class C {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-decorator-member-expr.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-decorator-member-expr.js
new file mode 100644
index 0000000000..ce38509819
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-decorator-member-expr.js
@@ -0,0 +1,54 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-member-expr-decorator-member-expr.case
+// - src/decorator/syntax/valid/cls-decl-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated]
+info: |
+ ClassDeclaration[Yield, Await, Default] :
+ DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] DecoratorList[?Yield, ?Await]opt class ClassTail[?Yield, ?Await]
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ DecoratorMemberExpression[Yield, Await] :
+ IdentifierReference[?Yield, ?Await]
+ PrivateIdentifier
+ DecoratorMemberExpression[?Yield, ?Await] . IdentifierName
+
+---*/
+let ns = {
+ $() {},
+ _() {},
+ \u{6F}() {},
+ \u2118() {},
+ ZW_\u200C_NJ() {},
+ ZW_\u200D_J() {},
+ yield() {},
+ await() {},
+}
+
+
+
+@ns.$
+@ns._
+@ns.\u{6F}
+@ns.\u2118
+@ns.ZW_\u200C_NJ
+@ns.ZW_\u200D_J
+@ns.yield
+@ns.await class C {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-identifier-reference-yield.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-identifier-reference-yield.js
new file mode 100644
index 0000000000..216d97d4ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-identifier-reference-yield.js
@@ -0,0 +1,37 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-member-expr-identifier-reference-yield.case
+// - src/decorator/syntax/valid/cls-decl-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration[Yield, Await, Default] :
+ DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] DecoratorList[?Yield, ?Await]opt class ClassTail[?Yield, ?Await]
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ IdentifierReference[Yield, Await] :
+ [~Yield] yield
+ ...
+
+---*/
+function yield() {}
+
+
+
+@yield class C {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-identifier-reference.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-identifier-reference.js
new file mode 100644
index 0000000000..e77cec62dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-member-expr-identifier-reference.js
@@ -0,0 +1,50 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-member-expr-identifier-reference.case
+// - src/decorator/syntax/valid/cls-decl-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated]
+info: |
+ ClassDeclaration[Yield, Await, Default] :
+ DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] DecoratorList[?Yield, ?Await]opt class ClassTail[?Yield, ?Await]
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ IdentifierReference[Yield, Await] :
+ Identifier
+ [~Yield] yield
+ [~Await] await
+
+---*/
+function $() {}
+function _() {}
+function \u{6F}() {}
+function \u2118() {}
+function ZW_\u200C_NJ() {}
+function ZW_\u200D_J() {}
+function await() {}
+
+
+
+@$
+@_
+@\u{6F}
+@\u2118
+@ZW_\u200C_NJ
+@ZW_\u200D_J
+@await class C {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference-yield.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference-yield.js
new file mode 100644
index 0000000000..a8bdc2488a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference-yield.js
@@ -0,0 +1,55 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-parenthesized-expr-identifier-reference-yield.case
+// - src/decorator/syntax/valid/cls-decl-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorParenthesizedExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration[Yield, Await, Default] :
+ DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] DecoratorList[?Yield, ?Await]opt class ClassTail[?Yield, ?Await]
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ DecoratorParenthesizedExpression[Yield, Await] :
+ ( Expression[+In, ?Yield, ?Await] )
+
+ PrimaryExpression[Yield, Await] :
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+ IdentifierReference[Yield, Await] :
+ [~Yield] yield
+ ...
+
+---*/
+function yield() {}
+
+
+
+@(yield) class C {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference.js
new file mode 100644
index 0000000000..709f352eea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference.js
@@ -0,0 +1,63 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/decorator/decorator-parenthesized-expr-identifier-reference.case
+// - src/decorator/syntax/valid/cls-decl-decorators-valid-syntax.template
+/*---
+description: Decorator @ DecoratorParenthesizedExpression (Valid syntax for decorator on class.)
+esid: prod-ClassDeclaration
+features: [class, decorators]
+flags: [generated]
+info: |
+ ClassDeclaration[Yield, Await, Default] :
+ DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] DecoratorList[?Yield, ?Await]opt class ClassTail[?Yield, ?Await]
+
+ DecoratorList[Yield, Await] :
+ DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await]
+
+ Decorator[Yield, Await] :
+ @ DecoratorMemberExpression[?Yield, ?Await]
+ @ DecoratorParenthesizedExpression[?Yield, ?Await]
+ @ DecoratorCallExpression[?Yield, ?Await]
+
+ ...
+
+
+ DecoratorParenthesizedExpression[Yield, Await] :
+ ( Expression[+In, ?Yield, ?Await] )
+
+ PrimaryExpression[Yield, Await] :
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+function $() {}
+function _() {}
+function \u{6F}() {}
+function \u2118() {}
+function ZW_\u200C_NJ() {}
+function ZW_\u200D_J() {}
+function await() {}
+
+
+
+@($)
+@(_)
+@(\u{6F})
+@(\u2118)
+@(ZW_\u200C_NJ)
+@(ZW_\u200D_J)
+@(await) class C {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/decorator/syntax/valid/shell.js b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/decorator/syntax/valid/shell.js
diff --git a/js/src/tests/test262/language/statements/class/definition/accessors.js b/js/src/tests/test262/language/statements/class/definition/accessors.js
new file mode 100644
index 0000000000..aea9a74946
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/accessors.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class accessors
+---*/
+
+function assertAccessorDescriptor(object, name) {
+ var desc = Object.getOwnPropertyDescriptor(object, name);
+ assert.sameValue(desc.configurable, true, "The value of `desc.configurable` is `true`");
+ assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`");
+ assert.sameValue(typeof desc.get, 'function', "`typeof desc.get` is `'function'`");
+ assert.sameValue(typeof desc.set, 'function', "`typeof desc.set` is `'function'`");
+ assert.sameValue(
+ 'prototype' in desc.get,
+ false,
+ "The result of `'prototype' in desc.get` is `false`"
+ );
+ assert.sameValue(
+ 'prototype' in desc.set,
+ false,
+ "The result of `'prototype' in desc.set` is `false`"
+ );
+}
+
+
+class C {
+ constructor(x) {
+ this._x = x;
+ }
+
+ get x() { return this._x; }
+ set x(v) { this._x = v; }
+
+ static get staticX() { return this._x; }
+ static set staticX(v) { this._x = v; }
+}
+
+assertAccessorDescriptor(C.prototype, 'x');
+assertAccessorDescriptor(C, 'staticX');
+
+var c = new C(1);
+c._x = 1;
+assert.sameValue(c.x, 1, "The value of `c.x` is `1`, after executing `c._x = 1;`");
+c.x = 2;
+assert.sameValue(c._x, 2, "The value of `c._x` is `2`, after executing `c.x = 2;`");
+
+C._x = 3;
+assert.sameValue(C.staticX, 3, "The value of `C.staticX` is `3`, after executing `C._x = 3;`");
+C._x = 4;
+assert.sameValue(C.staticX, 4, "The value of `C.staticX` is `4`, after executing `C._x = 4;`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/basics.js b/js/src/tests/test262/language/statements/class/definition/basics.js
new file mode 100644
index 0000000000..bead8794e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/basics.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class basics
+---*/
+var C = class C {}
+assert.sameValue(typeof C, 'function', "`typeof C` is `'function'`");
+assert.sameValue(
+ Object.getPrototypeOf(C.prototype),
+ Object.prototype,
+ "`Object.getPrototypeOf(C.prototype)` returns `Object.prototype`"
+);
+assert.sameValue(
+ Object.getPrototypeOf(C),
+ Function.prototype,
+ "`Object.getPrototypeOf(C)` returns `Function.prototype`"
+);
+assert.sameValue(C.name, 'C', "The value of `C.name` is `'C'`");
+
+class D {}
+assert.sameValue(typeof D, 'function', "`typeof D` is `'function'`");
+assert.sameValue(
+ Object.getPrototypeOf(D.prototype),
+ Object.prototype,
+ "`Object.getPrototypeOf(D.prototype)` returns `Object.prototype`"
+);
+assert.sameValue(
+ Object.getPrototypeOf(D),
+ Function.prototype,
+ "`Object.getPrototypeOf(D)` returns `Function.prototype`"
+);
+assert.sameValue(D.name, 'D', "The value of `D.name` is `'D'`");
+
+class D2 { constructor() {} }
+assert.sameValue(D2.name, 'D2', "The value of `D2.name` is `'D2'`");
+
+var E = class {}
+assert.sameValue(E.name, 'E', "The value of `E.name` is `'E'`");
+
+var F = class { constructor() {} };
+assert.sameValue(F.name, 'F', "The value of `F.name` is `'F'`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/browser.js b/js/src/tests/test262/language/statements/class/definition/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/browser.js
diff --git a/js/src/tests/test262/language/statements/class/definition/class-method-returns-promise.js b/js/src/tests/test262/language/statements/class/definition/class-method-returns-promise.js
new file mode 100644
index 0000000000..faa55ae7a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/class-method-returns-promise.js
@@ -0,0 +1,17 @@
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+features: [async-functions]
+description: >
+ Async function expressions return promises
+---*/
+class Foo {
+ async method() {};
+}
+var p = new Foo().method();
+assert(p instanceof Promise, "async functions return promise instances");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/constructable-but-no-prototype.js b/js/src/tests/test262/language/statements/class/definition/constructable-but-no-prototype.js
new file mode 100644
index 0000000000..f765200b24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/constructable-but-no-prototype.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class constructable but no prototype
+---*/
+var Base = function() {}.bind();
+assert.throws(TypeError, function() {
+ class C extends Base {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/constructor-property.js b/js/src/tests/test262/language/statements/class/definition/constructor-property.js
new file mode 100644
index 0000000000..d19269c38e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/constructor-property.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class constructor property
+---*/
+class C {}
+assert.sameValue(
+ C,
+ C.prototype.constructor,
+ "The value of `C` is `C.prototype.constructor`"
+);
+var desc = Object.getOwnPropertyDescriptor(C.prototype, 'constructor');
+assert.sameValue(desc.configurable, true, "The value of `desc.configurable` is `true`, after executing `var desc = Object.getOwnPropertyDescriptor(C.prototype, 'constructor');`");
+assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`, after executing `var desc = Object.getOwnPropertyDescriptor(C.prototype, 'constructor');`");
+assert.sameValue(desc.writable, true, "The value of `desc.writable` is `true`, after executing `var desc = Object.getOwnPropertyDescriptor(C.prototype, 'constructor');`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/constructor-strict-by-default.js b/js/src/tests/test262/language/statements/class/definition/constructor-strict-by-default.js
new file mode 100644
index 0000000000..5680bfcc05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/constructor-strict-by-default.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class constructor strict
+---*/
+class C {
+ constructor() {
+ assert.throws(ReferenceError, function() {
+ nonExistingBinding = 42;
+ });
+ }
+}
+new C();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/constructor.js b/js/src/tests/test262/language/statements/class/definition/constructor.js
new file mode 100644
index 0000000000..c084dbdb29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/constructor.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class constructor
+---*/
+var count = 0;
+class C {
+ constructor() {
+ assert.sameValue(
+ Object.getPrototypeOf(this),
+ C.prototype,
+ "`Object.getPrototypeOf(this)` returns `C.prototype`"
+ );
+ count++;
+ }
+}
+assert.sameValue(
+ C,
+ C.prototype.constructor,
+ "The value of `C` is `C.prototype.constructor`"
+);
+var desc = Object.getOwnPropertyDescriptor(C.prototype, 'constructor');
+assert.sameValue(desc.configurable, true, "The value of `desc.configurable` is `true`, after executing `var desc = Object.getOwnPropertyDescriptor(C.prototype, 'constructor');`");
+assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`, after executing `var desc = Object.getOwnPropertyDescriptor(C.prototype, 'constructor');`");
+assert.sameValue(desc.writable, true, "The value of `descr.writable` is `true`, after executing `var desc = Object.getOwnPropertyDescriptor(C.prototype, 'constructor');`");
+
+var c = new C();
+assert.sameValue(count, 1, "The value of `count` is `1`");
+assert.sameValue(
+ Object.getPrototypeOf(c),
+ C.prototype,
+ "`Object.getPrototypeOf(c)` returns `C.prototype`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-async-method-duplicate-parameters.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-async-method-duplicate-parameters.js
new file mode 100644
index 0000000000..58ec8e3d98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-async-method-duplicate-parameters.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: sec-async-function-definitions
+description: Formal parameters may not contain duplicates
+info: |
+ # 14.7 Arrow Function Definitions
+
+ AsyncMethod[Yield, Await]:
+ async[no LineTerminator here]PropertyName[?Yield, ?Await](UniqueFormalParameters[~Yield, +Await]){AsyncFunctionBody}
+
+ # 14.1.2 Static Semantics: Early Errors
+
+ UniqueFormalParameters:FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class Foo {
+ async foo(a, a) { }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-NSPL-with-USD.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-NSPL-with-USD.js
new file mode 100644
index 0000000000..49482b14a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-NSPL-with-USD.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is *true* and IsSimpleParameterList of ArrowParameters is *false*.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+class Foo {
+ async bar(x = 1) {"use strict"}
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-arguments-in-formal-parameters.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-arguments-in-formal-parameters.js
new file mode 100644
index 0000000000..08efd9e9b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-arguments-in-formal-parameters.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters contains arguments
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+class Foo {
+ async foo (arguments) { }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-await-in-formals-default.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-await-in-formals-default.js
new file mode 100644
index 0000000000..c4a99c4b58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-await-in-formals-default.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters' default expressions contains await
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+class Foo {
+ async foo (x = await) { }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-await-in-formals.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-await-in-formals.js
new file mode 100644
index 0000000000..67641cd169
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-await-in-formals.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters contains await
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+class Foo {
+ async foo (await) { }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-body-contains-super-call.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-body-contains-super-call.js
new file mode 100644
index 0000000000..61fc064ca4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-body-contains-super-call.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if AsyncFunctionBody contains SuperCall is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+class Foo {
+ async foo () { super() }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-duplicate-parameters.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-duplicate-parameters.js
new file mode 100644
index 0000000000..b92ae46a08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-duplicate-parameters.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError
+// Copyright 2019 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-method-definitions
+description: Formal parameters may not contain duplicates
+info: |
+ # 14.3 Method Definitions
+
+ MethodDefinition[Yield, Await]:
+ PropertyName[?Yield, ?Await](UniqueFormalParameters[~Yield, ~Await]){FunctionBody[~Yield, ~Await]}
+
+ # 14.1.2 Static Semantics: Early Errors
+
+ UniqueFormalParameters:FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class Foo {
+ foo(a, a) { }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-eval-in-formal-parameters.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-eval-in-formal-parameters.js
new file mode 100644
index 0000000000..16f456926e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-eval-in-formal-parameters.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters contains eval in strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+class Foo {
+ async foo(eval) { }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-formals-body-duplicate.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-formals-body-duplicate.js
new file mode 100644
index 0000000000..e1986d88ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-formals-body-duplicate.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ It is a SyntaxError if BoundNames of FormalParameters also occurs in the LexicallyDeclaredNames of AsyncFunctionBody
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class Foo {
+ async function foo(bar) { let bar; }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-formals-contains-super-call.js b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-formals-contains-super-call.js
new file mode 100644
index 0000000000..ebcc041b35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/early-errors-class-method-formals-contains-super-call.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a syntax error if FormalParameters contains SuperCall is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+class Foo {
+ async foo(foo = super()) { }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/fn-length-static-precedence-order.js b/js/src/tests/test262/language/statements/class/definition/fn-length-static-precedence-order.js
new file mode 100644
index 0000000000..ec6501c61f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/fn-length-static-precedence-order.js
@@ -0,0 +1,74 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ Function `length` attribute not inferred in presence of static `length` method
+info: |
+ ClassTail : ClassHeritage_opt { ClassBody_opt }
+
+ 14. If constructor is empty, then [...]
+ b. Let F be ! CreateBuiltinFunction(steps, 0, className, « [[ConstructorKind]], [[SourceText]] », empty, constructorParent).
+ 15. Else,
+ a. Let constructorInfo be ! DefineMethod of constructor with arguments proto and constructorParent.
+ [ This sets the length property on constructorInfo.[[Closure]]. ]
+ b. Let F be constructorInfo.[[Closure]].
+ [...]
+ 25. For each ClassElement e of elements, do
+ a. If IsStatic of e is false, then [...]
+ b. Else,
+ i. Let field be ClassElementEvaluation of e with arguments F and false.
+ [ This overwrites the length property on F. ]
+includes: [compareArray.js]
+features: [generators]
+---*/
+
+class A {
+ static method() {
+ throw new Test262Error('Static method should not be executed during definition');
+ }
+ static length() {
+ throw new Test262Error('Static method should not be executed during definition');
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method'])
+
+var attr = 'length';
+class B {
+ static [attr]() {
+ throw new Test262Error(
+ 'Static method defined via computed property should not be executed ' +
+ 'during definition'
+ );
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])
+
+class C {
+ static get length() {
+ throw new Test262Error('Static `get` accessor should not be executed during definition');
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])
+
+class D {
+ static set length(_) {
+ throw new Test262Error('Static `set` accessor should not be executed during definition');
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])
+
+class E {
+ static *length() {
+ throw new Test262Error('Static GeneratorMethod should not be executed during definition');
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/fn-length-static-precedence.js b/js/src/tests/test262/language/statements/class/definition/fn-length-static-precedence.js
new file mode 100644
index 0000000000..51ac1bf7aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/fn-length-static-precedence.js
@@ -0,0 +1,78 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ Function `length` attribute not inferred in presence of static `length` method
+info: |
+ ClassTail : ClassHeritage_opt { ClassBody_opt }
+
+ 14. If constructor is empty, then [...]
+ b. Let F be ! CreateBuiltinFunction(steps, 0, className, « [[ConstructorKind]], [[SourceText]] », empty, constructorParent).
+ 15. Else,
+ a. Let constructorInfo be ! DefineMethod of constructor with arguments proto and constructorParent.
+ [ This sets the length property on constructorInfo.[[Closure]]. ]
+ b. Let F be constructorInfo.[[Closure]].
+ [...]
+ 25. For each ClassElement e of elements, do
+ a. If IsStatic of e is false, then [...]
+ b. Else,
+ i. Let field be ClassElementEvaluation of e with arguments F and false.
+ [ This overwrites the length property on F. ]
+features: [generators]
+---*/
+
+class A {
+ static method() {
+ throw new Test262Error('Static method should not be executed during definition');
+ }
+ static length() {
+ throw new Test262Error('Static method should not be executed during definition');
+ }
+}
+
+assert.sameValue(typeof A.length, 'function');
+
+var attr = 'length';
+class B {
+ static [attr]() {
+ throw new Test262Error(
+ 'Static method defined via computed property should not be executed ' +
+ 'during definition'
+ );
+ }
+}
+
+assert.sameValue(typeof B.length, 'function');
+
+var isDefined = false;
+class C {
+ static get length() {
+ if (isDefined) {
+ return 'pass';
+ }
+ throw new Test262Error('Static `get` accessor should not be executed during definition');
+ }
+}
+
+isDefined = true;
+assert.sameValue(C.length, 'pass');
+
+class D {
+ static set length(_) {
+ throw new Test262Error('Static `set` accessor should not be executed during definition');
+ }
+}
+
+assert.sameValue(D.length, undefined);
+
+class E {
+ static *length() {
+ throw new Test262Error('Static GeneratorMethod should not be executed during definition');
+ }
+}
+
+assert.sameValue(typeof E.length, 'function');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/fn-name-accessor-get.js b/js/src/tests/test262/language/statements/class/definition/fn-name-accessor-get.js
new file mode 100644
index 0000000000..8d329f0de5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/fn-name-accessor-get.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 14.3.9
+description: Assignment of function `name` attribute ("get" accessor)
+info: |
+ MethodDefinition : get PropertyName ( ) { FunctionBody }
+
+ [...]
+ 8. Perform SetFunctionName(closure, propKey, "get").
+includes: [propertyHelper.js]
+features: [Symbol]
+---*/
+
+var namedSym = Symbol('test262');
+var anonSym = Symbol();
+var getter;
+
+class A {
+ get id() {}
+ get [anonSym]() {}
+ get [namedSym]() {}
+ static get id() {}
+ static get [anonSym]() {}
+ static get [namedSym]() {}
+}
+
+getter = Object.getOwnPropertyDescriptor(A.prototype, 'id').get;
+assert.sameValue(getter.name, 'get id');
+verifyNotEnumerable(getter, 'name');
+verifyNotWritable(getter, 'name');
+verifyConfigurable(getter, 'name');
+
+getter = Object.getOwnPropertyDescriptor(A.prototype, anonSym).get;
+assert.sameValue(getter.name, 'get ');
+verifyNotEnumerable(getter, 'name');
+verifyNotWritable(getter, 'name');
+verifyConfigurable(getter, 'name');
+
+getter = Object.getOwnPropertyDescriptor(A.prototype, namedSym).get;
+assert.sameValue(getter.name, 'get [test262]');
+verifyNotEnumerable(getter, 'name');
+verifyNotWritable(getter, 'name');
+verifyConfigurable(getter, 'name');
+
+getter = Object.getOwnPropertyDescriptor(A, 'id').get;
+assert.sameValue(getter.name, 'get id');
+verifyNotEnumerable(getter, 'name');
+verifyNotWritable(getter, 'name');
+verifyConfigurable(getter, 'name');
+
+getter = Object.getOwnPropertyDescriptor(A, anonSym).get;
+assert.sameValue(getter.name, 'get ');
+verifyNotEnumerable(getter, 'name');
+verifyNotWritable(getter, 'name');
+verifyConfigurable(getter, 'name');
+
+getter = Object.getOwnPropertyDescriptor(A, namedSym).get;
+assert.sameValue(getter.name, 'get [test262]');
+verifyNotEnumerable(getter, 'name');
+verifyNotWritable(getter, 'name');
+verifyConfigurable(getter, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/fn-name-accessor-set.js b/js/src/tests/test262/language/statements/class/definition/fn-name-accessor-set.js
new file mode 100644
index 0000000000..22d97ca844
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/fn-name-accessor-set.js
@@ -0,0 +1,66 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 14.3.9
+description: Assignment of function `name` attribute ("set" accessor)
+info: |
+ MethodDefinition :
+ set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ [...]
+ 7. Perform SetFunctionName(closure, propKey, "set").
+includes: [propertyHelper.js]
+features: [Symbol]
+---*/
+
+var namedSym = Symbol('test262');
+var anonSym = Symbol();
+var setter;
+
+class A {
+ set id(_) {}
+ set [anonSym](_) {}
+ set [namedSym](_) {}
+ static set id(_) {}
+ static set [anonSym](_) {}
+ static set [namedSym](_) {}
+}
+
+setter = Object.getOwnPropertyDescriptor(A.prototype, 'id').set;
+assert.sameValue(setter.name, 'set id');
+verifyNotEnumerable(setter, 'name');
+verifyNotWritable(setter, 'name');
+verifyConfigurable(setter, 'name');
+
+setter = Object.getOwnPropertyDescriptor(A.prototype, anonSym).set;
+assert.sameValue(setter.name, 'set ');
+verifyNotEnumerable(setter, 'name');
+verifyNotWritable(setter, 'name');
+verifyConfigurable(setter, 'name');
+
+setter = Object.getOwnPropertyDescriptor(A.prototype, namedSym).set;
+assert.sameValue(setter.name, 'set [test262]');
+verifyNotEnumerable(setter, 'name');
+verifyNotWritable(setter, 'name');
+verifyConfigurable(setter, 'name');
+
+setter = Object.getOwnPropertyDescriptor(A, 'id').set;
+assert.sameValue(setter.name, 'set id');
+verifyNotEnumerable(setter, 'name');
+verifyNotWritable(setter, 'name');
+verifyConfigurable(setter, 'name');
+
+setter = Object.getOwnPropertyDescriptor(A, anonSym).set;
+assert.sameValue(setter.name, 'set ');
+verifyNotEnumerable(setter, 'name');
+verifyNotWritable(setter, 'name');
+verifyConfigurable(setter, 'name');
+
+setter = Object.getOwnPropertyDescriptor(A, namedSym).set;
+assert.sameValue(setter.name, 'set [test262]');
+verifyNotEnumerable(setter, 'name');
+verifyNotWritable(setter, 'name');
+verifyConfigurable(setter, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/fn-name-gen-method.js b/js/src/tests/test262/language/statements/class/definition/fn-name-gen-method.js
new file mode 100644
index 0000000000..f6bb4781af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/fn-name-gen-method.js
@@ -0,0 +1,60 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 14.4.13
+description: >
+ Assignment of function `name` attribute (GeneratorMethod)
+info: |
+ GeneratorMethod :
+ * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ [...]
+ 9. Perform SetFunctionName(closure, propKey).
+includes: [propertyHelper.js]
+features: [generators, Symbol]
+---*/
+
+var namedSym = Symbol('test262');
+var anonSym = Symbol();
+
+class A {
+ *id() {}
+ *[anonSym]() {}
+ *[namedSym]() {}
+ static *id() {}
+ static *[anonSym]() {}
+ static *[namedSym]() {}
+}
+
+assert.sameValue(A.prototype.id.name, 'id', 'via IdentifierName');
+verifyNotEnumerable(A.prototype.id, 'name');
+verifyNotWritable(A.prototype.id, 'name');
+verifyConfigurable(A.prototype.id, 'name');
+
+assert.sameValue(A.prototype[anonSym].name, '', 'via anonymous Symbol');
+verifyNotEnumerable(A.prototype[anonSym], 'name');
+verifyNotWritable(A.prototype[anonSym], 'name');
+verifyConfigurable(A.prototype[anonSym], 'name');
+
+assert.sameValue(A.prototype[namedSym].name, '[test262]', 'via Symbol');
+verifyNotEnumerable(A.prototype[namedSym], 'name');
+verifyNotWritable(A.prototype[namedSym], 'name');
+verifyConfigurable(A.prototype[namedSym], 'name');
+
+assert.sameValue(A.id.name, 'id', 'static via IdentifierName');
+verifyNotEnumerable(A.id, 'name');
+verifyNotWritable(A.id, 'name');
+verifyConfigurable(A.id, 'name');
+
+assert.sameValue(A[anonSym].name, '', 'static via anonymous Symbol');
+verifyNotEnumerable(A[anonSym], 'name');
+verifyNotWritable(A[anonSym], 'name');
+verifyConfigurable(A[anonSym], 'name');
+
+assert.sameValue(A[namedSym].name, '[test262]', 'static via Symbol');
+verifyNotEnumerable(A[namedSym], 'name');
+verifyNotWritable(A[namedSym], 'name');
+verifyConfigurable(A[namedSym], 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/fn-name-method.js b/js/src/tests/test262/language/statements/class/definition/fn-name-method.js
new file mode 100644
index 0000000000..f01641f5c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/fn-name-method.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 12.2.6.9
+description: Assignment of function `name` attribute (MethodDefinition)
+info: |
+ 6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
+ a. Let hasNameProperty be HasOwnProperty(propValue, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(propValue,
+ propKey).
+includes: [propertyHelper.js]
+features: [Symbol]
+---*/
+
+var namedSym = Symbol('test262');
+var anonSym = Symbol();
+
+class A {
+ id() {}
+ [anonSym]() {}
+ [namedSym]() {}
+ static id() {}
+ static [anonSym]() {}
+ static [namedSym]() {}
+}
+
+assert.sameValue(A.prototype.id.name, 'id', 'via IdentifierName');
+verifyNotEnumerable(A.prototype.id, 'name');
+verifyNotWritable(A.prototype.id, 'name');
+verifyConfigurable(A.prototype.id, 'name');
+
+assert.sameValue(A.prototype[anonSym].name, '', 'via anonymous Symbol');
+verifyNotEnumerable(A.prototype[anonSym], 'name');
+verifyNotWritable(A.prototype[anonSym], 'name');
+verifyConfigurable(A.prototype[anonSym], 'name');
+
+assert.sameValue(A.prototype[namedSym].name, '[test262]', 'via Symbol');
+verifyNotEnumerable(A.prototype[namedSym], 'name');
+verifyNotWritable(A.prototype[namedSym], 'name');
+verifyConfigurable(A.prototype[namedSym], 'name');
+
+assert.sameValue(A.id.name, 'id', 'static via IdentifierName');
+verifyNotEnumerable(A.id, 'name');
+verifyNotWritable(A.id, 'name');
+verifyConfigurable(A.id, 'name');
+
+assert.sameValue(A[anonSym].name, '', 'static via anonymous Symbol');
+verifyNotEnumerable(A[anonSym], 'name');
+verifyNotWritable(A[anonSym], 'name');
+verifyConfigurable(A[anonSym], 'name');
+
+assert.sameValue(A[namedSym].name, '[test262]', 'static via Symbol');
+verifyNotEnumerable(A[namedSym], 'name');
+verifyNotWritable(A[namedSym], 'name');
+verifyConfigurable(A[namedSym], 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/fn-name-static-precedence-order.js b/js/src/tests/test262/language/statements/class/definition/fn-name-static-precedence-order.js
new file mode 100644
index 0000000000..b9e64a64b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/fn-name-static-precedence-order.js
@@ -0,0 +1,71 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ Function `name` attribute not inferred in presence of static `name` method
+info: |
+ ClassTail : ClassHeritage_opt { ClassBody_opt }
+
+ 14. If constructor is empty, then [...]
+ b. Let F be ! CreateBuiltinFunction(steps, 0, className, « [[ConstructorKind]], [[SourceText]] », empty, constructorParent).
+ 15. Else, [...]
+ d. Perform ! SetFunctionName(F, className).
+ 25. For each ClassElement e of elements, do
+ a. If IsStatic of e is false, then [...]
+ b. Else,
+ i. Let field be ClassElementEvaluation of e with arguments F and false.
+ [ This overwrites the name property on F. ]
+includes: [compareArray.js]
+features: [generators]
+---*/
+
+class A {
+ static method() {
+ throw new Test262Error('Static method should not be executed during definition');
+ }
+ static name() {
+ throw new Test262Error('Static method should not be executed during definition');
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method'])
+
+var attr = 'name';
+class B {
+ static [attr]() {
+ throw new Test262Error(
+ 'Static method defined via computed property should not be executed ' +
+ 'during definition'
+ );
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])
+
+class C {
+ static get name() {
+ throw new Test262Error('Static `get` accessor should not be executed during definition');
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])
+
+class D {
+ static set name(_) {
+ throw new Test262Error('Static `set` accessor should not be executed during definition');
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])
+
+class E {
+ static *name() {
+ throw new Test262Error('Static GeneratorMethod should not be executed during definition');
+ }
+}
+
+assert.compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/fn-name-static-precedence.js b/js/src/tests/test262/language/statements/class/definition/fn-name-static-precedence.js
new file mode 100644
index 0000000000..0521ae7681
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/fn-name-static-precedence.js
@@ -0,0 +1,75 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ Function `name` attribute not inferred in presence of static `name` method
+info: |
+ ClassTail : ClassHeritage_opt { ClassBody_opt }
+
+ 14. If constructor is empty, then [...]
+ b. Let F be ! CreateBuiltinFunction(steps, 0, className, « [[ConstructorKind]], [[SourceText]] », empty, constructorParent).
+ 15. Else, [...]
+ d. Perform ! SetFunctionName(F, className).
+ 25. For each ClassElement e of elements, do
+ a. If IsStatic of e is false, then [...]
+ b. Else,
+ i. Let field be ClassElementEvaluation of e with arguments F and false.
+ [ This overwrites the name property on F. ]
+features: [generators]
+---*/
+
+class A {
+ static method() {
+ throw new Test262Error('Static method should not be executed during definition');
+ }
+ static name() {
+ throw new Test262Error('Static method should not be executed during definition');
+ }
+}
+
+assert.sameValue(typeof A.name, 'function');
+
+var attr = 'name';
+class B {
+ static [attr]() {
+ throw new Test262Error(
+ 'Static method defined via computed property should not be executed ' +
+ 'during definition'
+ );
+ }
+}
+
+assert.sameValue(typeof B.name, 'function');
+
+var isDefined = false;
+class C {
+ static get name() {
+ if (isDefined) {
+ return 'pass';
+ }
+ throw new Test262Error('Static `get` accessor should not be executed during definition');
+ }
+}
+
+isDefined = true;
+assert.sameValue(C.name, 'pass');
+
+class D {
+ static set name(_) {
+ throw new Test262Error('Static `set` accessor should not be executed during definition');
+ }
+}
+
+assert.sameValue(D.name, undefined);
+
+class E {
+ static *name() {
+ throw new Test262Error('Static GeneratorMethod should not be executed during definition');
+ }
+}
+
+assert.sameValue(typeof E.name, 'function');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/getters-non-configurable-err.js b/js/src/tests/test262/language/statements/class/definition/getters-non-configurable-err.js
new file mode 100644
index 0000000000..90745ff901
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/getters-non-configurable-err.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
+es6id: 14.3.9
+description: Failure to define property for static method
+info: |
+ [...]
+ 9. Let desc be the PropertyDescriptor{[[Get]]: closure, [[Enumerable]]:
+ enumerable, [[Configurable]]: true}.
+ 10. Return ? DefinePropertyOrThrow(object, propKey, desc).
+features: [generators]
+---*/
+
+assert.throws(TypeError, function() {
+ class C { static get ['prototype']() {} }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/getters-prop-desc.js b/js/src/tests/test262/language/statements/class/definition/getters-prop-desc.js
new file mode 100644
index 0000000000..f541118067
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/getters-prop-desc.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions
+es6id: 14.5
+description: Class methods - "get" accessors
+includes: [propertyHelper.js]
+---*/
+
+function assertGetterDescriptor(object, name) {
+ var desc = Object.getOwnPropertyDescriptor(object, name);
+ verifyNotEnumerable(object, name);
+ verifyConfigurable(object, name);
+ assert.sameValue(typeof desc.get, 'function', "`typeof desc.get` is `'function'`");
+ assert.sameValue('prototype' in desc.get, false, "The result of `'prototype' in desc.get` is `false`");
+ assert.sameValue(desc.set, undefined, "The value of `desc.set` is `undefined`");
+}
+
+class C {
+ get x() { return 1; }
+ static get staticX() { return 2; }
+ get y() { return 3; }
+ static get staticY() { return 4; }
+}
+
+assert.sameValue(new C().x, 1, "The value of `new C().x` is `1`. Defined as `get x() { return 1; }`");
+assert.sameValue(C.staticX, 2, "The value of `C.staticX` is `2`. Defined as `static get staticX() { return 2; }`");
+assert.sameValue(new C().y, 3, "The value of `new C().y` is `3`. Defined as `get y() { return 3; }`");
+assert.sameValue(C.staticY, 4, "The value of `C.staticY` is `4`. Defined as `static get staticY() { return 4; }`");
+
+assertGetterDescriptor(C.prototype, 'x');
+assertGetterDescriptor(C.prototype, 'y');
+assertGetterDescriptor(C, 'staticX');
+assertGetterDescriptor(C, 'staticY');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/getters-restricted-ids.js b/js/src/tests/test262/language/statements/class/definition/getters-restricted-ids.js
new file mode 100644
index 0000000000..ab41252801
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/getters-restricted-ids.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class getters 2
+---*/
+class C {
+ get eval() {
+ return 1;
+ }
+ get arguments() {
+ return 2;
+ }
+ static get eval() {
+ return 3;
+ }
+ static get arguments() {
+ return 4;
+ }
+};
+
+assert.sameValue(new C().eval, 1, "The value of `new C().eval` is `1`");
+assert.sameValue(new C().arguments, 2, "The value of `new C().arguments` is `2`");
+assert.sameValue(C.eval, 3, "The value of `C.eval` is `3`");
+assert.sameValue(C.arguments, 4, "The value of `C.arguments` is `4`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/implicit-constructor.js b/js/src/tests/test262/language/statements/class/definition/implicit-constructor.js
new file mode 100644
index 0000000000..1d9d689c48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/implicit-constructor.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class implicit constructor
+---*/
+class C {}
+var c = new C();
+assert.sameValue(
+ Object.getPrototypeOf(c),
+ C.prototype,
+ "`Object.getPrototypeOf(c)` returns `C.prototype`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/invalid-extends.js b/js/src/tests/test262/language/statements/class/definition/invalid-extends.js
new file mode 100644
index 0000000000..3bd1f15781
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/invalid-extends.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class invalid extends
+---*/
+assert.throws(TypeError, function() {
+ class C extends 42 {}
+});
+
+assert.throws(TypeError, function() {
+ // Function but its .prototype is not null or a function.
+ class C extends Math.abs {}
+});
+
+assert.throws(TypeError, function() {
+ Math.abs.prototype = 42;
+ class C extends Math.abs {}
+});
+delete Math.abs.prototype;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-async-super-call-body.js b/js/src/tests/test262/language/statements/class/definition/methods-async-super-call-body.js
new file mode 100644
index 0000000000..36930de14e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-async-super-call-body.js
@@ -0,0 +1,27 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ Super calls work in body of async methods
+flags: [async]
+features: [async-functions]
+---*/
+class A {
+ async method() {
+ return 'sup';
+ }
+}
+
+class B extends A {
+ async method() {
+ var x = await super.method();
+ assert.sameValue(x, 'sup');
+ }
+}
+var child = new B();
+child.method().then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-async-super-call-param.js b/js/src/tests/test262/language/statements/class/definition/methods-async-super-call-param.js
new file mode 100644
index 0000000000..a2ca86be8d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-async-super-call-param.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ Super calls work in the parameter list of async methods
+flags: [async]
+features: [async-functions]
+---*/
+
+class A {
+ async method() {
+ return 'sup';
+ }
+}
+
+class B extends A {
+ async method(x = super.method()) {
+ assert.sameValue(await x, 'sup');
+ }
+}
+var child = new B();
+child.method().then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-no-yield.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-no-yield.js
new file mode 100644
index 0000000000..8979af1c48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-no-yield.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ Generators declared with GeneratorMethod syntax do not require a
+ `yield` expression.
+ features: [generators]
+ es6id: 14.4
+---*/
+
+var result;
+class A {
+ *foo(a) {}
+}
+
+result = A.prototype.foo(3).next();
+
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-return.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-return.js
new file mode 100644
index 0000000000..06d4d4cddb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-return.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `return` is a valid statement within generator function bodies.
+ features: [generators]
+ es6id: 14.4
+---*/
+
+var result;
+class A {
+ *g1() { return; }
+ *g2() { return 1; }
+}
+
+result = A.prototype.g1().next();
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+result = A.prototype.g2().next();
+assert.sameValue(result.value, 1);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-expression-with-rhs.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-expression-with-rhs.js
new file mode 100644
index 0000000000..953152207c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-expression-with-rhs.js
@@ -0,0 +1,120 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` is a valid expression within generator function bodies.
+ features: [generators]
+ es6id: 14.4
+---*/
+
+var iter, result;
+class A {
+ *g1() { (yield 1) }
+ *g2() { [yield 1] }
+ *g3() { {yield 1} }
+ *g4() { yield 1, yield 2; }
+ *g5() { (yield 1) ? yield 2 : yield 3; }
+}
+
+iter = A.prototype.g1();
+result = iter.next();
+assert.sameValue(result.value, 1, 'Within grouping operator: result `value`');
+assert.sameValue(
+ result.done, false, 'Within grouping operator: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following grouping operator: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following grouping operator: result `done` flag'
+);
+
+iter = A.prototype.g2();
+result = iter.next();
+assert.sameValue(result.value, 1, 'Within array literal: result `value`');
+assert.sameValue(
+ result.done, false, 'Within array literal: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following array literal: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following array literal: result `done` flag'
+);
+
+iter = A.prototype.g3();
+result = iter.next();
+assert.sameValue(result.value, 1, 'Within object literal: result `value`');
+assert.sameValue(
+ result.done, false, 'Within object literal: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following object literal: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following object literal: result `done` flag'
+);
+
+iter = A.prototype.g4();
+result = iter.next();
+assert.sameValue(
+ result.value, 1, 'First expression in comma expression: result `value`'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'First expression in comma expression: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, 2, 'Second expression in comma expression: result `value`'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'Second expression in comma expression: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following comma expression: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following comma expression: result `done` flag'
+);
+
+iter = A.prototype.g5();
+result = iter.next();
+assert.sameValue(
+ result.value,
+ 1,
+ 'Conditional expression in conditional operator: result `value`'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'Conditional expression in conditional operator: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value,
+ 3,
+ 'Branch in conditional operator: result `value`'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'Branch in conditional operator: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following conditional operator: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following conditional operator: result `done` flag'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-expression-without-rhs.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-expression-without-rhs.js
new file mode 100644
index 0000000000..b42c406358
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-expression-without-rhs.js
@@ -0,0 +1,130 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` is a valid expression within generator function bodies.
+ features: [generators]
+ es6id: 14.4
+---*/
+
+var iter, result;
+class A {
+ *g1() { (yield) }
+ *g2() { [yield] }
+ *g3() { {yield} }
+ *g4() { yield, yield; }
+ *g5() { (yield) ? yield : yield; }
+}
+
+iter = A.prototype.g1();
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Within grouping operator: result `value`'
+);
+assert.sameValue(
+ result.done, false, 'Within grouping operator: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following grouping operator: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following grouping operator: result `done` flag'
+);
+
+iter = A.prototype.g2();
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Within array literal: result `value`'
+);
+assert.sameValue(
+ result.done, false, 'Within array literal: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following array literal: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following array literal: result `done` flag'
+);
+
+iter = A.prototype.g3();
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Within object literal: result `value`'
+);
+assert.sameValue(
+ result.done, false, 'Within object literal: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following object literal: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following object literal: result `done` flag'
+);
+
+iter = A.prototype.g4();
+result = iter.next();
+assert.sameValue(
+ result.value,
+ undefined,
+ 'First expression in comma expression: result `value`'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'First expression in comma expression: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value,
+ undefined,
+ 'Second expression in comma expression: result `value`'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'Second expression in comma expression: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following comma expression: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following comma expression: result `done` flag'
+);
+
+iter = A.prototype.g5();
+result = iter.next();
+assert.sameValue(
+ result.value,
+ undefined,
+ 'Conditional expression in conditional operator: result `value`'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'Conditional expression in conditional operator: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value,
+ undefined,
+ 'Branch in conditional operator: result `value`'
+);
+assert.sameValue(
+ result.done,
+ false,
+ 'Branch in conditional operator: result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Following conditional operator: result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Following conditional operator: result `done` flag'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-function-expression-binding-identifier.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-function-expression-binding-identifier.js
new file mode 100644
index 0000000000..40ef23222f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-function-expression-binding-identifier.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` may not be used as the binding identifier of a function
+ expression within classes.
+ features: [generators]
+ es6id: 14.1
+ negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class A {
+ *g() {
+ (function yield() {});
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-generator-method-binding-identifier.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-generator-method-binding-identifier.js
new file mode 100644
index 0000000000..6f0dfff5a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-generator-method-binding-identifier.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` is a valid BindingIdentifier for GeneratorMethods outside of
+ strict mode.
+ features: [generators]
+ es6id: 12.1.1
+---*/
+
+var iter, result;
+class A {
+ *yield() { (yield 3) + (yield 4); }
+}
+
+iter = A.prototype.yield();
+
+result = iter.next();
+assert.sameValue(result.value, 3, 'First result `value`');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, 4, 'Second result `value`');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'Third result `value`');
+assert.sameValue(result.done, true, 'Third result `done` flag');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-identifier-in-nested-function.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-identifier-in-nested-function.js
new file mode 100644
index 0000000000..eb35c7cb3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-identifier-in-nested-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` is a reserved keyword within normal function bodies declared
+ within classes.
+ features: [generators]
+ es6id: 12.1.1
+ negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class A {
+ *g() {
+ function h() {
+ yield = 1;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-literal-property-name.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-literal-property-name.js
new file mode 100644
index 0000000000..ce60db6fb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-literal-property-name.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` may be used as a literal property name in an object literal
+ within generator function bodies.
+ features: [generators]
+ es6id: 12.1.1
+---*/
+
+var result;
+class A {
+ *g() {
+ ({ get yield() { return 1 } });
+ }
+}
+
+result = A.prototype.g().next();
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-logical-or-expression.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-logical-or-expression.js
new file mode 100644
index 0000000000..5edac93178
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-logical-or-expression.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` expressions are not LogicalOrExpressions.
+ features: [generators]
+ es6id: 12.1.1
+ negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class A {
+ *g() {
+ yield ? yield : yield;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-parameter.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-parameter.js
new file mode 100644
index 0000000000..f4cf062cf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-parameter.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` is a reserved keyword within generator function bodies and may
+ not be used as the binding identifier of a parameter.
+ features: [generators]
+ es6id: 12.1.1
+ negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class A {
+ *g(yield) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-property-name.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-property-name.js
new file mode 100644
index 0000000000..60f99d9b29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-property-name.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` may be used as a literal property name in an object literal
+ within generator function bodies.
+ features: [generators]
+ es6id: 12.1.1
+---*/
+
+var result;
+class A {
+ *g() {
+ ({ yield: 1 });
+ }
+}
+
+result = A.prototype.g().next();
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-statement.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-statement.js
new file mode 100644
index 0000000000..605fc0f6fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-statement.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` is a valid statement within generator function bodies.
+ features: [generators]
+ es6id: 14.4
+---*/
+
+var iter, result;
+class A {
+ *g1() { yield; }
+ *g2() { yield 1; }
+}
+
+iter = A.prototype.g1();
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Without right-hand-side: first result `value`'
+);
+assert.sameValue(
+ result.done, false, 'Without right-hand-side: first result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Without right-hand-side: second result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Without right-hand-eside: second result `done` flag'
+);
+
+iter = A.prototype.g2();
+result = iter.next();
+assert.sameValue(
+ result.value, 1, 'With right-hand-side: first result `value`'
+);
+assert.sameValue(
+ result.done, false, 'With right-hand-side: first result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'With right-hand-side: second result `value`'
+);
+assert.sameValue(
+ result.done, true, 'With right-hand-eside: second result `done` flag'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-yield-operand.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-yield-operand.js
new file mode 100644
index 0000000000..a440f04d0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-as-yield-operand.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` expressions may be used as the right-hand-side of other `yield`
+ expressions.
+ features: [generators]
+ es6id: 14.4
+---*/
+
+var iter, result;
+class A {
+ *g() {
+ yield yield 1;
+ }
+}
+
+iter = A.prototype.g();
+
+result = iter.next();
+assert.sameValue(result.value, 1, 'First result `value`');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'Second result `value`');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'Third result `value`');
+assert.sameValue(result.done, true, 'Thid result `done` flag');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-newline.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-newline.js
new file mode 100644
index 0000000000..b2f23da27d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-newline.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ Newlines terminate `yield` expressions.
+ features: [generators]
+ es6id: 14.4
+---*/
+
+var iter, result;
+class A {
+ *g() {
+ yield
+ 1
+ }
+}
+
+iter = A.prototype.g();
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'First result `value`');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'Second result `value`');
+assert.sameValue(result.done, true, 'Second result `done` flag');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-star-after-newline.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-star-after-newline.js
new file mode 100644
index 0000000000..ca1913c00a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-star-after-newline.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ A newline may not precede the `*` token in a `yield` expression.
+ features: [generators]
+ es6id: 14.4
+ negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class A {
+ *g() {
+ yield
+ * 1
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-star-before-newline.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-star-before-newline.js
new file mode 100644
index 0000000000..bc68cbbdb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-star-before-newline.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ The right-hand side of a `yield *` expression may appear on a new line.
+ features: [generators]
+ es6id: 14.4
+---*/
+
+var result;
+class A {
+ *g() {
+ yield *
+ g2()
+ }
+}
+var g2 = function*() {};
+
+result = A.prototype.g().next();
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-weak-binding.js b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-weak-binding.js
new file mode 100644
index 0000000000..0c2f54376a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-gen-yield-weak-binding.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` expressions bind weakly
+ features: [generators]
+ es6id: 14.4
+ negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class A {
+ *g() { yield 3 + yield 4; }
+}
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-named-eval-arguments.js b/js/src/tests/test262/language/statements/class/definition/methods-named-eval-arguments.js
new file mode 100644
index 0000000000..bb99527117
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-named-eval-arguments.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class methods 2
+---*/
+class C {
+ eval() {
+ return 1;
+ }
+ arguments() {
+ return 2;
+ }
+ static eval() {
+ return 3;
+ }
+ static arguments() {
+ return 4;
+ }
+};
+
+assert.sameValue(new C().eval(), 1, "`new C().eval()` returns `1`");
+assert.sameValue(new C().arguments(), 2, "`new C().arguments()` returns `2`");
+assert.sameValue(C.eval(), 3, "`C.eval()` returns `3`");
+assert.sameValue(C.arguments(), 4, "`C.arguments()` returns `4`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods-restricted-properties.js b/js/src/tests/test262/language/statements/class/definition/methods-restricted-properties.js
new file mode 100644
index 0000000000..f01bb2a643
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods-restricted-properties.js
@@ -0,0 +1,106 @@
+// Copyright (C) 2015 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Functions created using MethodDefinition syntactic form do not have own
+ properties "caller" or "arguments", but inherit them from
+ %FunctionPrototype%.
+es6id: 16.1
+---*/
+
+class Class {
+ method() {}
+ get accessor() {}
+ set accessor(x) {}
+};
+
+var instance = new Class;
+var accessor = Object.getOwnPropertyDescriptor(Class.prototype, "accessor");
+
+assert.sameValue(
+ instance.method.hasOwnProperty('caller'),
+ false,
+ 'No "caller" own property (method)'
+);
+assert.sameValue(
+ instance.method.hasOwnProperty('arguments'),
+ false,
+ 'No "arguments" own property (method)'
+);
+assert.sameValue(
+ accessor.get.hasOwnProperty('caller'),
+ false,
+ 'No "caller" own property ("get" accessor)'
+);
+assert.sameValue(
+ accessor.get.hasOwnProperty('arguments'),
+ false,
+ 'No "arguments" own property ("get" accessor)'
+);
+assert.sameValue(
+ accessor.set.hasOwnProperty('caller'),
+ false,
+ 'No "caller" own property ("set" accessor)'
+);
+assert.sameValue(
+ accessor.set.hasOwnProperty('arguments'),
+ false,
+ 'No "arguments" own property ("set" accessor)'
+);
+
+// --- Test method restricted properties throw
+
+assert.throws(TypeError, function() {
+ return instance.method.caller;
+});
+
+assert.throws(TypeError, function() {
+ instance.method.caller = {};
+});
+
+assert.throws(TypeError, function() {
+ return instance.method.arguments;
+});
+
+assert.throws(TypeError, function() {
+ instance.method.arguments = {};
+});
+
+// --- Test getter restricted properties throw
+
+assert.throws(TypeError, function() {
+ return accessor.get.caller;
+});
+
+assert.throws(TypeError, function() {
+ accessor.get.caller = {};
+});
+
+assert.throws(TypeError, function() {
+ return accessor.get.arguments;
+});
+
+assert.throws(TypeError, function() {
+ accessor.get.arguments = {};
+});
+
+// --- Test setter restricted properties throw
+
+assert.throws(TypeError, function() {
+ return accessor.set.caller;
+});
+
+assert.throws(TypeError, function() {
+ accessor.set.caller = {};
+});
+
+assert.throws(TypeError, function() {
+ return accessor.set.arguments;
+});
+
+assert.throws(TypeError, function() {
+ accessor.set.arguments = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/methods.js b/js/src/tests/test262/language/statements/class/definition/methods.js
new file mode 100644
index 0000000000..66ad98189a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/methods.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class methods
+---*/
+function assertMethodDescriptor(object, name) {
+ var desc = Object.getOwnPropertyDescriptor(object, name);
+ assert.sameValue(desc.configurable, true, "The value of `desc.configurable` is `true`");
+ assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`");
+ assert.sameValue(desc.writable, true, "The value of `desc.writable` is `true`");
+ assert.sameValue(typeof desc.value, 'function', "`typeof desc.value` is `'function'`");
+ assert.sameValue('prototype' in desc.value, false, "The result of `'prototype' in desc.value` is `false`");
+}
+
+class C {
+ method() { return 1; }
+ static staticMethod() { return 2; }
+ method2() { return 3; }
+ static staticMethod2() { return 4; }
+}
+
+assertMethodDescriptor(C.prototype, 'method');
+assertMethodDescriptor(C.prototype, 'method2');
+assertMethodDescriptor(C, 'staticMethod');
+assertMethodDescriptor(C, 'staticMethod2');
+
+assert.sameValue(new C().method(), 1, "`new C().method()` returns `1`. Defined as `method() { return 1; }`");
+assert.sameValue(C.staticMethod(), 2, "`C.staticMethod()` returns `2`. Defined as `static staticMethod() { return 2; }`");
+assert.sameValue(new C().method2(), 3, "`new C().method2()` returns `3`. Defined as `method2() { return 3; }`");
+assert.sameValue(C.staticMethod2(), 4, "`C.staticMethod2()` returns `4`. Defined as `static staticMethod2() { return 4; }`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/numeric-property-names.js b/js/src/tests/test262/language/statements/class/definition/numeric-property-names.js
new file mode 100644
index 0000000000..f974c11a88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/numeric-property-names.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class numeric property names
+---*/
+function assertMethodDescriptor(object, name) {
+ var desc = Object.getOwnPropertyDescriptor(object, name);
+ assert.sameValue(desc.configurable, true, "The value of `desc.configurable` is `true`");
+ assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`");
+ assert.sameValue(desc.writable, true, "The value of `desc.writable` is `true`");
+ assert.sameValue(typeof desc.value, 'function', "`typeof desc.value` is `'function'`");
+ assert.sameValue('prototype' in desc.value, false, "The result of `'prototype' in desc.value` is `false`");
+}
+
+function assertGetterDescriptor(object, name) {
+ var desc = Object.getOwnPropertyDescriptor(object, name);
+ assert.sameValue(desc.configurable, true, "The value of `desc.configurable` is `true`");
+ assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`");
+ assert.sameValue(typeof desc.get, 'function', "`typeof desc.get` is `'function'`");
+ assert.sameValue('prototype' in desc.get, false, "The result of `'prototype' in desc.get` is `false`");
+ assert.sameValue(desc.set, undefined, "The value of `desc.set` is `undefined`");
+}
+
+function assertSetterDescriptor(object, name) {
+ var desc = Object.getOwnPropertyDescriptor(object, name);
+ assert.sameValue(desc.configurable, true, "The value of `desc.configurable` is `true`");
+ assert.sameValue(desc.enumerable, false, "The value of `desc.enumerable` is `false`");
+ assert.sameValue(typeof desc.set, 'function', "`typeof desc.set` is `'function'`");
+ assert.sameValue('prototype' in desc.set, false, "The result of `'prototype' in desc.set` is `false`");
+ assert.sameValue(desc.get, undefined, "The value of `desc.get` is `undefined`");
+}
+
+class B {
+ 1() { return 1; }
+ get 2() { return 2; }
+ set 3(_) {}
+
+ static 4() { return 4; }
+ static get 5() { return 5; }
+ static set 6(_) {}
+}
+
+assertMethodDescriptor(B.prototype, '1');
+assertGetterDescriptor(B.prototype, '2');
+assertSetterDescriptor(B.prototype, '3');
+
+assertMethodDescriptor(B, '4');
+assertGetterDescriptor(B, '5');
+assertSetterDescriptor(B, '6');
+
+class C extends B {
+ 1() { return super[1](); }
+ get 2() { return super[2]; }
+ static 4() { return super[4](); }
+ static get 5() { return super[5]; }
+}
+
+assert.sameValue(new C()[1](), 1, "`new C()[1]()` returns `1`. Defined as `1() { return super[1](); }`");
+assert.sameValue(new C()[2], 2, "The value of `new C()[2]` is `2`. Defined as `get 2() { return super[2]; }`");
+assert.sameValue(C[4](), 4, "`C[4]()` returns `4`. Defined as `static 4() { return super[4](); }`");
+assert.sameValue(C[5], 5, "The value of `C[5]` is `5`. Defined as `static get 5() { return super[5]; }`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/prototype-getter.js b/js/src/tests/test262/language/statements/class/definition/prototype-getter.js
new file mode 100644
index 0000000000..cbfe6ac1b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/prototype-getter.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class prototype getter
+---*/
+var calls = 0;
+var Base = function() {}.bind();
+Object.defineProperty(Base, 'prototype', {
+ get: function() {
+ calls++;
+ return null;
+ },
+ configurable: true
+});
+class C extends Base {}
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+calls = 0;
+Object.defineProperty(Base, 'prototype', {
+ get: function() {
+ calls++;
+ return 42;
+ },
+ configurable: true
+});
+assert.throws(TypeError, function() {
+ class C extends Base {}
+});
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/prototype-property.js b/js/src/tests/test262/language/statements/class/definition/prototype-property.js
new file mode 100644
index 0000000000..1c9110ca04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/prototype-property.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class prototype property
+---*/
+class C {}
+var descr = Object.getOwnPropertyDescriptor(C, 'prototype');
+assert.sameValue(descr.configurable, false, "The value of `descr.configurable` is `false`");
+assert.sameValue(descr.enumerable, false, "The value of `descr.enumerable` is `false`");
+assert.sameValue(descr.writable, false, "The value of `descr.writable` is `false`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/prototype-setter.js b/js/src/tests/test262/language/statements/class/definition/prototype-setter.js
new file mode 100644
index 0000000000..f6618c5a9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/prototype-setter.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class prototype setter
+---*/
+var Base = function() {}.bind();
+Object.defineProperty(Base, 'prototype', {
+ set: function() {
+ throw new Test262Error("Cannot create a setter property named `prototype`");
+ }
+});
+assert.throws(TypeError, function() {
+ class C extends Base {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/prototype-wiring.js b/js/src/tests/test262/language/statements/class/definition/prototype-wiring.js
new file mode 100644
index 0000000000..608bde0586
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/prototype-wiring.js
@@ -0,0 +1,75 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class prototype wiring
+---*/
+
+class Base {
+ constructor(x) {
+ this.foobar = x;
+ }
+}
+
+class Subclass extends Base {
+ constructor(x) {
+ super(x);
+ }
+}
+
+var s = new Subclass(1);
+assert.sameValue(s.foobar, 1, "The value of `s.foobar` is `1`");
+assert.sameValue(
+ Object.getPrototypeOf(s),
+ Subclass.prototype,
+ "`Object.getPrototypeOf(s)` returns `Subclass.prototype`"
+);
+
+var s1 = new Subclass(1, 2);
+assert.sameValue(s1.foobar, 1, "The value of `s1.foobar` is `1`");
+assert.sameValue(
+ Object.getPrototypeOf(s1) === Subclass.prototype,
+ true,
+ "The result of `Object.getPrototypeOf(s1) === Subclass.prototype` is `true`"
+);
+
+var s2 = new Subclass();
+assert.sameValue(s2.foobar, undefined, "The value of `s2.foobar` is `undefined`");
+assert.sameValue(
+ Object.getPrototypeOf(s2),
+ Subclass.prototype,
+ "`Object.getPrototypeOf(s2)` returns `Subclass.prototype`"
+);
+assert.throws(TypeError, function() { Subclass(1); });
+assert.throws(TypeError, function() { Subclass(1,2,3,4); });
+
+class Subclass2 extends Subclass {
+ constructor() {
+ super(5, 6, 7);
+ }
+}
+
+var ss2 = new Subclass2();
+assert.sameValue(ss2.foobar, 5, "The value of `ss2.foobar` is `5`");
+assert.sameValue(
+ Object.getPrototypeOf(ss2),
+ Subclass2.prototype,
+ "`Object.getPrototypeOf(ss2)` returns `Subclass2.prototype`"
+);
+
+class Subclass3 extends Base {
+ constructor(x, y) {
+ super(x + y);
+ }
+}
+
+var ss3 = new Subclass3(27,42-27);
+assert.sameValue(ss3.foobar, 42, "The value of `ss3.foobar` is `42`");
+assert.sameValue(
+ Object.getPrototypeOf(ss3),
+ Subclass3.prototype,
+ "`Object.getPrototypeOf(ss3)` returns `Subclass3.prototype`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/setters-non-configurable-err.js b/js/src/tests/test262/language/statements/class/definition/setters-non-configurable-err.js
new file mode 100644
index 0000000000..69e2dac8e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/setters-non-configurable-err.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
+es6id: 14.3.9
+description: Failure to define property for static method
+info: |
+ [...]
+ 8. Let desc be the PropertyDescriptor{[[Set]]: closure, [[Enumerable]]:
+ enumerable, [[Configurable]]: true}.
+ 9. Return ? DefinePropertyOrThrow(object, propKey, desc).
+features: [generators]
+---*/
+
+assert.throws(TypeError, function() {
+ class C { static set ['prototype'](_) {} }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/setters-prop-desc.js b/js/src/tests/test262/language/statements/class/definition/setters-prop-desc.js
new file mode 100644
index 0000000000..46b2e0a3c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/setters-prop-desc.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions
+es6id: 14.5
+description: Class methods - "set" accessors
+includes: [propertyHelper.js]
+---*/
+
+function assertSetterDescriptor(object, name) {
+ var descr = Object.getOwnPropertyDescriptor(object, name);
+ verifyNotEnumerable(object, name);
+ verifyConfigurable(object, name);
+ assert.sameValue(typeof descr.set, 'function', "`typeof descr.set` is `'function'`");
+ assert.sameValue('prototype' in descr.set, false, "The result of `'prototype' in descr.set` is `false`");
+ assert.sameValue(descr.get, undefined, "The value of `descr.get` is `undefined`");
+}
+
+var x, staticX, y, staticY;
+class C {
+ set x(v) { x = v; }
+ static set staticX(v) { staticX = v; }
+ set y(v) { y = v; }
+ static set staticY(v) { staticY = v; }
+}
+
+assert.sameValue(new C().x = 1, 1, "`new C().x = 1` is `1`");
+assert.sameValue(x, 1, "The value of `x` is `1`");
+assert.sameValue(C.staticX = 2, 2, "`C.staticX = 2` is `2`");
+assert.sameValue(staticX, 2, "The value of `staticX` is `2`");
+assert.sameValue(new C().y = 3, 3, "`new C().y = 3` is `3`");
+assert.sameValue(y, 3, "The value of `y` is `3`");
+assert.sameValue(C.staticY = 4, 4, "`C.staticY = 4` is `4`");
+assert.sameValue(staticY, 4, "The value of `staticY` is `4`");
+
+assertSetterDescriptor(C.prototype, 'x');
+assertSetterDescriptor(C.prototype, 'y');
+assertSetterDescriptor(C, 'staticX');
+assertSetterDescriptor(C, 'staticY');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/setters-restricted-ids.js b/js/src/tests/test262/language/statements/class/definition/setters-restricted-ids.js
new file mode 100644
index 0000000000..9e2e3c69b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/setters-restricted-ids.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class setters 2
+---*/
+var x = 0;
+class C {
+ set eval(v) {
+ x = v;
+ }
+ set arguments(v) {
+ x = v;
+ }
+ static set eval(v) {
+ x = v;
+ }
+ static set arguments(v) {
+ x = v;
+ }
+};
+
+new C().eval = 1;
+assert.sameValue(x, 1, "The value of `x` is `1`");
+new C().arguments = 2;
+assert.sameValue(x, 2, "The value of `x` is `2`");
+C.eval = 3;
+assert.sameValue(x, 3, "The value of `x` is `3`");
+C.arguments = 4;
+assert.sameValue(x, 4, "The value of `x` is `4`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/shell.js b/js/src/tests/test262/language/statements/class/definition/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/shell.js
diff --git a/js/src/tests/test262/language/statements/class/definition/side-effects-in-extends.js b/js/src/tests/test262/language/statements/class/definition/side-effects-in-extends.js
new file mode 100644
index 0000000000..bdbd255ef9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/side-effects-in-extends.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class side effect in extends
+---*/
+var calls = 0;
+class C {}
+class D extends (calls++, C) {}
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+assert.sameValue(typeof D, 'function', "`typeof D` is `'function'`");
+assert.sameValue(Object.getPrototypeOf(D), C, "`Object.getPrototypeOf(D)` returns `C`");
+assert.sameValue(
+ C.prototype,
+ Object.getPrototypeOf(D.prototype),
+ "The value of `C.prototype` is `Object.getPrototypeOf(D.prototype)`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/side-effects-in-property-define.js b/js/src/tests/test262/language/statements/class/definition/side-effects-in-property-define.js
new file mode 100644
index 0000000000..616797b19b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/side-effects-in-property-define.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class side effects in property define
+---*/
+function B() {}
+B.prototype = {
+ constructor: B,
+ set m(v) {
+ throw Error();
+ }
+};
+
+class C extends B {
+ m() { return 1; }
+}
+
+assert.sameValue(new C().m(), 1, "`new C().m()` returns `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/this-access-restriction-2.js b/js/src/tests/test262/language/statements/class/definition/this-access-restriction-2.js
new file mode 100644
index 0000000000..e1f855aa1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/this-access-restriction-2.js
@@ -0,0 +1,90 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class this access restriction 2
+---*/
+class Base {
+ constructor(a, b) {
+ var o = new Object();
+ o.prp = a + b;
+ return o;
+ }
+}
+
+class Subclass extends Base {
+ constructor(a, b) {
+ var exn;
+ try {
+ this.prp1 = 3;
+ } catch (e) {
+ exn = e;
+ }
+ assert.sameValue(
+ exn instanceof ReferenceError,
+ true,
+ "The result of `exn instanceof ReferenceError` is `true`"
+ );
+ super(a, b);
+ assert.sameValue(this.prp, a + b, "The value of `this.prp` is `a + b`");
+ assert.sameValue(this.prp1, undefined, "The value of `this.prp1` is `undefined`");
+ assert.sameValue(
+ this.hasOwnProperty("prp1"),
+ false,
+ "`this.hasOwnProperty(\"prp1\")` returns `false`"
+ );
+ return this;
+ }
+}
+
+var b = new Base(1, 2);
+assert.sameValue(b.prp, 3, "The value of `b.prp` is `3`");
+
+
+var s = new Subclass(2, -1);
+assert.sameValue(s.prp, 1, "The value of `s.prp` is `1`");
+assert.sameValue(s.prp1, undefined, "The value of `s.prp1` is `undefined`");
+assert.sameValue(
+ s.hasOwnProperty("prp1"),
+ false,
+ "`s.hasOwnProperty(\"prp1\")` returns `false`"
+);
+
+class Subclass2 extends Base {
+ constructor(x) {
+ super(1,2);
+
+ if (x < 0) return;
+
+ var called = false;
+ function tmp() { called = true; return 3; }
+ var exn = null;
+ try {
+ super(tmp(),4);
+ } catch (e) { exn = e; }
+ assert.sameValue(
+ exn instanceof ReferenceError,
+ true,
+ "The result of `exn instanceof ReferenceError` is `true`"
+ );
+ assert.sameValue(called, true, "The value of `called` is `true`");
+ }
+}
+
+var s2 = new Subclass2(1);
+assert.sameValue(s2.prp, 3, "The value of `s2.prp` is `3`");
+
+var s3 = new Subclass2(-1);
+assert.sameValue(s3.prp, 3, "The value of `s3.prp` is `3`");
+
+assert.throws(TypeError, function() { Subclass.call(new Object(), 1, 2); });
+assert.throws(TypeError, function() { Base.call(new Object(), 1, 2); });
+
+class BadSubclass extends Base {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() { new BadSubclass(); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/this-access-restriction.js b/js/src/tests/test262/language/statements/class/definition/this-access-restriction.js
new file mode 100644
index 0000000000..ce13e6a343
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/this-access-restriction.js
@@ -0,0 +1,100 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class this access restriction
+---*/
+class Base {}
+(function() {
+ class C extends Base {
+ constructor() {
+ var y;
+ super();
+ }
+ }; new C();
+}());
+assert.throws(ReferenceError, function() {
+ class C extends Base {
+ constructor() {
+ super(this.x);
+ }
+ }; new C();
+});
+assert.throws(ReferenceError, function() {
+ class C extends Base {
+ constructor() {
+ super(this);
+ }
+ }; new C();
+});
+assert.throws(ReferenceError, function() {
+ class C extends Base {
+ constructor() {
+ super.method();
+ super(this);
+ }
+ }; new C();
+});
+assert.throws(ReferenceError, function() {
+ class C extends Base {
+ constructor() {
+ super(super.method());
+ }
+ }; new C();
+});
+assert.throws(ReferenceError, function() {
+ class C extends Base {
+ constructor() {
+ super(super());
+ }
+ }; new C();
+});
+assert.throws(ReferenceError, function() {
+ class C extends Base {
+ constructor() {
+ super(1, 2, Object.getPrototypeOf(this));
+ }
+ }; new C();
+});
+(function() {
+ class C extends Base {
+ constructor() {
+ { super(1, 2); }
+ }
+ }; new C();
+}());
+(function() {
+ class C extends Base {
+ constructor() {
+ if (1) super();
+ }
+ }; new C();
+}());
+
+class C1 extends Object {
+ constructor() {
+ 'use strict';
+ super();
+ }
+};
+new C1();
+
+class C2 extends Object {
+ constructor() {
+ ; 'use strict';;;;;
+ super();
+ }
+};
+new C2();
+
+class C3 extends Object {
+ constructor() {
+ ; 'use strict';;;;;
+ // This is a comment.
+ super();
+ }
+};
+new C3();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/definition/this-check-ordering.js b/js/src/tests/test262/language/statements/class/definition/this-check-ordering.js
new file mode 100644
index 0000000000..c7f867db9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/definition/this-check-ordering.js
@@ -0,0 +1,72 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class this check ordering
+---*/
+var baseCalled = 0;
+class Base {
+ constructor() { baseCalled++ }
+}
+
+var fCalled = 0;
+function f() { fCalled++; return 3; }
+
+class Subclass1 extends Base {
+ constructor() {
+ baseCalled = 0;
+ super();
+ assert.sameValue(baseCalled, 1, "The value of `baseCalled` is `1`");
+ var obj = this;
+
+ var exn = null;
+ baseCalled = 0;
+ fCalled = 0;
+ try {
+ super(f());
+ } catch (e) { exn = e; }
+ assert.sameValue(
+ exn instanceof ReferenceError,
+ true,
+ "The result of `exn instanceof ReferenceError` is `true`"
+ );
+ assert.sameValue(fCalled, 1, "The value of `fCalled` is `1`");
+ assert.sameValue(baseCalled, 1, "The value of `baseCalled` is `1`");
+ assert.sameValue(this, obj, "`this` is `obj`");
+
+ exn = null;
+ baseCalled = 0;
+ fCalled = 0;
+ try {
+ super(super(), f());
+ } catch (e) { exn = e; }
+ assert.sameValue(
+ exn instanceof ReferenceError,
+ true,
+ "The result of `exn instanceof ReferenceError` is `true`"
+ );
+ assert.sameValue(fCalled, 0, "The value of `fCalled` is `0`");
+ assert.sameValue(baseCalled, 1, "The value of `baseCalled` is `1`");
+ assert.sameValue(this, obj, "`this` is `obj`");
+
+ exn = null;
+ baseCalled = 0;
+ fCalled = 0;
+ try {
+ super(f(), super());
+ } catch (e) { exn = e; }
+ assert.sameValue(
+ exn instanceof ReferenceError,
+ true,
+ "The result of `exn instanceof ReferenceError` is `true`"
+ );
+ assert.sameValue(fCalled, 1, "The value of `fCalled` is `1`");
+ assert.sameValue(baseCalled, 1, "The value of `baseCalled` is `1`");
+ assert.sameValue(this, obj, "`this` is `obj`");
+ }
+}
+
+new Subclass1();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-close.js
new file mode 100644
index 0000000000..e52d69ed69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..ce97457026
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+
+class C {
+ async *method([x, y, z]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..8c57224e66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-get-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+
+class C {
+ async *method([x]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..171bf0f296
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-name-iter-val.js
new file mode 100644
index 0000000000..60999d9c15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-name-iter-val.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding with normal value iteration (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..5b9c858723
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..e05a3010b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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;
+class C {
+ async *method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([[7, 8, 9]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..d428628e0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..58ea24c4a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([[]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..4a26167874
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..d64ac8883f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([[23]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..9bb20c8f84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..41e2ce249d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([values]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..29f41a0e69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Nested array destructuring with a null value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+
+class C {
+ async *method([[x]]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..0540907fe6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer with an exhausted iterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..04ec410fa8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..a29b23a43c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..63a66a6cb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..67cb08e087
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..901fc42146
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..601e2a9aab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer with a "hole" (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([,]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..42ee26b072
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([null, 0, false, '']).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..4c3b3bd5d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+---*/
+
+
+class C {
+ async *method([x = (function() { throw new Test262Error(); })()]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..113dd7e7f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer with an undefined value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([undefined]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..516c834aaa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ async *method([ x = unresolvableReference ]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(ReferenceError, function() {
+ method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..bb03bdbfb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration completes (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..1d2e7bbc2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..c8c823b57d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+
+class C {
+ async *method([x]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..ea17e8512f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+class C {
+ async *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..402298502a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+class C {
+ async *method([x]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..c2f1cfafea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..553277bde1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..5f738e9357
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([{ x: 11, y: 22, z: 33 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..6a1328ba7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..61f05a2259
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([{ u: 777, w: 888, y: 999 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..9ab8b92d34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Nested object destructuring with a null value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+class C {
+ async *method([{ x }]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..2b20e89eac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Nested object destructuring with a value of `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+class C {
+ async *method([{ x }]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..a1bdac3020
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Elision accepts exhausted iterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([,]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..457de21945
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision-step-err.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+
+class C {
+ async *method([,]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision.js
new file mode 100644
index 0000000000..1a0920e99f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Elision advances iterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-empty.js
new file mode 100644
index 0000000000..b6566e2cc3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+class C {
+ async *method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..e81767de0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element containing an array BindingElementList pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([3, 4, 5]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..36d6da2178
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element containing an elision (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..8b2e2fa166
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element containing an "empty" array pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..9b47ffc1c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element containing a rest element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..7e6b33b674
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Lone rest element (direct binding) (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..34e0f7161c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Rest element following elision elements (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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 iter = (function*() { throw new Test262Error(); })();
+
+
+class C {
+ async *method([, ...x]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..0478749315
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element following elision elements (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..9eb02b9a14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: RestElement applied to an exhausted iterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..da9cbda40a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+
+class C {
+ async *method([...x]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..0f712cf9a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+class C {
+ async *method([...x]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..de0c817075
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Lone rest element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..ae4025e39e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..1580c8310f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element (identifier) does not support initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..fe3880a2ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..2c40934196
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..f395919c5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element (identifier) may not be followed by any element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..b219be6368
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..cebed99c3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element containing an object binding pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..f7f49a5be4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest element containing an object binding pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+class C {
+ async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([7, 8, 9]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..162eed1127
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..d41a8fb1cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+
+class C {
+ async *method([x, y, z] = [1, 2, 3]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..ee58f513d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+
+class C {
+ async *method([x] = iter) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..11213ed108
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..e8da6e9f22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-name-iter-val.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..0602357580
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..f7493c1180
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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;
+class C {
+ async *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..75dd18901f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..14942f4890
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..6c43533ffd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..352754eab3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..e73fcb966e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..d58b98598d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..03d238b882
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Nested array destructuring with a null value (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+
+class C {
+ async *method([[x]] = [null]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..cd8c161d4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..f248fca743
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..66e035212e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..991e23bbe3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..0dafa09666
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..48511b4b87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..2c51f84ac0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..45821f3294
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..03f6cdc031
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+---*/
+
+
+class C {
+ async *method([x = (function() { throw new Test262Error(); })()] = [undefined]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..9b5f181940
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..e8c67667bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ async *method([ x = unresolvableReference ] = []) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(ReferenceError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..3e98ff9928
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..98a2baabf6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..1e7f455700
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+
+class C {
+ async *method([x] = g) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..16b17212d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+class C {
+ async *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..a987cf315e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+class C {
+ async *method([x] = g) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..78272a3339
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..c58596ee46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..b8c9f3d8cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..1e5abee4af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..f038e24eab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..772a6879cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Nested object destructuring with a null value (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+class C {
+ async *method([{ x }] = [null]) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..daa4ea3751
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+class C {
+ async *method([{ x }] = []) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..7c1991dfef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Elision accepts exhausted iterator (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..ea6fa2a080
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+
+class C {
+ async *method([,] = iter) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..ec98123e8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Elision advances iterator (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..e2c7870d7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+class C {
+ async *method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..939ac76037
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..2e91589278
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element containing an elision (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..0e1604370d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..699583754c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element containing a rest element (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..96b68d3ba9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Lone rest element (direct binding) (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..58f7007841
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element following elision elements (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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 iter = (function*() { throw new Test262Error(); })();
+
+
+class C {
+ async *method([, ...x] = iter) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..edeca7938f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element following elision elements (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..1e6aa07f19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..3a06c3ab1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+
+class C {
+ async *method([...x] = iter) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..0e17ed2e5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+class C {
+ async *method([...x] = iter) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..cb89a4f210
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Lone rest element (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..c4c17626e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..7da673cbb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..87425aff6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..dd2194eac3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..40f347b7b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..cd23b30fc7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async *method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..94876d16fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..8ce08c2a48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+class C {
+ async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-init-null.js
new file mode 100644
index 0000000000..5fc3947140
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-init-null.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+class C {
+ async *method({} = null) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..6502002000
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-init-undefined.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+class C {
+ async *method({} = undefined) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..6248fd6ef2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+class C {
+ async *method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..26412acd49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+class C {
+ async *method({ poisoned } = poisonedProperty) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..18991eefac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..162576df10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..4332321b44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..e43bb913bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..eb045be12f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..8f568a542c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..cf7056ea20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ async *method({ x = thrower() } = {}) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..5a564f7bec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ async *method({ x = unresolvableReference } = {}) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(ReferenceError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..10b50bcb3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..1b6bff73a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ async *method({ a, b = thrower(), c = ++initCount } = {}) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..64dbf4c15e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..e04be13381
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..441f6e316c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ async *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..de82c9e44c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..6faf6b9799
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ async *method({ [thrower()]: x } = {}) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..658645d003
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+class C {
+ async *method({ poisoned: x = ++initEvalCount } = poisonedProperty) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..2f026aa34c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..22bdd6f755
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ async *method({ x: y = thrower() } = {}) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..d6890f7930
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ async *method({ x: y = unresolvableReference } = {}) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(ReferenceError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..dc09c1a1dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..c3eb6f0665
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..22354b9a40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Binding as specified via property name and identifier (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..0f0870753a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..e451ff0189
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..142c493f7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ async *method({ w: { x, y, z } = undefined } = { }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..91b9319bf1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..2d58553a9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+class C {
+ async *method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..63103c4019
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+class C {
+ async *method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..f9764b2671
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template
+/*---
+description: Rest object contains just unextracted data (class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-init-null.js
new file mode 100644
index 0000000000..a9e32f626b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-init-null.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+class C {
+ async *method({}) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-init-undefined.js
new file mode 100644
index 0000000000..325cc00c3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-init-undefined.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+class C {
+ async *method({}) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-empty.js
new file mode 100644
index 0000000000..d1e1606f13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+class C {
+ async *method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(obj).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..ae3744f57d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+class C {
+ async *method({ poisoned }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..96fa1aa0cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..83429e1d61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..e35fd0a17c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..19e34a34c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..d5105aee06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..cd15b40515
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: null, x: 0, y: false, z: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..2e9f281940
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-throws.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ async *method({ x = thrower() }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..ef6e4e26ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ async *method({ x = unresolvableReference }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(ReferenceError, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..3d4614787b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..139a9d575e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-list-err.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ async *method({ a, b = thrower(), c = ++initCount }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method({});
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..5d4a2b7024
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..20c2f315a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: [45] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..50e63756bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ async *method({ w: [x, y, z] = [4, 5, 6] }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..0c74e8bdb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: [7, undefined, ] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..4b4c336319
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Evaluation of property name returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ async *method({ [thrower()]: x }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..5959bd5a73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+class C {
+ async *method({ poisoned: x = ++initEvalCount }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..969a368938
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ s: null, u: 0, w: false, y: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..7419a220df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ async *method({ x: y = thrower() }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(Test262Error, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..f513d7dd05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ async *method({ x: y = unresolvableReference }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(ReferenceError, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..b5117c66e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..8a94cff2f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..4a3f8f7e97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Binding as specified via property name and identifier (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..fc8be8bf01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: undefined }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..d0f6f94b3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..7afbbc89dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ async *method({ w: { x, y, z } = undefined }) {
+
+ }
+};
+
+var method = C.prototype.method;
+
+assert.throws(TypeError, function() {
+ method({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..8f14e47aef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: { x: undefined, z: 7 } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..e89218806a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-getter.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+class C {
+ async *method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ get v() { count++; return 2; } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..18fce78018
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+class C {
+ async *method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(o).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..420b69863e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth.template
+/*---
+description: Rest object contains just unextracted data (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async *method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({x: 1, y: 2, a: 5, b: 3}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-close.js
new file mode 100644
index 0000000000..264fc3650d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..83ff3cd622
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+
+class C {
+ static async *method([x, y, z]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..f1e480eb36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-get-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+
+class C {
+ static async *method([x]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..0ba8cda8be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-name-iter-val.js
new file mode 100644
index 0000000000..be0ded9375
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-name-iter-val.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding with normal value iteration (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..b4a1c05177
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..3b672fa971
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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;
+class C {
+ static async *method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([[7, 8, 9]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..1291b8a61e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..22cf0bb1fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([[]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..fdd08e13de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..4c7b96ebf6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([[23]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..1e83aea613
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..a994c08eec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([values]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..92bccd2f19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Nested array destructuring with a null value (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+
+class C {
+ static async *method([[x]]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..db48fb18f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer with an exhausted iterator (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..f91dae6afe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..9883c8793f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..e2b5985794
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..e9e958075a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..4075c26454
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..df73e759f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer with a "hole" (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+C.method([,]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..8033b54a51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([null, 0, false, '']).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..669f46c9ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer returns an abrupt completion (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+---*/
+
+
+class C {
+ static async *method([x = (function() { throw new Test262Error(); })()]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..38590711d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer with an undefined value (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([undefined]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..ab2486d02b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ static async *method([ x = unresolvableReference ]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(ReferenceError, function() {
+ method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..e997bec484
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration completes (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..8fb843e1b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..7c66ed8916
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+
+class C {
+ static async *method([x]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..adc51fd8f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+class C {
+ static async *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..8bbff5b802
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+class C {
+ static async *method([x]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..28164141f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..962c02103c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..fc3fd08746
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([{ x: 11, y: 22, z: 33 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..391f6c9d92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..608cdcf3b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method([{ u: 777, w: 888, y: 999 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..890afb4b54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Nested object destructuring with a null value (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+class C {
+ static async *method([{ x }]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..1ae4b3664c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Nested object destructuring with a value of `undefined` (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+class C {
+ static async *method([{ x }]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..28bdcce3ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Elision accepts exhausted iterator (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([,]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..15e7202f5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision-step-err.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+
+class C {
+ static async *method([,]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision.js
new file mode 100644
index 0000000000..0c8b703d37
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Elision advances iterator (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-empty.js
new file mode 100644
index 0000000000..af51f844c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+class C {
+ static async *method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..f77842eeb4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element containing an array BindingElementList pattern (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([3, 4, 5]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..f0694f6b25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element containing an elision (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..19a9ba4bdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element containing an "empty" array pattern (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..9d13583ead
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element containing a rest element (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..a3d0749da5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Lone rest element (direct binding) (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..b46b9a32e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element following elision elements (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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 iter = (function*() { throw new Test262Error(); })();
+
+
+class C {
+ static async *method([, ...x]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..fed54ab1bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element following elision elements (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..0a7695bfd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: RestElement applied to an exhausted iterator (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..ae5b780a95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+
+class C {
+ static async *method([...x]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..0cb5f53348
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+class C {
+ static async *method([...x]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..2943babe60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Lone rest element (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..929395eb1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..237f12a497
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element (identifier) does not support initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..ede5a1ca14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..137caddb0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..a10ff3f23c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element (identifier) may not be followed by any element (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..c9049f79f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..daa530dcb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..51cc05ad01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+class C {
+ static async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+C.method([7, 8, 9]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..99b3888c2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..26fbf0cc9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+
+class C {
+ static async *method([x, y, z] = [1, 2, 3]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..5c964493d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+
+class C {
+ static async *method([x] = iter) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..289080308e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..ac1539d0cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-name-iter-val.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..bb4beb7f09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..706041e007
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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;
+class C {
+ static async *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..68ef8dc464
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..2bd89a1a65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..f9731d8045
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..2b6f2152b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..7a04459d6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..35c05296a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..b4501ed495
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Nested array destructuring with a null value (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+
+class C {
+ static async *method([[x]] = [null]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..28e8e79396
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..2d255dd6d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..77a3266c18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..92478e1c91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..cbd6d5e978
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..ebe90e587b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// 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/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..5ca980671f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..a25d3f4972
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..2b2adac10f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+---*/
+
+
+class C {
+ static async *method([x = (function() { throw new Test262Error(); })()] = [undefined]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..6c7bf940b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..2a2a0086eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ static async *method([ x = unresolvableReference ] = []) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(ReferenceError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..f090a1a837
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..5988258232
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..e7224906ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+
+class C {
+ static async *method([x] = g) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..6f5ec9b021
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+class C {
+ static async *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..82883f7c68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+class C {
+ static async *method([x] = g) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..f0a07fe7e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..896f137ef1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..1c6909db21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..5ba5d0ca8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..15691fb960
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..cff11ddcd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Nested object destructuring with a null value (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+class C {
+ static async *method([{ x }] = [null]) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..bb9dd84eaa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+
+class C {
+ static async *method([{ x }] = []) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..aa97ecd0c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Elision accepts exhausted iterator (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..81eda9cb2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-step-err.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+
+class C {
+ static async *method([,] = iter) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..d2f0237750
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Elision advances iterator (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..d401a805b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+class C {
+ static async *method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..ecda6d24ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..10c59b812a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an elision (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..2f30bb2ef3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..09707435a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element containing a rest element (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..e537cff630
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Lone rest element (direct binding) (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..423e11010b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element following elision elements (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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 iter = (function*() { throw new Test262Error(); })();
+
+
+class C {
+ static async *method([, ...x] = iter) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..00869aaa8c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element following elision elements (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..b0abbbe2af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..0ae2c20d79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+
+class C {
+ static async *method([...x] = iter) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..ae31b2d57d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+
+class C {
+ static async *method([...x] = iter) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..5b589769a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Lone rest element (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..44044f3eb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..1f4ef2d193
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..69208aad8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..3bcc910267
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..ec1fa94da8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..0a29490a51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async *method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..20c1d49c0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..a4b95d0178
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+class C {
+ static async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-init-null.js
new file mode 100644
index 0000000000..f7d708093b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-init-null.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+class C {
+ static async *method({} = null) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..fce7b7bca5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-init-undefined.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+class C {
+ static async *method({} = undefined) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..8fa75e42e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+class C {
+ static async *method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..55ed81fa09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+class C {
+ static async *method({ poisoned } = poisonedProperty) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..2cff36cace
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..cdbd26b9f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..5708745091
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..a96d8af870
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..af20584145
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..ca6e9dcd51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..d2b1224a33
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-throws.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ static async *method({ x = thrower() } = {}) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..0d19825c5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ static async *method({ x = unresolvableReference } = {}) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(ReferenceError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..0d6894ecc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..03cba933f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-list-err.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ static async *method({ a, b = thrower(), c = ++initCount } = {}) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..ef3df6831a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..bd79302bf9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..9ecc524d73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ static async *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..3188294db9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..86a97070e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ static async *method({ [thrower()]: x } = {}) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..0f81e66f30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+class C {
+ static async *method({ poisoned: x = ++initEvalCount } = poisonedProperty) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..d2451af9dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..19a9bae376
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ static async *method({ x: y = thrower() } = {}) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..d7991065a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ static async *method({ x: y = unresolvableReference } = {}) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(ReferenceError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..0c37300bc1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..c1d6d17e58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..a0230cf9c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Binding as specified via property name and identifier (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..073fa8b160
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..01294eb59d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..98d4fb877a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ static async *method({ w: { x, y, z } = undefined } = { }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..2eb83ddd26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..1699c9ccce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+class C {
+ static async *method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..76b2c8c842
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+class C {
+ static async *method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..194ab1b44d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template
+/*---
+description: Rest object contains just unextracted data (static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-init-null.js
new file mode 100644
index 0000000000..4a6f5b4aa4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-init-null.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+class C {
+ static async *method({}) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-init-undefined.js
new file mode 100644
index 0000000000..ac8d57a607
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-init-undefined.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+
+class C {
+ static async *method({}) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-empty.js
new file mode 100644
index 0000000000..ce0ebbb71e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+class C {
+ static async *method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(obj).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..1d626564fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+class C {
+ static async *method({ poisoned }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..9b0b599f1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..9dc36e1874
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..0e684035fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..d635b0ce41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..533c81af0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..03b6e64266
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: null, x: 0, y: false, z: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..1dcc2f6b66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-throws.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ static async *method({ x = thrower() }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..fe893ae967
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ static async *method({ x = unresolvableReference }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(ReferenceError, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..89465e0b5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..61738dde65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-list-err.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ static async *method({ a, b = thrower(), c = ++initCount }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method({});
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..6f1defad0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..b558efeed2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: [45] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..282fd957f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ static async *method({ w: [x, y, z] = [4, 5, 6] }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..2df85585ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: [7, undefined, ] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..a4148bacb8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Evaluation of property name returns an abrupt completion (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ static async *method({ [thrower()]: x }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..5f461c108c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+
+class C {
+ static async *method({ poisoned: x = ++initEvalCount }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..def869a0ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ s: null, u: 0, w: false, y: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..b7e27bc6e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+
+class C {
+ static async *method({ x: y = thrower() }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(Test262Error, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..e7a8ab369a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+
+class C {
+ static async *method({ x: y = unresolvableReference }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(ReferenceError, function() {
+ method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..ce52efd73e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..c6d8e8be1b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..64293ac1a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Binding as specified via property name and identifier (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..3c7522b6a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: undefined }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..ae4da3648a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..cc6e3d1357
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-async-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+ 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.
+---*/
+
+
+class C {
+ static async *method({ w: { x, y, z } = undefined }) {
+
+ }
+};
+
+var method = C.method;
+
+assert.throws(TypeError, function() {
+ method({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..3d2294027f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: { x: undefined, z: 7 } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..38dcd2d773
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-getter.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+class C {
+ static async *method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ get v() { count++; return 2; } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..5143f9a9f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+class C {
+ static async *method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method(o).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..5ebfa1d74f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-gen-meth-static-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-async-gen-meth-static.template
+/*---
+description: Rest object contains just unextracted data (static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async *method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({x: 1, y: 2, a: 5, b: 3}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-init-iter-close.js
new file mode 100644
index 0000000000..19a24ded09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-init-iter-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..03e28fa087
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-name-iter-val.js
new file mode 100644
index 0000000000..410e8902a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-name-iter-val.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding with normal value iteration (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..5b9050bf5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..41844de008
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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;
+class C {
+ async * #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([[7, 8, 9]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..5520244e7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..8d993e9bbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([[]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..9fde66c362
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..cb066b1376
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([[23]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..dd12f44406
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..20b151978e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([values]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..5496a30304
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..6a3470a3fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..2ca0c5e3e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..529e0a93b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..c06b4c9979
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..7dd6dfa167
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..b352098f81
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Destructuring initializer with a "hole" (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([,]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..3f9c1bcec0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([null, 0, false, '']).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..0c3ab10e36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Destructuring initializer with an undefined value (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([undefined]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..bff211d1be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration completes (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..c8b73f1cd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..78b68a7461
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,91 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+class C {
+ async * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..c28800c85e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..622a8bd8c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..e00fd0737f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([{ x: 11, y: 22, z: 33 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..1efefe8023
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..17fa349cc0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([{ u: 777, w: 888, y: 999 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..9329d9ee2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Elision accepts exhausted iterator (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([,]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision.js
new file mode 100644
index 0000000000..59ddb2ba59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-elision.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Elision advances iterator (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-empty.js
new file mode 100644
index 0000000000..127a9cf0a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-empty.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+class C {
+ async * #method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..1763b65583
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,94 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([3, 4, 5]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..7b5a1d1863
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element containing an elision (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..bf6b4a50a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element containing an "empty" array pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..f2d040c084
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element containing a rest element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..996e20e05f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Lone rest element (direct binding) (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..7a70484532
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element following elision elements (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..babfadc7ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: RestElement applied to an exhausted iterator (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..3cf9745d9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Lone rest element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..8173c0d217
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..8e5b3fc77f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-id.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element (identifier) does not support initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..d885c8e0d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..575416a727
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..644df958f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..61b0792d2e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..177f8bd1f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..1a3bd5ce97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+class C {
+ async * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([7, 8, 9]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..e7802751a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..4d8454731f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..aa340a7755
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..52852c8b6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..e567750f7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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;
+class C {
+ async * #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..40f784086a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..c1b2f5da1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..b68b78d842
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..9d94e82d62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..9abfa99a2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..b8c1f86af1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..904198433c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..7a25e06852
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..00bdef46f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..6c0f3b4422
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..f81e864f80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..4bb0e06d85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..3f519190a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..fc2aa2375b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..a79633a795
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..6fb0aed962
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..fcad842088
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..b48b5f926e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,91 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+class C {
+ async * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..d549b378de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..77dfeffcc9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..4afeb42775
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..a8ca812ea5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..e93618201b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..0a9e02aaac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Elision accepts exhausted iterator (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..679d0d7712
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Elision advances iterator (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..ccb5fe4d87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+class C {
+ async * #method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..fec42478c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,94 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..fd6a038345
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an elision (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..0ac607d8f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..d45f6b8ae1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element containing a rest element (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..74daeb06a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Lone rest element (direct binding) (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..b8518cd2f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element following elision elements (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..b0cae39208
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..16fd9b9b2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Lone rest element (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..908d9daf18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..b9ab976e1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..6c7606de6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..1aa6beda6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..de0c49ee6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..0087343fe4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ async * #method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..b2fe912932
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..ca4df07606
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+class C {
+ async * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..6cfe0efc2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+class C {
+ async * #method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..7210a2fc8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..b5e1486c4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..0a179ba8f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..b7922da54b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..41bee58fde
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..2dc7b1da97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..658536a8ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..8f487d0075
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..3039764b91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..1f1ac22b38
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..767b3ca69f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,88 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..2bb4af2d67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..bcf99d52d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..5ef002c189
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Binding as specified via property name and identifier (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..94b88cef28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..67a318fdee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..fe3c5ffc6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+class C {
+ async * #method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..442f06f168
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+class C {
+ async * #method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..e5c559f729
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-dflt.template
+/*---
+description: Rest object contains just unextracted data (private class expression async generator method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-empty.js
new file mode 100644
index 0000000000..61d4d48861
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-empty.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+class C {
+ async * #method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(obj).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..50f6297ec2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..e9948991f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2f21f174da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..f75b183ff7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..92a1366562
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..96c193c3ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: null, x: 0, y: false, z: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..244c353400
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..d6c07d1864
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..e0dda00e3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: [45] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..297066a35a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: [7, undefined, ] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..903b371b5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,88 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ s: null, u: 0, w: false, y: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..665d55bc64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..5aad3d9a13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..5cad542b70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Binding as specified via property name and identifier (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..3037b1934a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: undefined }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..c1fa963d96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: { x: undefined, z: 7 } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..054aef19b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+class C {
+ async * #method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ get v() { count++; return 2; } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..46cda116e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+class C {
+ async * #method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(o).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..240351f74b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth.template
+/*---
+description: Rest object contains just unextracted data (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ async * #method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({x: 1, y: 2, a: 5, b: 3}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js
new file mode 100644
index 0000000000..66a972d383
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..fd7ebdf0c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js
new file mode 100644
index 0000000000..9abdc616de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding with normal value iteration (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..bb2ba2f067
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..84915cb853
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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;
+class C {
+ static async * #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([[7, 8, 9]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..8dc61c0f97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..3bd83f8ad1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([[]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..028c11548f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..81e33ffeba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([[23]]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..f79eb67627
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..e5487f3f69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([values]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..e206146701
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..36f5c9b13d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..9f59830c46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..61b74f9d51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..c55a90eebb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..5d212cdf6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..2239a72507
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Destructuring initializer with a "hole" (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([,]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..4bb0151085
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([null, 0, false, '']).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..536c0b3e27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Destructuring initializer with an undefined value (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([undefined]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..24bc7cc81d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration completes (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..35dc2af10b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..b019de73d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,91 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+class C {
+ static async * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..8c0f250c87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..0e4dc249a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..a7bcfa0be6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([{ x: 11, y: 22, z: 33 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..f925a3978f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..572361b5b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([{ u: 777, w: 888, y: 999 }]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..23311821c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Elision accepts exhausted iterator (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([,]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js
new file mode 100644
index 0000000000..55759400ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Elision advances iterator (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js
new file mode 100644
index 0000000000..432da14434
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+class C {
+ static async * #method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..808fe116ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,94 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([3, 4, 5]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..95d2e48743
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element containing an elision (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(g()).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..2682225934
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element containing an "empty" array pattern (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..35c78d5e2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element containing a rest element (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..ada04375e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Lone rest element (direct binding) (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..a55d278363
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element following elision elements (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..bc1e06fd64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: RestElement applied to an exhausted iterator (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..5edb8a8c64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Lone rest element (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(values).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..fdad69769b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..1273c42bbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-id.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element (identifier) does not support initializer (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..7d95130a27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..ba3efaaed1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..8def309cf6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..af8f46ec29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..e582e00655
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..2138358f15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+class C {
+ static async * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([7, 8, 9]).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..28a6af3211
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..81970976b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..da5e4e4d2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..6e23720a1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..2669c6b221
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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;
+class C {
+ static async * #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..1968c9e22a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..dfa634b0d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..d5ebfdf456
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..5fea8f88b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..1ae393ea4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..931019587f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..d447402f19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..56d87f8a92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..f649f6ef50
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..0a3e35af26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..2cf6c7f89e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..b284579b73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// 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/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..936674029a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..28f90531cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..1df59acff9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..e7a12e886f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..53b706eabc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..311051b6a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,91 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+
+var callCount = 0;
+class C {
+ static async * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..4173a19f99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..b0678e4e9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..246b8f2e77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..092e48c799
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..e4f6807b5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..afa632e671
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Elision accepts exhausted iterator (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..526a289070
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Elision advances iterator (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..e2ecdcd8cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+
+var callCount = 0;
+class C {
+ static async * #method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..8ee224c8b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,94 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..fb1fdb9163
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an elision (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..6e8d7be1f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..b6e5e406eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing a rest element (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..704abfad48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Lone rest element (direct binding) (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..57c15a4170
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element following elision elements (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..d5ce0307a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..865ebc51dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Lone rest element (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..a4d551ad4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..98737ae8b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..75c51f5725
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..56c522be3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..15a5482253
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..8dd17cbcf7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+class C {
+ static async * #method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..e5f5eb8a37
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..a7b3375013
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+
+var callCount = 0;
+class C {
+ static async * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..ea9d36dbfe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+class C {
+ static async * #method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..eb613df976
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..f00a43e200
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..1f39ccad4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..e3392ea16d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..224933e9a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..c43913f345
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..2de5d499be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..6ad473ebd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..d37273c692
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..f3f8e4c585
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..73805697a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,88 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..d6ddc3b435
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..f503d2b36b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..cfdbe14355
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Binding as specified via property name and identifier (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..a3e3b63c78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..a02754ce1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..329ab3412a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+class C {
+ static async * #method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..2e16bc72fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+class C {
+ static async * #method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..6b4fa0c5a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static-dflt.template
+/*---
+description: Rest object contains just unextracted data (private static class expression async generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js
new file mode 100644
index 0000000000..9da9ee901e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+
+var callCount = 0;
+class C {
+ static async * #method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(obj).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..91af8421c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..c29cb50aba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..c3548fc2f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..c872338099
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..29c6cb6d02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..57c11c9ec8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: null, x: 0, y: false, z: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..2e804c4278
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..7de01e3581
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..69df272711
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: [45] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..d4641d51cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: [7, undefined, ] }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..84cdb306de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,88 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ s: null, u: 0, w: false, y: '' }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..9adc2a6838
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..8bcc12a4e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..af2601e576
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Binding as specified via property name and identifier (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: 23 }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..2686a72d90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: undefined }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..f0a49a842f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 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 callCount = 0;
+class C {
+ static async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: { x: undefined, z: 7 } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..0590d88ed6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var count = 0;
+
+
+var callCount = 0;
+class C {
+ static async * #method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ get v() { count++; return 2; } }).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..913b83b81a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+
+var callCount = 0;
+class C {
+ static async * #method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(o).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..d88e0414db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-async-private-gen-meth-static.template
+/*---
+description: Rest object contains just unextracted data (private static class expression async generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+---*/
+
+
+var callCount = 0;
+class C {
+ static async * #method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({x: 1, y: 2, a: 5, b: 3}).next().then(() => {
+ assert.sameValue(callCount, 1, 'invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/dstr/browser.js b/js/src/tests/test262/language/statements/class/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-close.js
new file mode 100644
index 0000000000..60f8762b99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-close.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..6d109041dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+class C {
+ *method([x, y, z]) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..7a49a318e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-get-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+class C {
+ *method([x]) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..f8168190de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-init-iter-no-close.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-name-iter-val.js
new file mode 100644
index 0000000000..6e007890ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-name-iter-val.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding with normal value iteration (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..e900afa05e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..ebb9072276
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ *method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([[7, 8, 9]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..e7a6728f0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..38e712609c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([[]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..d8fb02b065
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..7da1531868
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([[23]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..89e570be58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..7358b4b9a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([values]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..45d18bbfdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Nested array destructuring with a null value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+class C {
+ *method([[x]]) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..e925049d88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer with an exhausted iterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..a968f65793
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..3325408c54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2210300270
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,88 @@
+// 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/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..620b3f4c83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,88 @@
+// 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/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..5437fef254
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..905c2fddeb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer with a "hole" (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([,]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..2874fe472b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([null, 0, false, '']).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..e5b20512dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+class C {
+ *method([x = (function() { throw new Test262Error(); })()]) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..bd91406569
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer with an undefined value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([undefined]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..d07e7e0581
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ *method([ x = unresolvableReference ]) {}
+};
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..36d8c27df3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration completes (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..56f7eacfd4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..e8d9e954bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+class C {
+ *method([x]) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..92185b6425
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..77431f912f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ *method([x]) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..392cc78b3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..f120020eca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..2551614b44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([{ x: 11, y: 22, z: 33 }]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..eb07682d7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..765472dadd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([{ u: 777, w: 888, y: 999 }]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..caf17f56d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Nested object destructuring with a null value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ *method([{ x }]) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..9ecce046aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Nested object destructuring with a value of `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ *method([{ x }]) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..8bd26ce047
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Elision accepts exhausted iterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([,]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..bc284194bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision-step-err.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+class C {
+ *method([,]) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision.js
new file mode 100644
index 0000000000..8a12b5b037
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-elision.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Elision advances iterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(g()).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-empty.js
new file mode 100644
index 0000000000..f3527a3f1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-empty.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ *method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..5b866bb28b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element containing an array BindingElementList pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([3, 4, 5]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..bdee78b8b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,114 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element containing an elision (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(g()).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..6c3f3e5c5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element containing an "empty" array pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..233928fd22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element containing a rest element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..a3b2f44b6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Lone rest element (direct binding) (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ *method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..85b69a2327
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Rest element following elision elements (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+class C {
+ *method([, ...x]) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..9f130353aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element following elision elements (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..3cd99f1515
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: RestElement applied to an exhausted iterator (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..07ea6817ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+class C {
+ *method([...x]) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..c472664e6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ *method([...x]) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..7ad33056b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-id.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Lone rest element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..cbb298e900
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..49bb698e7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-id.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element (identifier) does not support initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..1fa29db40a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..a9774c5ae3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..a7e5be6e6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element (identifier) may not be followed by any element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..33c6f5c0f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..5479300a4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element containing an object binding pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..64ebfbc9fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest element containing an object binding pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([7, 8, 9]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..cfcbe4ea69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-close.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..f348b2fc00
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+class C {
+ *method([x, y, z] = [1, 2, 3]) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..ee72353d3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-get-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+class C {
+ *method([x] = iter) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..9b23534760
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..88958102ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-name-iter-val.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..9eacb9ef6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..48e49cf3a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..4d043eb182
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..886051a0d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..b092e8a660
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..9c9cc980fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..053f3d1efd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..58283e5804
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..03bc2d230c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Nested array destructuring with a null value (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+class C {
+ *method([[x]] = [null]) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..b2098fed17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..7d23bbdcba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..5471431d8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..1828e71634
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,88 @@
+// 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/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..6f1642b4fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,88 @@
+// 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/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..0931a63e13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..e82a3df6cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..56e457f2e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..7bbc85e5fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+class C {
+ *method([x = (function() { throw new Test262Error(); })()] = [undefined]) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..eecfbf8d14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..6e7a339f33
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ *method([ x = unresolvableReference ] = []) {}
+};
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..68b2a5290a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..02d0772a78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..c617460958
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+class C {
+ *method([x] = g) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..f22588a401
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..aaad4685c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ *method([x] = g) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..2d7bf80199
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..2b462e3380
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..4722fe8d09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..16c9d00275
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..78c5ca1cfb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..0917834752
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Nested object destructuring with a null value (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ *method([{ x }] = [null]) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..fb34d8d82a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ *method([{ x }] = []) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..f5413c7c7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Elision accepts exhausted iterator (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..bb7338d6d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+class C {
+ *method([,] = iter) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..d167145dd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-elision.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Elision advances iterator (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..37f8dc6aec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-empty.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ *method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..4fea96c065
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..48e9025589
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,114 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element containing an elision (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..dba39b1949
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..fa021d284b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element containing a rest element (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..6925899c92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Lone rest element (direct binding) (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ *method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..05387d8438
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element following elision elements (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+class C {
+ *method([, ...x] = iter) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..2f1298217e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element following elision elements (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..e99a2b7b0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..665fe77298
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+class C {
+ *method([...x] = iter) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..c94e0f6659
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ *method([...x] = iter) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..728e7a642e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Lone rest element (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..08ea4666b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..409d798503
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..3741aa88d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..8283c7463b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..e22718babc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..312d328db3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ *method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..25f0cb92f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..41427219bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-init-null.js
new file mode 100644
index 0000000000..4395e91747
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-init-null.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ *method({} = null) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..f115e339d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-init-undefined.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ *method({} = undefined) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..5c24f90ccf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-empty.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ *method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..8c41bcb23a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ *method({ poisoned } = poisonedProperty) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..e99280252a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..bfd333f0e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..0065e7b980
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..177633fd22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..6bb67edddf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..d4c4876ade
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..b793663a73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ *method({ x = thrower() } = {}) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..00664b78a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ *method({ x = unresolvableReference } = {}) {}
+};
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..dba2e28897
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..3725990759
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-list-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ *method({ a, b = thrower(), c = ++initCount } = {}) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..e72f38564b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..bf00460a7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..0cd2840e41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..74866111c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..904950e1e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ *method({ [thrower()]: x } = {}) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..c4e1c9db3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ *method({ poisoned: x = ++initEvalCount } = poisonedProperty) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..ac98760dd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,102 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..7dec62ce79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ *method({ x: y = thrower() } = {}) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..7692318e73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ *method({ x: y = unresolvableReference } = {}) {}
+};
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..4abf16cd7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..97ab5b3fe7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..0aefdeec97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Binding as specified via property name and identifier (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..9a92c631d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..9f19d4f352
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..4d1195bac2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method (default parameter))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ *method({ w: { x, y, z } = undefined } = { }) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..5ff981ed8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..51409659a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ *method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..ad488f077c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ *method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..5d0d7432d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-dflt.template
+/*---
+description: Rest object contains just unextracted data (class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-init-null.js
new file mode 100644
index 0000000000..ad20c081cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-init-null.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ *method({}) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-init-undefined.js
new file mode 100644
index 0000000000..569d3cc1f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-init-undefined.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ *method({}) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-empty.js
new file mode 100644
index 0000000000..0e9aa3d97a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-empty.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ *method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(obj).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..05cfd3eeeb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ *method({ poisoned }) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..3f6883e35e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..4fccb76131
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..815c048576
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..60773be254
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..01dd1f669f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..16a058c0d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: null, x: 0, y: false, z: '' }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..9a6a7a50aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-throws.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ *method({ x = thrower() }) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..47b81f95bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ *method({ x = unresolvableReference }) {}
+};
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..bd77979097
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..546a5f8472
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-list-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ *method({ a, b = thrower(), c = ++initCount }) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method({});
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..7eb51afb83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..1628761752
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: [45] }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..43b84378d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ *method({ w: [x, y, z] = [4, 5, 6] }) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..b942628839
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-ary.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: [7, undefined, ] }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..9b9d37c223
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Evaluation of property name returns an abrupt completion (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ *method({ [thrower()]: x }) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..8b81f05740
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ *method({ poisoned: x = ++initEvalCount }) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..ba0674aa04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,102 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ s: null, u: 0, w: false, y: '' }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..8f3618919e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ *method({ x: y = thrower() }) {}
+};
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..6dd3658aee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ *method({ x: y = unresolvableReference }) {}
+};
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..8eb689f206
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-init.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..6147800da2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..a0b0435795
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-id.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Binding as specified via property name and identifier (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ *method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..7adfb5287f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: undefined }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..38eb7c1859
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..d64dc82e19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ *method({ w: { x, y, z } = undefined }) {}
+};
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..3eb571e88b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-prop-obj.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: { x: undefined, z: 7 } }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..32c9e80a9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-getter.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ *method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ get v() { count++; return 2; } }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..20d9f89818
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ *method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(o).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..8d272c8273
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth.template
+/*---
+description: Rest object contains just unextracted data (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ *method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({x: 1, y: 2, a: 5, b: 3}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-close.js
new file mode 100644
index 0000000000..3a3d91d039
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-close.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..a488358c5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+class C {
+ static *method([x, y, z]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..ec7bc1288e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-get-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+class C {
+ static *method([x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..f4e91c513d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-init-iter-no-close.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-name-iter-val.js
new file mode 100644
index 0000000000..45b68377c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-name-iter-val.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding with normal value iteration (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..7ad4563944
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..132ea0c923
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ static *method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([[7, 8, 9]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..9f72547316
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..40fcc2f144
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([[]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..64903ad17b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..c357654f9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([[23]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..073749c71e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..08326bb80e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([values]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..0a3c9fad87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Nested array destructuring with a null value (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+class C {
+ static *method([[x]]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..c8321ead6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer with an exhausted iterator (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..d2a9930873
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..c5ad7cdad5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..64adf969ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,88 @@
+// 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/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..f23d95c569
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,88 @@
+// 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/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..63abad2c3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..345ca0e8f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer with a "hole" (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+C.method([,]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..98eac43502
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([null, 0, false, '']).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..7feef62677
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer returns an abrupt completion (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+class C {
+ static *method([x = (function() { throw new Test262Error(); })()]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..efccb8a3cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer with an undefined value (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([undefined]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..004d863005
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static *method([ x = unresolvableReference ]) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..f36b552cfb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration completes (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..0216f63489
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..a509bba319
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+class C {
+ static *method([x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..68860f3f69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ static *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..705a3a03f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ static *method([x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..4f011e0701
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..1517c7038a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..1fb34c42e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([{ x: 11, y: 22, z: 33 }]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..fcd72cd0b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..a5e71946c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method([{ u: 777, w: 888, y: 999 }]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..924beb7a1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Nested object destructuring with a null value (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ static *method([{ x }]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..60fc8fa75b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Nested object destructuring with a value of `undefined` (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ static *method([{ x }]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..dfd2b53f64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Elision accepts exhausted iterator (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([,]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..62ddc8cbfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision-step-err.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+class C {
+ static *method([,]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision.js
new file mode 100644
index 0000000000..c7250ca05c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-elision.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Elision advances iterator (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(g()).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-empty.js
new file mode 100644
index 0000000000..f68b91f4b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-empty.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ static *method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..166f67d6fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element containing an array BindingElementList pattern (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([3, 4, 5]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..7cf8377d43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,114 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element containing an elision (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(g()).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..6e73d5c0fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element containing an "empty" array pattern (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..4a6a2e7c35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element containing a rest element (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..8a107ed1c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Lone rest element (direct binding) (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ static *method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..c5a89eb956
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Rest element following elision elements (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+class C {
+ static *method([, ...x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..719b55c61a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element following elision elements (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..6426ecf207
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: RestElement applied to an exhausted iterator (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..0990a7bafc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+class C {
+ static *method([...x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..faab033428
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ static *method([...x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..8e7fdd3e98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-id.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Lone rest element (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..473e6eaa98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..bebffcfdbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-id.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element (identifier) does not support initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..74137c3696
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..7820542366
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..71fc80a8ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element (identifier) may not be followed by any element (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..b3bd8c84a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..0e17d0f97b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..81820ac50b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ static *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+C.method([7, 8, 9]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..c215d6656b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-close.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..911ef43eb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+class C {
+ static *method([x, y, z] = [1, 2, 3]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..1b7496d07c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+class C {
+ static *method([x] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..51fdd14c5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..2469ff5c6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-name-iter-val.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..da84e745df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..2c06f60599
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ static *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..3e317c4701
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..fc374e0f44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..a28746a7ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..70f13b13f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..8c758022e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..bea4026d96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..d844c24475
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Nested array destructuring with a null value (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+class C {
+ static *method([[x]] = [null]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..be61a9d8f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..383abd12c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..1ee19dc8e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..9b593d072b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,88 @@
+// 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/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..6d6b0a714f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,88 @@
+// 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/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..3d3cc773fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..908345bb13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..4db81f201a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..2fc460b448
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+class C {
+ static *method([x = (function() { throw new Test262Error(); })()] = [undefined]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..047af41234
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..c5f816ba20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static *method([ x = unresolvableReference ] = []) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..6160d0b401
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..44e4238e1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..1293c8a74c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+class C {
+ static *method([x] = g) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..522e14dd85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ static *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..709208fd61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ static *method([x] = g) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..7618e04432
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..991e3c9bdc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..2867b76609
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..02ce6b0c0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..1a8b30b593
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..f051c6b331
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Nested object destructuring with a null value (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ static *method([{ x }] = [null]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..a804b5eb17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ static *method([{ x }] = []) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..eaf3c5f4dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Elision accepts exhausted iterator (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..1d318233ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-step-err.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+class C {
+ static *method([,] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..41fa6cca35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-elision.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Elision advances iterator (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..5a545c2c2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-empty.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ static *method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..709bf8f2d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..266b6e8faf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,114 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an elision (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..56b39ef77e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..3d3c3f923b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element containing a rest element (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..b6f3327a44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Lone rest element (direct binding) (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ static *method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..bfa213cecf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element following elision elements (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+class C {
+ static *method([, ...x] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..d43cc7a748
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element following elision elements (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..4fac33c15f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..18d925e236
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+class C {
+ static *method([...x] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..0239380bc3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ static *method([...x] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..12dde164e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Lone rest element (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..89fd8a30e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..40bb240d07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..b24b90b955
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..4851b08cfb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..40f1add548
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..e325248831
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,82 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static *method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..76b85b23a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..b1a0dfae26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ static *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-init-null.js
new file mode 100644
index 0000000000..35e88231ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-init-null.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ static *method({} = null) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..42a9e2a75e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-init-undefined.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ static *method({} = undefined) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..ad1960b0b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-empty.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ static *method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..43a917c57c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ static *method({ poisoned } = poisonedProperty) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..48944fc65b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..025bd7d90d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..662fb849d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..c636fd2d4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..9bbb3b06d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..b4b2787963
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..9739de71c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-throws.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static *method({ x = thrower() } = {}) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..e25fb1b496
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static *method({ x = unresolvableReference } = {}) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..c7f99ae884
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..2bbdb4261d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-list-err.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static *method({ a, b = thrower(), c = ++initCount } = {}) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..26742762cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..bfa832e1d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..724095625c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..4277491363
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..873dc625c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static *method({ [thrower()]: x } = {}) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..55a6fea28c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ static *method({ poisoned: x = ++initEvalCount } = poisonedProperty) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..668c518f36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,102 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..4036ce4dd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static *method({ x: y = thrower() } = {}) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..272edfbc99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static *method({ x: y = unresolvableReference } = {}) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..4a4b492bca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..346669cbd0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..b157c71677
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Binding as specified via property name and identifier (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..4b929c3ca3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..a2b51e2f45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..62b845667a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static *method({ w: { x, y, z } = undefined } = { }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..aaf80b4764
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..f73c062841
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ static *method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..07bc5f9764
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ static *method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..f4f3d799c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template
+/*---
+description: Rest object contains just unextracted data (static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ static *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-init-null.js
new file mode 100644
index 0000000000..2ef714fd6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-init-null.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ static *method({}) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-init-undefined.js
new file mode 100644
index 0000000000..9e983ee2cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-init-undefined.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ static *method({}) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-empty.js
new file mode 100644
index 0000000000..0cb56067ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-empty.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ static *method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(obj).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..e9185fa545
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ static *method({ poisoned }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..87997fca05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..7e6d35bc59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..21965c66b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..d7b1d4d2c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..44a81b541f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..83ff468f2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: null, x: 0, y: false, z: '' }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..d6e7e9e883
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-throws.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static *method({ x = thrower() }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..0e27e7c683
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static *method({ x = unresolvableReference }) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..3b09a587ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..248afa936c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-list-err.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static *method({ a, b = thrower(), c = ++initCount }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method({});
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..1d8e2f1b5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..fdf2ab2476
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: [45] }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..3ea5b90bc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static *method({ w: [x, y, z] = [4, 5, 6] }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..88b59b373a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-ary.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: [7, undefined, ] }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..bfb43c4555
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Evaluation of property name returns an abrupt completion (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static *method({ [thrower()]: x }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..6f70fc507a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ static *method({ poisoned: x = ++initEvalCount }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..1d7a5f67f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,102 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ s: null, u: 0, w: false, y: '' }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..c9be76292d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static *method({ x: y = thrower() }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..3920ec1b93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static *method({ x: y = unresolvableReference }) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..648afc2365
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-init.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..e049b373cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..a444b24983
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-id.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Binding as specified via property name and identifier (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static *method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..6dc29d04c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: undefined }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..6d5453ea3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..4af1f1ec0b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static *method({ w: { x, y, z } = undefined }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..50eb623cb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-prop-obj.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: { x: undefined, z: 7 } }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..3d02788c95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-getter.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ static *method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ get v() { count++; return 2; } }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..ceed609fce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ static *method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method(o).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..a7bba684b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/gen-meth-static-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-gen-meth-static.template
+/*---
+description: Rest object contains just unextracted data (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ static *method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({x: 1, y: 2, a: 5, b: 3}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-close.js
new file mode 100644
index 0000000000..005ab4212b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-close.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..3ea10b1bba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+class C {
+ method([x, y, z]) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..f35ae02a6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-get-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+class C {
+ method([x]) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..ef34711a63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-init-iter-no-close.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-name-iter-val.js
new file mode 100644
index 0000000000..de708238d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-name-iter-val.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: SingleNameBinding with normal value iteration (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..0ab7d31f63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..bff42e9ed6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([[7, 8, 9]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..6664c608dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..d039d4a783
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([[]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..ea075f405c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..afaa677dfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([[23]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..0d70ed2f3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..973529fd11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([values]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..17ecd68f3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Nested array destructuring with a null value (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+class C {
+ method([[x]]) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..f646aeeb91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Destructuring initializer with an exhausted iterator (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..386cf5f99a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,85 @@
+// 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/cls-decl-meth.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..cbb022ae7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..3ff3b6d099
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,86 @@
+// 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/cls-decl-meth.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..cf77ae9bb8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,86 @@
+// 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/cls-decl-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..d5d602bcac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..ffc7ee9150
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Destructuring initializer with a "hole" (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([,]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..e42b431c4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([null, 0, false, '']);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..5d64c1244c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Destructuring initializer returns an abrupt completion (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+class C {
+ method([x = (function() { throw new Test262Error(); })()]) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..d637e61223
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Destructuring initializer with an undefined value (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([undefined]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..4e2298f444
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ method([ x = unresolvableReference ]) {}
+};
+
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..ad42383ae3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: SingleNameBinding when value iteration completes (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..5104806e25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..cf3dfa6ef2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+class C {
+ method([x]) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..14d0ad72ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..96b3148560
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ method([x]) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..68833d503e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..6cbe47422c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..95650ac497
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([{ x: 11, y: 22, z: 33 }]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..db9badd5e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..8304975b93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([{ u: 777, w: 888, y: 999 }]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..7657d0414d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Nested object destructuring with a null value (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ method([{ x }]) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..df76a7f537
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Nested object destructuring with a value of `undefined` (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ method([{ x }]) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..46ac9945fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Elision accepts exhausted iterator (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([,]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..ea26c3aaf7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision-step-err.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+class C {
+ method([,]) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision.js
new file mode 100644
index 0000000000..94695ff321
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-elision.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Elision advances iterator (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(g());
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-empty.js
new file mode 100644
index 0000000000..fef6b48e0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-empty.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..21cd0216f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element containing an array BindingElementList pattern (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([3, 4, 5]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..7522fe40c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element containing an elision (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(g());
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..155abede58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element containing an "empty" array pattern (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..4bd1b7640c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element containing a rest element (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..88b8749969
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Lone rest element (direct binding) (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..aae9152dc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Rest element following elision elements (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+class C {
+ method([, ...x]) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..c8e14a5038
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element following elision elements (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..36b68b678e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: RestElement applied to an exhausted iterator (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..4e8dbe5587
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+class C {
+ method([...x]) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..017032252e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ method([...x]) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..2dd80d774b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-id.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Lone rest element (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..d2bc0a9903
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..996eec5e90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-id.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element (identifier) does not support initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..388e6f26b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..2a6de08dfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..0ee09dfa59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element (identifier) may not be followed by any element (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..140b929319
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..a9a9252c74
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element containing an object binding pattern (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..a9d8735976
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest element containing an object binding pattern (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+new C().method([7, 8, 9]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..d5fd2fde69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-close.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..7447e35f81
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+class C {
+ method([x, y, z] = [1, 2, 3]) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..3e33190ed1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-get-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+class C {
+ method([x] = iter) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..4d2b4afbe3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..a750f1a5f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-name-iter-val.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..b9a8aaa625
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..ed81931b07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..18a060e4b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..ca7a23457d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..7557d56e0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..5a2e1e20f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..8106d4e1c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..d9739b0256
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..f52f2de2cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Nested array destructuring with a null value (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+class C {
+ method([[x]] = [null]) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..401917ddc4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..2880a9e9a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,85 @@
+// 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/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..127d3c4cc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..9879ac042c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,86 @@
+// 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/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..8981ce4a2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,86 @@
+// 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/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..756deb15da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..9e2d008c33
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..364f518c22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..636e8b17c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+class C {
+ method([x = (function() { throw new Test262Error(); })()] = [undefined]) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..0aa4f7af54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..5f3153fb69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ method([ x = unresolvableReference ] = []) {}
+};
+
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..4c9d487bd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..9e3930e1c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..32dd893be0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+class C {
+ method([x] = g) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..2b19156b41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..75827ac733
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ method([x] = g) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..e605a40034
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..ed59a156b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..89f8f2a890
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..2916687ce2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..162a807165
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..4fca071ff6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Nested object destructuring with a null value (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ method([{ x }] = [null]) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..cd17eac0cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ method([{ x }] = []) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..86f9bbf5b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Elision accepts exhausted iterator (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..e7be6aac4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision-step-err.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+class C {
+ method([,] = iter) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..4b19df93bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-elision.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Elision advances iterator (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..7a98296dd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-empty.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..af0957121c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..4b92ccdcb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element containing an elision (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..17fc39a214
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..bc541b73f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element containing a rest element (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..129fb000db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Lone rest element (direct binding) (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..987bec94f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Rest element following elision elements (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+class C {
+ method([, ...x] = iter) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..6f27b0b9cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element following elision elements (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..9d7adc641f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..aef6bb4a49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+class C {
+ method([...x] = iter) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..2e505bfba1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ method([...x] = iter) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..d4e5e0f892
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Lone rest element (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..1d009b3318
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..d494273cbc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..590b6cc240
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..cec717b63f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..937a57aaf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..9a75b35c3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..a5ff0b91eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..40a7166178
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-init-null.js
new file mode 100644
index 0000000000..b999133400
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-init-null.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ method({} = null) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..11234a1875
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-init-undefined.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ method({} = undefined) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..01594d5443
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-empty.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..6f39d99969
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ method({ poisoned } = poisonedProperty) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..6cfefaf62f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..aba947c3e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..5a31c9cf3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..7593b3c947
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..80974cc4ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..a2754f9944
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..02dde5b5a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-throws.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ method({ x = thrower() } = {}) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..376a67c7e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ method({ x = unresolvableReference } = {}) {}
+};
+
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..38236ebb18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..fadaa36c49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-list-err.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ method({ a, b = thrower(), c = ++initCount } = {}) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..264340a818
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..776d3bf0b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..d93c5454c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..53a57ce4ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..b9eb618795
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ method({ [thrower()]: x } = {}) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..970e57ae02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ method({ poisoned: x = ++initEvalCount } = poisonedProperty) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..273e568703
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..f0a0b526b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ method({ x: y = thrower() } = {}) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..5e6109f2a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ method({ x: y = unresolvableReference } = {}) {}
+};
+
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..508b41ffaf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..360ec7e092
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..417188f461
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Binding as specified via property name and identifier (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..68bf8916e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..2c78d5ca19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..d182ca7445
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ method({ w: { x, y, z } = undefined } = { }) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..9a01630eab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..89b6da687f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..3952729118
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..18908855db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-meth-dflt.template
+/*---
+description: Rest object contains just unextracted data (class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-init-null.js
new file mode 100644
index 0000000000..d6f298a8f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-init-null.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ method({}) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-init-undefined.js
new file mode 100644
index 0000000000..a06de3fe97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-init-undefined.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ method({}) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-empty.js
new file mode 100644
index 0000000000..dc950e43ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-empty.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(obj);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..1a1937db61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ method({ poisoned }) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..2d22819e73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..464465222b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2f5349cdf6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..6b3c83bc9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..5c33c28105
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..c4d4b79c48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: null, x: 0, y: false, z: '' });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..dd55f4bce6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-throws.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ method({ x = thrower() }) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..c8cbe8551a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ method({ x = unresolvableReference }) {}
+};
+
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..bd34550744
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..d95d4e82b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-list-err.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ method({ a, b = thrower(), c = ++initCount }) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method({});
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..b15189fcf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..881d22c338
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: [45] });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..d63a34a3cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ method({ w: [x, y, z] = [4, 5, 6] }) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..d34fdd1dda
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-ary.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: [7, undefined, ] });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..5c3fa0712e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Evaluation of property name returns an abrupt completion (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ method({ [thrower()]: x }) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..673cfab5d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ method({ poisoned: x = ++initEvalCount }) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..46cbd78ea0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ s: null, u: 0, w: false, y: '' });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..085d3a2db1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Error thrown when evaluating the initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ method({ x: y = thrower() }) {}
+};
+
+var c = new C();
+
+assert.throws(Test262Error, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..ce537ad84c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Destructuring initializer is an unresolvable reference (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ method({ x: y = unresolvableReference }) {}
+};
+
+var c = new C();
+
+assert.throws(ReferenceError, function() {
+ c.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..3fb9ca6909
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-init.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..77d1feff57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..4183736d42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-id.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Binding as specified via property name and identifier (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..adf11a5ed1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: undefined });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..0055aeac99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..fee809c44d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ method({ w: { x, y, z } = undefined }) {}
+};
+
+var c = new C();
+
+assert.throws(TypeError, function() {
+ c.method({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..40121ab0d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-prop-obj.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ w: { x: undefined, z: 7 } });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..9bd46cfd6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-getter.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({ get v() { count++; return 2; } });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..0507093351
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method(o);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..256e56ef0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-meth.template
+/*---
+description: Rest object contains just unextracted data (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+new C().method({x: 1, y: 2, a: 5, b: 3});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-close.js
new file mode 100644
index 0000000000..500e8143c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-close.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..a0e1a411bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+class C {
+ static method([x, y, z]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..aabe99798b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-get-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+class C {
+ static method([x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..f0e2c20b70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-init-iter-no-close.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-name-iter-val.js
new file mode 100644
index 0000000000..2dae5048f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-name-iter-val.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding with normal value iteration (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..c2d94c04f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..701808e01d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ static method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([[7, 8, 9]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..151ced0c89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..60f4dc10d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([[]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..e5baeeb181
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..96fe933c77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([[23]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..2dc3a0a2fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..3cb5844ac6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([values]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..26d4a15eab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Nested array destructuring with a null value (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+class C {
+ static method([[x]]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..1a855e64e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer with an exhausted iterator (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..41822de003
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,85 @@
+// 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/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..1c3a215c7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..87555c71ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,86 @@
+// 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/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..cb90504051
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,86 @@
+// 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/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..123fee6fa6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..008697629e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer with a "hole" (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+C.method([,]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..61072d87c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([null, 0, false, '']);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..bf484b0875
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer returns an abrupt completion (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+class C {
+ static method([x = (function() { throw new Test262Error(); })()]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..8581e1c790
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer with an undefined value (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([undefined]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..d547915dd4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static method([ x = unresolvableReference ]) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..406883eba1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding when value iteration completes (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..366e8bbb4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..bc5e9491c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+class C {
+ static method([x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..6c1e06ecc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ static method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..545132ea44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ static method([x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..23fbd2b225
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..d0c7653682
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..8bd1848300
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([{ x: 11, y: 22, z: 33 }]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..cae912d565
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..f734f70da7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method([{ u: 777, w: 888, y: 999 }]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..c634ba1566
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Nested object destructuring with a null value (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ static method([{ x }]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..f79592341c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Nested object destructuring with a value of `undefined` (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ static method([{ x }]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..809296796d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Elision accepts exhausted iterator (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([,]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..6dec356bd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision-step-err.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+class C {
+ static method([,]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision.js
new file mode 100644
index 0000000000..fb75ef7921
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-elision.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Elision advances iterator (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(g());
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-empty.js
new file mode 100644
index 0000000000..bfd4073a97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-empty.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ static method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..e53d40f16e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element containing an array BindingElementList pattern (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([3, 4, 5]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..9ec22d241c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element containing an elision (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(g());
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..7f82bd1ad8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element containing an "empty" array pattern (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..6e2f19c1fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element containing a rest element (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..53b80e77e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Lone rest element (direct binding) (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ static method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..b272895f4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Rest element following elision elements (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+class C {
+ static method([, ...x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..bfb6ddb88e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element following elision elements (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..36dcf31e01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: RestElement applied to an exhausted iterator (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..f15808f0fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+class C {
+ static method([...x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..b030b5c809
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ static method([...x]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..801bd582fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-id.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Lone rest element (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..da6176dbf7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..e056fd74a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-id.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element (identifier) does not support initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..bcc72d51bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..fbead3414b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..0c56098718
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element (identifier) may not be followed by any element (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..04dccb553b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..3eaf12affe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..580e6e2474
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ static method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+C.method([7, 8, 9]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..a2d21847dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-close.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..62bd70103c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+class C {
+ static method([x, y, z] = [1, 2, 3]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..008df29b09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-get-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+class C {
+ static method([x] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..c06666e67b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..87e353dca5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-name-iter-val.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..151b7b08ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..444eb1131f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ static method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..21a1ece746
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..b2bbd718b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..fbf6db5f0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..deed39c61d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..ee024c106e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..46d39662c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..6f2266bc2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Nested array destructuring with a null value (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+class C {
+ static method([[x]] = [null]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..93d288f4be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..41c1c034a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,85 @@
+// 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/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..64fe77970d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..3ca7b8fa46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,86 @@
+// 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/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..ce09d93690
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,86 @@
+// 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/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..7d3bd26dea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,87 @@
+// 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/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..b54ce90f2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..6e132d3fa6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..8d7c82bd21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+class C {
+ static method([x = (function() { throw new Test262Error(); })()] = [undefined]) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..98be07a5d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..11660bc235
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static method([ x = unresolvableReference ] = []) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..0c185833ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..1a7875583c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..413d2db6ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+class C {
+ static method([x] = g) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..1dbf119c2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ static method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..78d689ed44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ static method([x] = g) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..b687c1d24a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..8bee682ca7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..078ed2493c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..7c1e5eeba7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..8b0ea301c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..824f63ef6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Nested object destructuring with a null value (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ static method([{ x }] = [null]) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..a52286646a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+class C {
+ static method([{ x }] = []) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..8d536d8bf9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Elision accepts exhausted iterator (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..478c54ebc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision-step-err.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+class C {
+ static method([,] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..974efa1e98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-elision.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Elision advances iterator (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..2abad8546c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-empty.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ static method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..9d05ce26f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..7985bce454
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element containing an elision (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..82489d494b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..5532e679b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element containing a rest element (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..23e357765e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Lone rest element (direct binding) (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ static method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..1fda23354a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element following elision elements (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+class C {
+ static method([, ...x] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..bd1bd72375
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element following elision elements (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..4dac070b95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..789cce3fcc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+class C {
+ static method([...x] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..3f8c537878
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+class C {
+ static method([...x] = iter) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..9196483b26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Lone rest element (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...x] = 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..becf98ed27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..cb38592a52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..8df5adb4b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..47c21d6b6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..aa6f0654d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..c936e7d16a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,80 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..bfe824cd54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..8616c2eaf9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ static method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-init-null.js
new file mode 100644
index 0000000000..0df12743b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-init-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ static method({} = null) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..5482a527df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-init-undefined.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ static method({} = undefined) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..1dcb78a2f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-empty.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ static method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..0c8e610e1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ static method({ poisoned } = poisonedProperty) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..db5d64d7c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..8a6acdd653
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..4c92b603ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..33fe20608e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..254a45fb30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..16d7f045a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..7f26af06e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-throws.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static method({ x = thrower() } = {}) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..3f296a8bbc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static method({ x = unresolvableReference } = {}) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..09fc7b81f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..100b54214c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-list-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static method({ a, b = thrower(), c = ++initCount } = {}) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..ef6b6e1a85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..32afec6816
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..b9fec2f199
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..d40c513688
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..1f4fd2c000
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static method({ [thrower()]: x } = {}) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..6d011ce820
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ static method({ poisoned: x = ++initEvalCount } = poisonedProperty) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..533e81f45e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..331ef4acfd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static method({ x: y = thrower() } = {}) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..34e0fe5d3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static method({ x: y = unresolvableReference } = {}) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..c6cf8b08a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..6571168670
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..4fe6779887
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Binding as specified via property name and identifier (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..9012ab99f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..2511427ef0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..e44cb5afa4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static method({ w: { x, y, z } = undefined } = { }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..fc5fe12ffb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..6c44ed25f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ static method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..421c74c656
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ static method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..920a42ae46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-meth-static-dflt.template
+/*---
+description: Rest object contains just unextracted data (static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ static method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-init-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-init-null.js
new file mode 100644
index 0000000000..1dcebc3119
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-init-null.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ static method({}) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-init-undefined.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-init-undefined.js
new file mode 100644
index 0000000000..0d40623806
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-init-undefined.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+class C {
+ static method({}) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-empty.js
new file mode 100644
index 0000000000..430b92a748
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-empty.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ static method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method(obj);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..8a0bbac390
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ static method({ poisoned }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..23866529ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..38873156c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2a32fa47d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..0eb3c8a31d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..0c91023450
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..e1bd4dd951
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: null, x: 0, y: false, z: '' });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..8527fddbf5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-throws.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static method({ x = thrower() }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..02566d98d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static method({ x = unresolvableReference }) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..293689da4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..99f50db21a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-list-err.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static method({ a, b = thrower(), c = ++initCount }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method({});
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..ab3d9d65c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..958a69030d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: [45] });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..ab18550b2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static method({ w: [x, y, z] = [4, 5, 6] }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..c650a387f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-ary.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: [7, undefined, ] });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..65afb213f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Evaluation of property name returns an abrupt completion (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static method({ [thrower()]: x }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..77c09b30e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+class C {
+ static method({ poisoned: x = ++initEvalCount }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..e98bd1afb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ s: null, u: 0, w: false, y: '' });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..bf83fa005b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Error thrown when evaluating the initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+class C {
+ static method({ x: y = thrower() }) {}
+};
+
+assert.throws(Test262Error, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..2ee5ed2af0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Destructuring initializer is an unresolvable reference (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+class C {
+ static method({ x: y = unresolvableReference }) {}
+};
+
+assert.throws(ReferenceError, function() {
+ C.method({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..3cd7d23406
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-init.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..b1c8a4d136
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..3ee0df407f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-id.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Binding as specified via property name and identifier (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..49f17c6bbc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: undefined });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..ae37b91542
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..da1f927804
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/cls-decl-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+class C {
+ static method({ w: { x, y, z } = undefined }) {}
+};
+
+assert.throws(TypeError, function() {
+ C.method({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..fea57dfe98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-prop-obj.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ w: { x: undefined, z: 7 } });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..a770ea90a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-getter.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ static method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({ get v() { count++; return 2; } });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..8072fe7119
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ static method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method(o);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..32f93bfb90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/meth-static-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-meth-static.template
+/*---
+description: Rest object contains just unextracted data (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ static method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+};
+
+C.method({x: 1, y: 2, a: 5, b: 3});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-init-iter-close.js
new file mode 100644
index 0000000000..5c392dcaa9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-init-iter-close.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..c7afd65354
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-init-iter-no-close.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-name-iter-val.js
new file mode 100644
index 0000000000..b6c8621b1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-name-iter-val.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding with normal value iteration (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..b766f51794
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..79277a3f43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ * #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([[7, 8, 9]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..6cf6800fa6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..7ce755b4bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([[]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..4c0acc17f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..ee466b2981
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([[23]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..ade7fd21b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..c74564f74e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([values]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..022cfb465a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..4a73424ab5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..abba0898ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,93 @@
+// 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/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2ac4a448a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,92 @@
+// 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/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..33ea96854c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,92 @@
+// 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/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..f9305418c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,93 @@
+// 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/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..5ead11567a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Destructuring initializer with a "hole" (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([,]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..4db37e6b11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([null, 0, false, '']).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..b4f31dcd6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Destructuring initializer with an undefined value (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([undefined]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..079828c06a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration completes (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..d58b13b9e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..d2234a84dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..b67ef13002
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..4ebaa3fa2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..91a9a0a157
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([{ x: 11, y: 22, z: 33 }]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..c80fbbeae0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..8df54c1df5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([{ u: 777, w: 888, y: 999 }]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..744d5fc2c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Elision accepts exhausted iterator (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([,]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elision.js
new file mode 100644
index 0000000000..5c9a25c370
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-elision.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Elision advances iterator (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(g()).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-empty.js
new file mode 100644
index 0000000000..73d1f05312
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-empty.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ * #method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..e75150ffba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([3, 4, 5]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..fdc9602258
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,118 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element containing an elision (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(g()).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..df1a672ec3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element containing an "empty" array pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..5dd8852652
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element containing a rest element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..85c1ac7d59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Lone rest element (direct binding) (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ * #method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..7dbcd84d6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element following elision elements (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..f2838c5b39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: RestElement applied to an exhausted iterator (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..770a9a20ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-id.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Lone rest element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..c2d7216d9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..c7549dac21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-id.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element (identifier) does not support initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..a10e288457
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..8ef03afce7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..1c358e07fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..166f55992c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..96b737df5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..3924bf84cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([7, 8, 9]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..14cde88b29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..3d6c1e35db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..54f160cf23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..3823e65211
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..24c7ad7b41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ * #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..4d53cf4f3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..f8963641df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..3e6b0f7fc7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..88ee6b1757
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..57e549ed5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..ddc9a9ad8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..8720e6173a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..b6a784c5f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..de6eba1e62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,93 @@
+// 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/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..a73ce63344
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,92 @@
+// 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/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..12632d7677
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,92 @@
+// 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/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..ffdbd3602b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,93 @@
+// 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/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..9523fa58b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..b55a511180
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..fc619299e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..e7d42ad280
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..7248cb7412
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..2d918abaa8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..de945caba9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..da7b8871d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..7769013735
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..c56193ac17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..e064b7fbbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..056d49f571
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Elision accepts exhausted iterator (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..ff9c600fe2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Elision advances iterator (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..b3c3060b2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ * #method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..5e4a7baef3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..b4d4a26e9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,118 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an elision (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..6db82a5215
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..af1f67bfbf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element containing a rest element (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..977b261cdc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Lone rest element (direct binding) (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ * #method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..8a8ab60709
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element following elision elements (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..2a3b4ffe36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..2471513fcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Lone rest element (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..a8f1dc96c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..59c17b3e83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..0587e01b0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..ca1a6cb75c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..352a65595c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..b1c63e5154
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ * #method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..85010b5246
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..e7162c2ef9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..965a2c6306
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ * #method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..c0fc68acc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..c65aac3dab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..7950cae0f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..8bdf510a84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..99cc90f75c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..9b8613fe4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..2d41f62d11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..617fd832da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..1c786ab378
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..bbdcb45d6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..45b5316041
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..3f0adefb70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..0c95a50eed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..cce7a615a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Binding as specified via property name and identifier (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..6176c1e7fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..25a0f5b49e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..a1e57c2956
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ * #method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..73a2e88fe1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ * #method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..2420235701
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-dflt.template
+/*---
+description: Rest object contains just unextracted data (private class expression method (default parameters))
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ * #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-empty.js
new file mode 100644
index 0000000000..f87909cbf6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-empty.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ * #method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(obj).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..864d7c02c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..ddbf88da04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..d297311c54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..afa707d2ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..6b93f34787
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..43dc08e2bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: null, x: 0, y: false, z: '' }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..75e9f31a63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..fae83b5565
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..a3391bbf10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: [45] }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..fd4d92aecc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: [7, undefined, ] }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..95cdaa1c78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ s: null, u: 0, w: false, y: '' }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..2397f74699
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..4e8ad1b210
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..05418aa63d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-id.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Binding as specified via property name and identifier (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ * #method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..84a4815aea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: undefined }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..5b68fbc521
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: { x: undefined, z: 7 } }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..3ba88c7034
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ * #method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ get v() { count++; return 2; } }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..debb0886f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ * #method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(o).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..4ca3a11464
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth.template
+/*---
+description: Rest object contains just unextracted data (private class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [object-rest, class, class-methods-private, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ * #method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({x: 1, y: 2, a: 5, b: 3}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-init-iter-close.js
new file mode 100644
index 0000000000..127435de5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-init-iter-close.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..7d156e7d3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-name-iter-val.js
new file mode 100644
index 0000000000..b34129cd3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-name-iter-val.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding with normal value iteration (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..b6c7405ead
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..09dcd9547f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ static * #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([[7, 8, 9]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..341dd3f8c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..e1c3adb7b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([[]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..e12e6df246
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..157c58a65d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([[23]]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..dbe8c7beaa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..fbe8ef0952
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([values]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..5d9a566565
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..c097982786
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..988101c990
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,93 @@
+// 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/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..791be9102e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,92 @@
+// 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/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..3d527a6cc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,92 @@
+// 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/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..479c84a633
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,93 @@
+// 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/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..8c031ae289
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Destructuring initializer with a "hole" (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([,]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..0ef744bfac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([null, 0, false, '']).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..6d17df77fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Destructuring initializer with an undefined value (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([undefined]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..954e1e06a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration completes (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..60b7713822
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..ebba9fb209
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ static * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..cbe2780269
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..118af221d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..c7c83f5e9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([{ x: 11, y: 22, z: 33 }]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..9de34b02cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..fe33488c09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([{ u: 777, w: 888, y: 999 }]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..09e2dae315
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Elision accepts exhausted iterator (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([,]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision.js
new file mode 100644
index 0000000000..4a183f15fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-elision.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Elision advances iterator (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(g()).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-empty.js
new file mode 100644
index 0000000000..557ddf2e3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-empty.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ static * #method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..6d88bd2098
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([3, 4, 5]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..8f04a77eb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,118 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element containing an elision (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(g()).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..a64ad48fa1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element containing an "empty" array pattern (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..613d9db4a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element containing a rest element (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..e121847fb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Lone rest element (direct binding) (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ static * #method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..9921121677
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element following elision elements (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..ba392de7f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: RestElement applied to an exhausted iterator (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..04111f98aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Lone rest element (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(values).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..0c1e144905
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..04f38775a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-id.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element (identifier) does not support initializer (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..412e2a26d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..cc39d9eba6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..4b048c5779
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..fd1fec1cf2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..c7e9e928fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..bf51b08840
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ static * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([7, 8, 9]).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..93e8efb994
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..7d385d15d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..b6461f9c61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..014e13d47a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..9744e916a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ static * #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..5c4d67f420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..8d64a6fa67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..0bf17c9718
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..2b58d43bec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..bf711c5690
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..eaaf9f8737
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..ac83e65726
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..93d4296816
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..7f883119c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,93 @@
+// 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/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..a82d02a636
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,92 @@
+// 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/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..0a1ac078b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,92 @@
+// 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/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..57379d6be8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,93 @@
+// 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/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..8efab8fe79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..7e79b330ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..ada5adb6b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..7a41ca20c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..a9674abee6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..061cec1b0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ static * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..c333b22617
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..428f27a538
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..e668c063aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..0856018c6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..a720f8a56c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..7ae8335341
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Elision accepts exhausted iterator (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..c51414d3fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Elision advances iterator (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..50e3c97c2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ static * #method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..37b616dbb9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..8f02c70ddd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,118 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an elision (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..0c593ee363
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,101 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..ccd05a513e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing a rest element (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..6e80363cf5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Lone rest element (direct binding) (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ static * #method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..e347414f1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element following elision elements (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..1e67162ab6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..a078ffb200
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Lone rest element (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..21745f3e65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..2d3b34b647
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..33203306c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..17f882f817
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..50de85084f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..e94b86d533
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static * #method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..a6b62d5f53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..2fd7a669cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ static * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..f53cd60905
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ static * #method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..53e9be9cf0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..c0cdbb5846
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..096e11af4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..3a8f97be53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..5305891559
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..0322d8fc04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..a74701c403
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..85ffc85b34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..7ba68d5bdc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..ad13e6224e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..2c94cce370
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..16ff749460
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..1025b98f30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..204d83334e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Binding as specified via property name and identifier (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..029e9841ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..a0f1cf1196
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..8aaf613f2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ static * #method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..6e5fa48892
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ static * #method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..eb89e8c38a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static-dflt.template
+/*---
+description: Rest object contains just unextracted data (private static class expression generator method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-empty.js
new file mode 100644
index 0000000000..1fffaa6251
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-empty.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ static * #method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(obj).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..f737f64f05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..3824f5549b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..42be5450c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..e4c5198faf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..f89005dad8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..8a3870b9f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: null, x: 0, y: false, z: '' }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..b9251d2ef8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..27390ef80a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..d3a8f48c77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: [45] }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..71896ded79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: [7, undefined, ] }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..b633c84655
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ s: null, u: 0, w: false, y: '' }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..2139b734c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..382fe94c8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..5555927ec6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Binding as specified via property name and identifier (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..d2d132a25f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: undefined }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..1dec9e2a75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: { x: undefined, z: 7 } }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..518777f02d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ static * #method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ get v() { count++; return 2; } }).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..660628a74c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ static * #method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(o).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..5f18d266b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-private-gen-meth-static.template
+/*---
+description: Rest object contains just unextracted data (private static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ static * #method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({x: 1, y: 2, a: 5, b: 3}).next();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-init-iter-close.js
new file mode 100644
index 0000000000..e67f314cf9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-init-iter-close.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..80eafc152b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-init-iter-no-close.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-name-iter-val.js
new file mode 100644
index 0000000000..027780a582
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-name-iter-val.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding with normal value iteration (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..bf66e3f137
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..e1b2d300b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([[7, 8, 9]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..3d0edf64e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..41b0bbd28e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([[]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..a15d5f03b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..15a6a738f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([[23]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..07b66e65fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..859c676e53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([values]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..73bda913c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..530f7fb021
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..a20b579192
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2cf571fbde
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,90 @@
+// 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/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..7f69ab7bcb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,90 @@
+// 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/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..71080d2f59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..b1f9271bde
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Destructuring initializer with a "hole" (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([,]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..98e8938e8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([null, 0, false, '']);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..b4bf7edd2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Destructuring initializer with an undefined value (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([undefined]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..9d796f54b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding when value iteration completes (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..3526bd3efb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..4485b87315
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..7b6b625439
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..cfc80094cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..da9b35a11f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([{ x: 11, y: 22, z: 33 }]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..78d4f98170
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..26f2957c1b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([{ u: 777, w: 888, y: 999 }]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..867d9001d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Elision accepts exhausted iterator (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([,]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elision.js
new file mode 100644
index 0000000000..c1cf084dd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-elision.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Elision advances iterator (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(g());
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-empty.js
new file mode 100644
index 0000000000..01e416e359
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-empty.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ #method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..62abf52a4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([3, 4, 5]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..885840c43b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,116 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element containing an elision (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(g());
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..c98ab4b72f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element containing an "empty" array pattern (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..a271cd9742
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element containing a rest element (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..41b1e92abc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Lone rest element (direct binding) (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ #method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..0fea03cdf7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element following elision elements (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..70926f7d70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: RestElement applied to an exhausted iterator (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..4a062e5923
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-id.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Lone rest element (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..1caf23d11d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..e951bf6636
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-id.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element (identifier) does not support initializer (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..dd5a1a293d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..7d85a99478
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..564123314c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..3b293c3670
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..0813d1068f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..dd166a1b45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method([7, 8, 9]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..9a9529a6c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-init-iter-close.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..25e96952e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..3f2f674dd4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-name-iter-val.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..c0c419b439
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..49db54bded
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..213ce44ec1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..6cf5fa2f1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..b6a61f3488
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..6e035507d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..051f06268b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..65bc609182
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..61be2a8e69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..08d3628327
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..6cb3dd7dc3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..e3695c9aa0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,90 @@
+// 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/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..d479070e87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,90 @@
+// 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/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..c4e5267b8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..01bf4e1e62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..7158fd9163
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..803968e748
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..81cb2bf874
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..f6a7172213
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..d9df8bda9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..05fab51268
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..1c906c9262
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..27db293fbb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..70f555da9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..41c1420324
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..6d67bd0032
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Elision accepts exhausted iterator (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..c83d9d705e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-elision.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Elision advances iterator (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..ec1ab86696
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-empty.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ #method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..624564c5b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..457bd3334d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,116 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element containing an elision (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..08361b0b02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..41faa91bfb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element containing a rest element (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..cb25bdd0f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Lone rest element (direct binding) (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ #method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..ce84f0b190
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element following elision elements (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..d275436ada
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..6cde98bae8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Lone rest element (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..5a897fd714
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..f659b3f79e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..949cd85abc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..5dc3556f1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..3d87f97704
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..35419eb270
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ #method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..b7c3b6186a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..59877ad529
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..9a14bb6f69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-empty.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ #method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..1f5df25586
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..7e2f45b612
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..44e84582ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..8f1b11c85f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..fade38e1b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..eaa3b6bd2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..57f52851fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..99fd8affa7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..212dc77a49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..a5209a9c97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..c9007f940b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..880544be5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..5b23b7fe7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..2acafc5edf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Binding as specified via property name and identifier (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..9778adeb4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..5842f1912c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..15f34504d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ #method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..9a4f251c65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ #method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..5437d9d9bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-dflt.template
+/*---
+description: Rest object contains just unextracted data (private class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-empty.js
new file mode 100644
index 0000000000..c0e13217a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-empty.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ #method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(obj);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..2330d077b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..4af2ecddda
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..ecbe73d7b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..e63746391e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..0303047613
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..8235421dd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: null, x: 0, y: false, z: '' });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..6a82712de9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..1093eadb3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..dcab838f14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: [45] });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..334f8b2c57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-ary.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: [7, undefined, ] });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..c271947ded
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ s: null, u: 0, w: false, y: '' });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..ea288eb7dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..ac53632f7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..06d30c1eb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-id.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Binding as specified via property name and identifier (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ #method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..b8199b954a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: undefined });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..9b785b3758
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-prop-obj.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ w: { x: undefined, z: 7 } });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..48a01f4bd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-getter.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-methods-private, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ #method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({ get v() { count++; return 2; } });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..53c2d12d13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-methods-private, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ #method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method(o);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..ce05388c5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth.template
+/*---
+description: Rest object contains just unextracted data (private class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-methods-private, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ #method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ get method() {
+ return this.#method;
+ }
+};
+
+new C().method({x: 1, y: 2, a: 5, b: 3});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-init-iter-close.js
new file mode 100644
index 0000000000..67fef4ff99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-init-iter-close.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..86276e0d00
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-init-iter-no-close.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-name-iter-val.js
new file mode 100644
index 0000000000..dddf6a08aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-name-iter-val.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding with normal value iteration (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..6013316089
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..ce59e7de59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ static #method([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([[7, 8, 9]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..9074589b89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..d8c4a42cef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([[]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..e92c218389
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..fe07210890
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([[23]]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..463888fafa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..d0bd01db36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([values]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..b2888b6bed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..3dbb00a948
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..8ccc0e9836
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..19951201fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,90 @@
+// 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/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..55b63b4054
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,90 @@
+// 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/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..205f141eaf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..2b8aa58d8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Destructuring initializer with a "hole" (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([,]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..b6c585290c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([null, 0, false, '']);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..b090428f87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Destructuring initializer with an undefined value (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([undefined]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..5a156fa06e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding when value iteration completes (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..75cf9a72a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..7139764c6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ static #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..ecac85ffc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..d2151a8aee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..246df99536
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([{ x: 11, y: 22, z: 33 }]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..1338f7693e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..306233bfb9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([{ u: 777, w: 888, y: 999 }]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..8fa86fd5fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Elision accepts exhausted iterator (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([,]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elision.js
new file mode 100644
index 0000000000..40dccdcdc1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-elision.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Elision advances iterator (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(g());
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-empty.js
new file mode 100644
index 0000000000..7b8c255b6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-empty.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ static #method([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..bd6f465685
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([3, 4, 5]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..6eb2d733b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,116 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element containing an elision (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(g());
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..0526dd7ea9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element containing an "empty" array pattern (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(iter);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..239bd18659
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element containing a rest element (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..c2bf23e660
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Lone rest element (direct binding) (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ static #method([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..0dd975f7a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element following elision elements (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..d157abe604
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: RestElement applied to an exhausted iterator (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..6033c1228a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-id.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Lone rest element (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...x]) {
+ 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(values);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..950b8b2665
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..123354e379
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-id.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element (identifier) does not support initializer (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...x = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..59279e3f46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...{ x } = []]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..e2ecaed254
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...[x], y]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..3217fbee28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...x, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..fd51675b7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...{ x }, y]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..db91ba3dbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([1, 2, 3]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..5dab0a6c60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ static #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method([7, 8, 9]);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..1887cf6e5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-close.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..885c4f67c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..ac72b2656c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-name-iter-val.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..543ec000b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..96ff3f7c46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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;
+class C {
+ static #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..1ec8532a26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..15ea70f430
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..41ea47e7f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..365b93402d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..bb2383e60c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..6f648b7b8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..7c8b1be34e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..b9f0d35f7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,89 @@
+// 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/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..257ddc0b23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..37524d12eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,90 @@
+// 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/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..97c8cc6ffe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,90 @@
+// 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/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..6dff2face9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,91 @@
+// 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/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..8f68bcb24e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..fb8ae2242e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..90e17f939a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..af815e2508
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..ddf3bfe61f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..85f7fc70de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+class C {
+ static #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..a7f4633384
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..7c751e1e55
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..c702b2cba0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..70178f28c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..0bf680efbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..e256757602
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Elision accepts exhausted iterator (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([,] = iter) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..cd4ae586ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Elision advances iterator (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..ec22da64b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+class C {
+ static #method([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..2607eaf454
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..35078291d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,116 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element containing an elision (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..14432e9b54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..fceae6e266
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element containing a rest element (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...[...x]] = 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);
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..e45d9b9050
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Lone rest element (direct binding) (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+class C {
+ static #method([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..74b7ac453c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element following elision elements (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([ , , ...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..cd7f0b4dfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..ab58474e1b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Lone rest element (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...x] = 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..b32f8f8f83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..50b58ccc44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...x = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..515b36e176
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..f0aeff0761
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..d3d6881ab1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..e93ed26e0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,84 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+class C {
+ static #method([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..c26920b995
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..e346444e39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest element containing an object binding pattern (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+class C {
+ static #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..88f8d653b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ static #method({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..435aee1ab6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..0071f451d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..e3b53773bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..e201800a28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..99bca0477d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..e3bc0889cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..efd4e14b89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..770939a957
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..7a9044161d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..d9774777ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..d09b25c420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..d351ac5afe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..ab4ecf7b62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..39f15c0ae5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Binding as specified via property name and identifier (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..2a6871aec1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..ce24fef3c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..cb0e46ae21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ static #method({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..a5f96d22fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ static #method({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..277bda2fe2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-static-dflt.template
+/*---
+description: Rest object contains just unextracted data (private static class expression method (default parameter))
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ static #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method();
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-empty.js
new file mode 100644
index 0000000000..ad80335aea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-empty.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+class C {
+ static #method({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(obj);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..c7f15b925a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..41654d52fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..e3292e120e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..04c75fa9d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..1c45df27ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..3f12a20fcf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: null, x: 0, y: false, z: '' });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..57eed183a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..b988415e5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..3d9554b564
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: [45] });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..d443705739
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-ary.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: [7, undefined, ] });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..3427ed5583
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ s: null, u: 0, w: false, y: '' });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..da00572f52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..dd2b10246e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..4c4f7311b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-id.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Binding as specified via property name and identifier (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+class C {
+ static #method({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ x: 23 });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..42e0831d98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: undefined });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..c1caf23a4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-prop-obj.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+class C {
+ static #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ w: { x: undefined, z: 7 } });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..658d09f678
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-getter.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+class C {
+ static #method({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({ get v() { count++; return 2; } });
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..c2bbf73cb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+class C {
+ static #method({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method(o);
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..2e8bbdc4c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/cls-decl-private-meth-static.template
+/*---
+description: Rest object contains just unextracted data (private static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [object-rest, class, class-static-methods-private, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+class C {
+ static #method({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+ }
+
+ static get method() {
+ return this.#method;
+ }
+};
+
+C.method({x: 1, y: 2, a: 5, b: 3});
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/dstr/shell.js b/js/src/tests/test262/language/statements/class/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/abrupt-completition-on-field-initializer.js b/js/src/tests/test262/language/statements/class/elements/abrupt-completition-on-field-initializer.js
new file mode 100644
index 0000000000..e2ea7199ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/abrupt-completition-on-field-initializer.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: If an initializer returns an abrupt completion, other initializers should not execute
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+info: |
+ [[Construct]] ( argumentsList, newTarget)
+ ...
+ 8. If kind is "base", then
+ a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ c. If result is an abrupt completion, then
+ i. Remove calleeContext from execution context stack and restore callerContext as the running execution context.
+ ii. Return Completion(result).
+ ...
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+ ...
+
+features: [class-fields-public, class-static-fields-public, class]
+---*/
+
+function abruptCompletion() {
+ throw new Test262Error();
+}
+
+let neverExecuted = false;
+
+function sideEffect() {
+ neverExecuted = true;
+}
+
+class C {
+ a = abruptCompletion();
+ b = sideEffect();
+}
+
+assert.throws(Test262Error, function() {
+ let c = new C();
+}, 'field initializer should end with abrupt completion');
+assert.sameValue(neverExecuted, false);
+
+assert.throws(Test262Error, function() {
+ class D {
+ static a = abruptCompletion();
+ static b = sideEffect();
+ }
+}, 'static field initializer should end with abrupt completion');
+assert.sameValue(neverExecuted, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-computed-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-computed-names.js
new file mode 100644
index 0000000000..c058f478e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-computed-names.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Computed property names (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-computed-symbol-names.js
new file mode 100644
index 0000000000..173e0ce9df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-computed-symbol-names.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Computed property symbol names (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ *m() { return 42; } [x]; [y] = 42;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..52c1458c45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ *m() { return 42; } #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-literal-names-asi.js
new file mode 100644
index 0000000000..a1b21dfe49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-literal-names-asi.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Literal property names with ASI (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ *m() { return 42; } a
+ b = 42;;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-literal-names.js
new file mode 100644
index 0000000000..41e2472d2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-literal-names.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Literal property names (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ *m() { return 42; } a; b = 42;
+ c = fn;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-field-usage.js
new file mode 100644
index 0000000000..fc35a281db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-field-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ *m() { return 42; } #m = 'test262';;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-method-getter-usage.js
new file mode 100644
index 0000000000..fcc9a1ae25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-method-getter-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ *m() { return 42; } get #m() { return 'test262'; };
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-method-usage.js
new file mode 100644
index 0000000000..bc73bd1d89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-method-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ *m() { return 42; } #m() { return 'test262'; };
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-names.js
new file mode 100644
index 0000000000..7dd4170fea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-private-names.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: private names (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ *m() { return 42; } #x; #y;
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..172ea6f780
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-field-identifier-initializer.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid FieldDefinition (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-field-identifier.js
new file mode 100644
index 0000000000..cb7c71f67a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-field-identifier.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid FieldDefinition (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-getter-alt.js
new file mode 100644
index 0000000000..696990eecd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-getter-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-getter.js
new file mode 100644
index 0000000000..93a9435e91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-getter.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-method-alt.js
new file mode 100644
index 0000000000..6992d38b0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-method-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName as private method (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-method.js
new file mode 100644
index 0000000000..8029c97052
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-method.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName as private method (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-setter-alt.js
new file mode 100644
index 0000000000..dbcdb8e611
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-setter-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-setter.js
new file mode 100644
index 0000000000..978c424473
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-private-setter.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..56913af500
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-alt.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..531b66c1cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..e46db7f945
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier-initializer.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier.js
new file mode 100644
index 0000000000..df7ed6d89c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-privatename-identifier.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..8210868664
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..a25cdabbb8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..ee67688f06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..ab0f8b9975
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..582f3c5241
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,124 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..c9cdec139c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..a8dde27dbf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..fa198c8a53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..9e74a42de8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..cedc2876cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..1557b9651e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..4fd22ea158
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..4771398de9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..610964b743
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..f6421e1262
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-rs-static-privatename-identifier.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-fields.js
new file mode 100644
index 0000000000..cde71d4fb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-fields.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: static private fields (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #x; static #y;
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..7d8b009597
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-methods-with-fields.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: static private methods with fields (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ *m() { return 42; } static #xVal; static #yVal;
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-methods.js
new file mode 100644
index 0000000000..c9c05cceb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-static-private-methods.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: static private methods (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ *m() { return 42; } ;
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-string-literal-names.js
new file mode 100644
index 0000000000..e3b392da02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-gen-string-literal-names.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-gen.template
+/*---
+description: String literal names (field definitions after a generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ *m() { return 42; } 'a'; "b"; 'c' = 39;
+ "d" = 42;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-computed-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-computed-names.js
new file mode 100644
index 0000000000..823d115970
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-computed-names.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Computed property names (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-computed-symbol-names.js
new file mode 100644
index 0000000000..807cdea551
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-computed-symbol-names.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Computed property symbol names (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ m() { return 42; } [x]; [y] = 42;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..0269dc17de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ m() { return 42; } #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-literal-names-asi.js
new file mode 100644
index 0000000000..20c136ee2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-literal-names-asi.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Literal property names with ASI (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ m() { return 42; } a
+ b = 42;;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-literal-names.js
new file mode 100644
index 0000000000..13faccf1b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-literal-names.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Literal property names (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ m() { return 42; } a; b = 42;
+ c = fn;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-field-usage.js
new file mode 100644
index 0000000000..54e661f267
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-field-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ m() { return 42; } #m = 'test262';;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-method-getter-usage.js
new file mode 100644
index 0000000000..5fb9643d51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-method-getter-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ m() { return 42; } get #m() { return 'test262'; };
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-method-usage.js
new file mode 100644
index 0000000000..ed4c12cfed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-method-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ m() { return 42; } #m() { return 'test262'; };
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-names.js
new file mode 100644
index 0000000000..1609214656
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-private-names.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: private names (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ m() { return 42; } #x; #y;
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..94601464dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-field-identifier-initializer.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid FieldDefinition (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-field-identifier.js
new file mode 100644
index 0000000000..68db2471db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-field-identifier.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid FieldDefinition (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-getter-alt.js
new file mode 100644
index 0000000000..862349ac53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-getter-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-getter.js
new file mode 100644
index 0000000000..c55a585343
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-getter.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-method-alt.js
new file mode 100644
index 0000000000..cc30e5ebdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-method-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName as private method (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-method.js
new file mode 100644
index 0000000000..f6f5151869
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-method.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName as private method (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-setter-alt.js
new file mode 100644
index 0000000000..e2063f85d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-setter-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-setter.js
new file mode 100644
index 0000000000..809832b036
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-private-setter.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..e483dfc68f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-alt.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..f4ad70edab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..599a9ac8fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier-initializer.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier.js
new file mode 100644
index 0000000000..5a08e76397
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-privatename-identifier.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..197216f455
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..a3f00b9df6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..6becb08bc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..456f7860e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..f9616e0a3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,124 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..658f1ab968
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..6de252c327
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..58092cfd01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..9f258beec7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..25f4ca7c49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..f7319852b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..ade77c12db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..bd7086ce7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..9a22b5740a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..4b3895a898
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-rs-static-privatename-identifier.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-fields.js
new file mode 100644
index 0000000000..345a9a82fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-fields.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: static private fields (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ m() { return 42; } static #x; static #y;
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..e4fd601e4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-methods-with-fields.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: static private methods with fields (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ m() { return 42; } static #xVal; static #yVal;
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-methods.js
new file mode 100644
index 0000000000..270229feb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-static-private-methods.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: static private methods (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ m() { return 42; } ;
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-method-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-string-literal-names.js
new file mode 100644
index 0000000000..237438afb9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-method-string-literal-names.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-method.template
+/*---
+description: String literal names (field definitions after a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ m() { return 42; } 'a'; "b"; 'c' = 39;
+ "d" = 42;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-computed-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-computed-names.js
new file mode 100644
index 0000000000..b35242c6b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-computed-names.js
@@ -0,0 +1,123 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Computed property names (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ static async *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+ );
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-computed-symbol-names.js
new file mode 100644
index 0000000000..aae8b31c6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-computed-symbol-names.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Computed property symbol names (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ static async *m() { return 42; } [x]; [y] = 42;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+ );
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+ );
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..03f68e5c2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,125 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.o(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names-asi.js
new file mode 100644
index 0000000000..65b1d89ceb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names-asi.js
@@ -0,0 +1,93 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Literal property names with ASI (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } a
+ b = 42;;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names.js
new file mode 100644
index 0000000000..d7b166f66b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-literal-names.js
@@ -0,0 +1,112 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Literal property names (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ static async *m() { return 42; } a; b = 42;
+ c = fn;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-field-usage.js
new file mode 100644
index 0000000000..b0c07e816e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-field-usage.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #m = 'test262';;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-method-getter-usage.js
new file mode 100644
index 0000000000..5cd30a34b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-method-getter-usage.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } get #m() { return 'test262'; };
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-method-usage.js
new file mode 100644
index 0000000000..0d89868a9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-method-usage.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #m() { return 'test262'; };
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-names.js
new file mode 100644
index 0000000000..e26beb8ed4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-private-names.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: private names (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #x; #y;
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private fields do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(c.x(), 42, "test 7");
+ assert.sameValue(c.y(), 43, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..4c96073070
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-field-identifier-initializer.js
@@ -0,0 +1,103 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid FieldDefinition (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$, 1);
+ assert.sameValue(c._, 1);
+ assert.sameValue(c.\u{6F}, 1);
+ assert.sameValue(c.\u2118, 1);
+ assert.sameValue(c.ZW_\u200C_NJ, 1);
+ assert.sameValue(c.ZW_\u200D_J, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-field-identifier.js
new file mode 100644
index 0000000000..00efefb715
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-field-identifier.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid FieldDefinition (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ c.$ = 1;
+ c._ = 1;
+ c.\u{6F} = 1;
+ c.\u2118 = 1;
+ c.ZW_\u200C_NJ = 1;
+ c.ZW_\u200D_J = 1;
+
+ assert.sameValue(c.$, 1);
+ assert.sameValue(c._, 1);
+ assert.sameValue(c.\u{6F}, 1);
+ assert.sameValue(c.\u2118, 1);
+ assert.sameValue(c.ZW_\u200C_NJ, 1);
+ assert.sameValue(c.ZW_\u200D_J, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-getter-alt.js
new file mode 100644
index 0000000000..fb12e01736
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-getter-alt.js
@@ -0,0 +1,144 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-getter.js
new file mode 100644
index 0000000000..87bd8dd98d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-getter.js
@@ -0,0 +1,144 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js
new file mode 100644
index 0000000000..bd308a9e5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-method-alt.js
@@ -0,0 +1,143 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName as private method (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-method.js
new file mode 100644
index 0000000000..0da6b2f5c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-method.js
@@ -0,0 +1,143 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName as private method (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-setter-alt.js
new file mode 100644
index 0000000000..5a836942f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-setter-alt.js
@@ -0,0 +1,143 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-setter.js
new file mode 100644
index 0000000000..fed08f1199
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-private-setter.js
@@ -0,0 +1,143 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..66df105495
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-alt.js
@@ -0,0 +1,125 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..7f9f67af2e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,119 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(), 1);
+ assert.sameValue(c._(), 1);
+ assert.sameValue(c.\u{6F}(), 1);
+ assert.sameValue(c.℘(), 1);
+ assert.sameValue(c.ZW_‌_NJ(), 1);
+ assert.sameValue(c.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..7c288c4d25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier-initializer.js
@@ -0,0 +1,119 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(), 1);
+ assert.sameValue(c._(), 1);
+ assert.sameValue(c.\u{6F}(), 1);
+ assert.sameValue(c.\u2118(), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(), 1);
+ assert.sameValue(c.ZW_\u200D_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js
new file mode 100644
index 0000000000..2444782434
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js
@@ -0,0 +1,125 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..41d3335fbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,151 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ ]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+ }).then($DONE, $DONE);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..b9b0312fcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,152 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+ ]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+ }).then($DONE, $DONE);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..c8393918b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,151 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ ]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+ }).then($DONE, $DONE);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..9d5dda52d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,152 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+ ]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+ }).then($DONE, $DONE);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..761cece4b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,140 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$([1]).next().value, 1);
+ assert.sameValue(C._([1]).next().value, 1);
+ assert.sameValue(C.o([1]).next().value, 1);
+ assert.sameValue(C.℘([1]).next().value, 1);
+ assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+ assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..3ea2b56719
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,141 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$([1]).next().value, 1);
+ assert.sameValue(C._([1]).next().value, 1);
+ assert.sameValue(C.\u{6F}([1]).next().value, 1);
+ assert.sameValue(C.\u2118([1]).next().value, 1);
+ assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+ assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..91f9274f4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,138 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..a7bf117c42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-method-privatename-identifier.js
@@ -0,0 +1,138 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..0f77e9e8eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,126 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..ae45b1641c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,126 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..5f13adfca2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,126 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..c7f4af9477
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,120 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.℘(), 1);
+ assert.sameValue(C.ZW_‌_NJ(), 1);
+ assert.sameValue(C.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..0a2c38a716
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,120 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.℘(), 1);
+ assert.sameValue(C.ZW_‌_NJ(), 1);
+ assert.sameValue(C.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..aa7d3bac77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,120 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.\u2118(), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(), 1);
+ assert.sameValue(C.ZW_\u200D_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..18b3ba5665
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-rs-static-privatename-identifier.js
@@ -0,0 +1,126 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-fields.js
new file mode 100644
index 0000000000..bd3e1e0cee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-fields.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: static private fields (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #x; static #y;
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private fields do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 7");
+ assert.sameValue(C.y(), 43, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..e246f8b47e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-methods-with-fields.js
@@ -0,0 +1,104 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: static private methods with fields (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } static #xVal; static #yVal;
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private methods do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 13");
+ assert.sameValue(C.y(), 43, "test 14");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+ assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-methods.js
new file mode 100644
index 0000000000..68d55b4ea7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-static-private-methods.js
@@ -0,0 +1,91 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: static private methods (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } ;
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private methods do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 7");
+ assert.sameValue(C.y(), 86, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-string-literal-names.js
new file mode 100644
index 0000000000..ec25462639
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-gen-string-literal-names.js
@@ -0,0 +1,125 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-gen.template
+/*---
+description: String literal names (field definitions after a static async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static async *m() { return 42; } 'a'; "b"; 'c' = 39;
+ "d" = 42;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-computed-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-computed-names.js
new file mode 100644
index 0000000000..45d08b8f74
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-computed-names.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Computed property names (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ static async m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+ );
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-computed-symbol-names.js
new file mode 100644
index 0000000000..84f0a9d350
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-computed-symbol-names.js
@@ -0,0 +1,120 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Computed property symbol names (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ static async m() { return 42; } [x]; [y] = 42;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+ );
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+ );
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..44434bf5cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,124 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.o(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-literal-names-asi.js
new file mode 100644
index 0000000000..b8b32df078
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-literal-names-asi.js
@@ -0,0 +1,92 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Literal property names with ASI (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static async m() { return 42; } a
+ b = 42;;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-literal-names.js
new file mode 100644
index 0000000000..c3e17e41e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-literal-names.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Literal property names (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ static async m() { return 42; } a; b = 42;
+ c = fn;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-field-usage.js
new file mode 100644
index 0000000000..d03f6c1397
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-field-usage.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #m = 'test262';;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-method-getter-usage.js
new file mode 100644
index 0000000000..6aebe67a3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-method-getter-usage.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static async m() { return 42; } get #m() { return 'test262'; };
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-method-usage.js
new file mode 100644
index 0000000000..06af954028
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-method-usage.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #m() { return 'test262'; };
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-names.js
new file mode 100644
index 0000000000..c708d97643
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-private-names.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: private names (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #x; #y;
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private fields do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(c.x(), 42, "test 7");
+ assert.sameValue(c.y(), 43, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..0478e82a3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-field-identifier-initializer.js
@@ -0,0 +1,102 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid FieldDefinition (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$, 1);
+ assert.sameValue(c._, 1);
+ assert.sameValue(c.\u{6F}, 1);
+ assert.sameValue(c.\u2118, 1);
+ assert.sameValue(c.ZW_\u200C_NJ, 1);
+ assert.sameValue(c.ZW_\u200D_J, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-field-identifier.js
new file mode 100644
index 0000000000..acc2fc42e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-field-identifier.js
@@ -0,0 +1,109 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid FieldDefinition (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ c.$ = 1;
+ c._ = 1;
+ c.\u{6F} = 1;
+ c.\u2118 = 1;
+ c.ZW_\u200C_NJ = 1;
+ c.ZW_\u200D_J = 1;
+
+ assert.sameValue(c.$, 1);
+ assert.sameValue(c._, 1);
+ assert.sameValue(c.\u{6F}, 1);
+ assert.sameValue(c.\u2118, 1);
+ assert.sameValue(c.ZW_\u200C_NJ, 1);
+ assert.sameValue(c.ZW_\u200D_J, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-getter-alt.js
new file mode 100644
index 0000000000..b6099085f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-getter-alt.js
@@ -0,0 +1,143 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-getter.js
new file mode 100644
index 0000000000..98f74abd65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-getter.js
@@ -0,0 +1,143 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-method-alt.js
new file mode 100644
index 0000000000..9487c5a922
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-method-alt.js
@@ -0,0 +1,142 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName as private method (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-method.js
new file mode 100644
index 0000000000..79d032d5fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-method.js
@@ -0,0 +1,142 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName as private method (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-setter-alt.js
new file mode 100644
index 0000000000..6b74c9edd0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-setter-alt.js
@@ -0,0 +1,142 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-setter.js
new file mode 100644
index 0000000000..c5bf8ab5e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-private-setter.js
@@ -0,0 +1,142 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..05154e2948
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-alt.js
@@ -0,0 +1,124 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..fa461c0ec8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,118 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(), 1);
+ assert.sameValue(c._(), 1);
+ assert.sameValue(c.\u{6F}(), 1);
+ assert.sameValue(c.℘(), 1);
+ assert.sameValue(c.ZW_‌_NJ(), 1);
+ assert.sameValue(c.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..ebe0f2042e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier-initializer.js
@@ -0,0 +1,118 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(), 1);
+ assert.sameValue(c._(), 1);
+ assert.sameValue(c.\u{6F}(), 1);
+ assert.sameValue(c.\u2118(), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(), 1);
+ assert.sameValue(c.ZW_\u200D_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier.js
new file mode 100644
index 0000000000..85bd1d5f6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-privatename-identifier.js
@@ -0,0 +1,124 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..bdd718f6cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,150 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ ]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+ }).then($DONE, $DONE);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..d72ce12993
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,151 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+ ]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+ }).then($DONE, $DONE);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..344c1f439b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,150 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ ]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+ }).then($DONE, $DONE);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..d2aedfae37
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,151 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+ ]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+ }).then($DONE, $DONE);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..4207291845
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,139 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$([1]).next().value, 1);
+ assert.sameValue(C._([1]).next().value, 1);
+ assert.sameValue(C.o([1]).next().value, 1);
+ assert.sameValue(C.℘([1]).next().value, 1);
+ assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+ assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..e839471025
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,140 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$([1]).next().value, 1);
+ assert.sameValue(C._([1]).next().value, 1);
+ assert.sameValue(C.\u{6F}([1]).next().value, 1);
+ assert.sameValue(C.\u2118([1]).next().value, 1);
+ assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+ assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..4429dda9bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,137 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..07dbb5d6ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-method-privatename-identifier.js
@@ -0,0 +1,137 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..de741f808a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,125 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..032187502f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,125 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..2b45cd6849
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,125 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..ae1ee0eeab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,119 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.℘(), 1);
+ assert.sameValue(C.ZW_‌_NJ(), 1);
+ assert.sameValue(C.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..050cce6101
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,119 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.℘(), 1);
+ assert.sameValue(C.ZW_‌_NJ(), 1);
+ assert.sameValue(C.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..868c5a6289
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,119 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.\u2118(), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(), 1);
+ assert.sameValue(C.ZW_\u200D_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..439531a775
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-rs-static-privatename-identifier.js
@@ -0,0 +1,125 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-fields.js
new file mode 100644
index 0000000000..8321179c85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-fields.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: static private fields (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #x; static #y;
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private fields do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 7");
+ assert.sameValue(C.y(), 43, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..451d1ff4e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-methods-with-fields.js
@@ -0,0 +1,103 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: static private methods with fields (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static async m() { return 42; } static #xVal; static #yVal;
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private methods do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 13");
+ assert.sameValue(C.y(), 43, "test 14");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+ assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-methods.js
new file mode 100644
index 0000000000..212944715c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-static-private-methods.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: static private methods (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static async m() { return 42; } ;
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private methods do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 7");
+ assert.sameValue(C.y(), 86, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-string-literal-names.js
new file mode 100644
index 0000000000..9f166c7de6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-string-literal-names.js
@@ -0,0 +1,124 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
+/*---
+description: String literal names (field definitions after a static async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static async m() { return 42; } 'a'; "b"; 'c' = 39;
+ "d" = 42;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-computed-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-computed-names.js
new file mode 100644
index 0000000000..7a4af2835c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-computed-names.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Computed property names (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ static *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-computed-symbol-names.js
new file mode 100644
index 0000000000..9de02507a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-computed-symbol-names.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Computed property symbol names (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ static *m() { return 42; } [x]; [y] = 42;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..a7e4a814b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-literal-names-asi.js
new file mode 100644
index 0000000000..573533abbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-literal-names-asi.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Literal property names with ASI (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static *m() { return 42; } a
+ b = 42;;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-literal-names.js
new file mode 100644
index 0000000000..d2b667b977
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-literal-names.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Literal property names (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ static *m() { return 42; } a; b = 42;
+ c = fn;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-field-usage.js
new file mode 100644
index 0000000000..616b420dd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-field-usage.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #m = 'test262';;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-method-getter-usage.js
new file mode 100644
index 0000000000..e66e791fc3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-method-getter-usage.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static *m() { return 42; } get #m() { return 'test262'; };
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-method-usage.js
new file mode 100644
index 0000000000..a79e11f931
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-method-usage.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #m() { return 'test262'; };
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-names.js
new file mode 100644
index 0000000000..77b88e5621
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-private-names.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: private names (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #x; #y;
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..b8a6287e9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-field-identifier-initializer.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid FieldDefinition (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-field-identifier.js
new file mode 100644
index 0000000000..697972b0df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-field-identifier.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid FieldDefinition (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-getter-alt.js
new file mode 100644
index 0000000000..ab50cf85b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-getter-alt.js
@@ -0,0 +1,131 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-getter.js
new file mode 100644
index 0000000000..57f505cbd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-getter.js
@@ -0,0 +1,131 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-method-alt.js
new file mode 100644
index 0000000000..89f5cf1ac1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-method-alt.js
@@ -0,0 +1,130 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName as private method (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-method.js
new file mode 100644
index 0000000000..1c5d73f675
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-method.js
@@ -0,0 +1,130 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName as private method (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-setter-alt.js
new file mode 100644
index 0000000000..b382776e7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-setter-alt.js
@@ -0,0 +1,130 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-setter.js
new file mode 100644
index 0000000000..0bb69a4311
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-private-setter.js
@@ -0,0 +1,130 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..2600dcfb6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-alt.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..d28198e687
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..507fb5ba2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier.js
new file mode 100644
index 0000000000..6be5e99862
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-privatename-identifier.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..e591ba9030
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,137 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..e984284638
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,138 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..13aceacbbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,137 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..a4aef9d4bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,138 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..92e3b3d66e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..b84f84a43e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..cee0153caa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..5b8e8822e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-method-privatename-identifier.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..9713e63e6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..7f1543380d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..c814f0615e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..43888c6e25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..3e0f9f7197
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..22059bc30a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..2d39dafc78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-rs-static-privatename-identifier.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-fields.js
new file mode 100644
index 0000000000..13d9a43d2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-fields.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: static private fields (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #x; static #y;
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..73d35265c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-methods-with-fields.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: static private methods with fields (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static *m() { return 42; } static #xVal; static #yVal;
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-methods.js
new file mode 100644
index 0000000000..214c71221e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-static-private-methods.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: static private methods (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, generators, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static *m() { return 42; } ;
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-string-literal-names.js
new file mode 100644
index 0000000000..15a6f0219c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-gen-string-literal-names.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-gen.template
+/*---
+description: String literal names (field definitions after a static generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static *m() { return 42; } 'a'; "b"; 'c' = 39;
+ "d" = 42;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-computed-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-computed-names.js
new file mode 100644
index 0000000000..cb60bd378a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-computed-names.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Computed property names (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ static m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-computed-symbol-names.js
new file mode 100644
index 0000000000..a6f74e7c7b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-computed-symbol-names.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Computed property symbol names (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ static m() { return 42; } [x]; [y] = 42;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..820183bea5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ static m() { return 42; } #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-literal-names-asi.js
new file mode 100644
index 0000000000..9e97c4a255
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-literal-names-asi.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Literal property names with ASI (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static m() { return 42; } a
+ b = 42;;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-literal-names.js
new file mode 100644
index 0000000000..3cc1c1be04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-literal-names.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Literal property names (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ static m() { return 42; } a; b = 42;
+ c = fn;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-field-usage.js
new file mode 100644
index 0000000000..1fd4217704
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-field-usage.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static m() { return 42; } #m = 'test262';;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-method-getter-usage.js
new file mode 100644
index 0000000000..35563b45d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-method-getter-usage.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static m() { return 42; } get #m() { return 'test262'; };
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-method-usage.js
new file mode 100644
index 0000000000..375648c02c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-method-usage.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ static m() { return 42; } #m() { return 'test262'; };
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-names.js
new file mode 100644
index 0000000000..1f1891cd9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-private-names.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: private names (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static m() { return 42; } #x; #y;
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..0bbf608b42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-field-identifier-initializer.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid FieldDefinition (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-field-identifier.js
new file mode 100644
index 0000000000..18ae1d46b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-field-identifier.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid FieldDefinition (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-getter-alt.js
new file mode 100644
index 0000000000..f3432246aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-getter-alt.js
@@ -0,0 +1,131 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-getter.js
new file mode 100644
index 0000000000..0731610a19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-getter.js
@@ -0,0 +1,131 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-method-alt.js
new file mode 100644
index 0000000000..d7a7a0e688
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-method-alt.js
@@ -0,0 +1,130 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName as private method (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-method.js
new file mode 100644
index 0000000000..68a5e5e9e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-method.js
@@ -0,0 +1,130 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName as private method (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-setter-alt.js
new file mode 100644
index 0000000000..5371131c0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-setter-alt.js
@@ -0,0 +1,130 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-setter.js
new file mode 100644
index 0000000000..d15e7d36c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-private-setter.js
@@ -0,0 +1,130 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..d248e6ac16
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-alt.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..aca2290a9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..c2f6b16e75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier.js
new file mode 100644
index 0000000000..f5e5e271e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-privatename-identifier.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..99ec2bf733
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,137 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..b33d56493a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,138 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..5a545abaea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,137 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..ea24834124
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,138 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..0c423cd562
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..55f868c51e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..58462544d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..a4995abb53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-method-privatename-identifier.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..7d795f14a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..387692ab67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..3a5862090b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..f028117c95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..ac7380a810
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..ad3e002644
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..86a3bbe364
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-rs-static-privatename-identifier.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: Valid Static PrivateName (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-fields.js
new file mode 100644
index 0000000000..e20e5ac17e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-fields.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: static private fields (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #x; static #y;
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..aa6489c492
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-methods-with-fields.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: static private methods with fields (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static m() { return 42; } static #xVal; static #yVal;
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-methods.js
new file mode 100644
index 0000000000..8ab59dab0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-static-private-methods.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: static private methods (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static m() { return 42; } ;
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-string-literal-names.js
new file mode 100644
index 0000000000..a022473b03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/after-same-line-static-method-string-literal-names.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-static-method.template
+/*---
+description: String literal names (field definitions after a static method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static m() { return 42; } 'a'; "b"; 'c' = 39;
+ "d" = 42;
+
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
+ "m doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..93c84e4144
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-1.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-eval-arrow-body.template
+/*---
+description: super.x in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; () => super.x;');
+}
+
+new C().x();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..a228bda128
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-contains-superproperty-2.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-eval-arrow-body.template
+/*---
+description: super['x'] in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; () => super["x"];');
+}
+
+new C().x();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..1cc1113d38
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-eval-arrow-body.template
+/*---
+description: error if `super()['x']` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; () => super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..a43bf96f7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-eval-arrow-body.template
+/*---
+description: error if `super().x` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; () => super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..d0eba15d3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-direct-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-eval-arrow-body.template
+/*---
+description: error if `super()` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; () => super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..76e3354f61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-1.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-indirect-eval-arrow-body.template
+/*---
+description: super.x in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+class A {}
+class C extends A {
+ x = (0, eval)('() => super.x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..4c636fac01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-contains-superproperty-2.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-indirect-eval-arrow-body.template
+/*---
+description: super['x'] in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+class A {}
+class C extends A {
+ x = (0, eval)('() => super["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..d18d96841d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-1.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-indirect-eval-arrow-body.template
+/*---
+description: error if `super()['x']` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+class A {}
+class C extends A {
+ x = (0, eval)('() => super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..a8e100c4f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall-2.js
@@ -0,0 +1,29 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-indirect-eval-arrow-body.template
+/*---
+description: error if `super().x` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+class A {}
+class C extends A {
+ x = (0, eval)('() => super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..4c03c94360
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-derived-cls-indirect-eval-err-contains-supercall.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-indirect-eval-arrow-body.template
+/*---
+description: error if `super()` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+class A {}
+class C extends A {
+ x = (0, eval)('() => super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-direct-eval-err-contains-arguments.js
new file mode 100644
index 0000000000..93e5ecfc53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-direct-eval-err-contains-arguments.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-arguments.case
+// - src/class-elements/initializer-direct-eval-arguments/cls-decl-fields-eval-arrow-body.template
+/*---
+description: error if `arguments` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if ContainsArguments of StatementList is true.
+ ...
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+var executed = false;
+class C {
+ x = eval('executed = true; () => arguments;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-direct-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..f8195d0139
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-direct-eval-err-contains-newtarget.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-fields-eval-arrow-body.template
+/*---
+description: error if `new.target` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ x = eval('executed = true; () => new.target;');
+}
+
+var c = new C();
+
+assert.sameValue(executed, true);
+assert.sameValue(c.x(), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-indirect-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..c41a3ac458
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-indirect-eval-err-contains-newtarget.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-fields-indirect-eval-arrow-body.template
+/*---
+description: error if `new.target` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+class C {
+ x = (0, eval)('() => new.target;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..aafbecc24a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-1.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-eval-arrow-body.template
+/*---
+description: super.x in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; () => super.x;');
+ x() {
+ this.#x();
+ }
+}
+
+new C().x();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..7973af8125
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-contains-superproperty-2.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-eval-arrow-body.template
+/*---
+description: super['x'] in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; () => super["x"];');
+ x() {
+ this.#x();
+ }
+}
+
+new C().x();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..21281940b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-eval-arrow-body.template
+/*---
+description: error if `super()['x']` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; () => super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..154041c503
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-eval-arrow-body.template
+/*---
+description: error if `super().x` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; () => super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..df7a681804
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-direct-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-eval-arrow-body.template
+/*---
+description: error if `super()` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; () => super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..407e470762
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-1.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-indirect-eval-arrow-body.template
+/*---
+description: super.x in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+class A {}
+class C extends A {
+ #x = (0, eval)('() => super.x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..19ace0c9d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-contains-superproperty-2.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-indirect-eval-arrow-body.template
+/*---
+description: super['x'] in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+class A {}
+class C extends A {
+ #x = (0, eval)('() => super["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..c36853216f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-1.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-indirect-eval-arrow-body.template
+/*---
+description: error if `super()['x']` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+class A {}
+class C extends A {
+ #x = (0, eval)('() => super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..dcbaf799a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall-2.js
@@ -0,0 +1,29 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-indirect-eval-arrow-body.template
+/*---
+description: error if `super().x` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+class A {}
+class C extends A {
+ #x = (0, eval)('() => super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..637904527e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-derived-cls-indirect-eval-err-contains-supercall.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-indirect-eval-arrow-body.template
+/*---
+description: error if `super()` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+class A {}
+class C extends A {
+ #x = (0, eval)('() => super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-direct-eval-err-contains-arguments.js
new file mode 100644
index 0000000000..f8639d98b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-direct-eval-err-contains-arguments.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-arguments.case
+// - src/class-elements/initializer-direct-eval-arguments/cls-decl-private-fields-eval-arrow-body.template
+/*---
+description: error if `arguments` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if ContainsArguments of StatementList is true.
+ ...
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+var executed = false;
+class C {
+ #x = eval('executed = true; () => arguments;');
+ constructor() {
+ this.#x();
+ }
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..3689dc5744
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-private-fields-eval-arrow-body.template
+/*---
+description: error if `new.target` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ #x = eval('executed = true; () => new.target;');
+ x() {
+ this.#x();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(executed, true);
+assert.sameValue(c.x(), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-body-private-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-indirect-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..3e0afad630
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-body-private-indirect-eval-err-contains-newtarget.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-private-fields-indirect-eval-arrow-body.template
+/*---
+description: error if `new.target` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+class C {
+ #x = (0, eval)('() => new.target;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-fnc-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/arrow-fnc-init-err-contains-arguments.js
new file mode 100644
index 0000000000..04dfb47d0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-fnc-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-arrow-fnc.template
+/*---
+description: Syntax error if `arguments` used in class field (arrow function expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, arrow-function]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/arrow-fnc-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/arrow-fnc-init-err-contains-super.js
new file mode 100644
index 0000000000..14f8d6ce04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/arrow-fnc-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-arrow-fnc.template
+/*---
+description: Syntax error if `super()` used in class field (arrow function expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, arrow-function]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..0e0615f565
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ var \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-binding-identifier.js
new file mode 100644
index 0000000000..503c9a6db4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ var await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..2ddc243efa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ void \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-identifier-reference.js
new file mode 100644
index 0000000000..309e88e2e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ void await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..3c29401caf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ \u0061wait: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-label-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-label-identifier.js
new file mode 100644
index 0000000000..e99c06f91f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/await-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ await: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/browser.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/shell.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..d219716f1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ var yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..d27ae33299
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ var yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..51d2a2d866
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ void yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..8c09fab99e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ void yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..03401d007a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ yi\u0065ld: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-label-identifier.js
new file mode 100644
index 0000000000..dde2b25edc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { static async *#gen() {
+ yield: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..30ca50da2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,76 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-spread-strict.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [object-spread, async-iteration, class-static-methods-private]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..c942f0ba2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-identifier-strict-strict.js
@@ -0,0 +1,67 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-strict.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js
new file mode 100644
index 0000000000..c2e2d7d1a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-catch.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}).catch(rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+});
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js
new file mode 100644
index 0000000000..cc865c0f2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-async-iterator.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: yield * [Promise.reject(value)] is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ for await (let line of readFile()) {
+ yield line;
+ }
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js
new file mode 100644
index 0000000000..fb2ad34bf8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-sync-iterator.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: yield Promise.reject(value) in for-await-of is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ for await (let value of iterable) {
+ yield value;
+ }
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js
new file mode 100644
index 0000000000..748159fe28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-async-iterator.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-async-iterator.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield * readFile();
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js
new file mode 100644
index 0000000000..9982495eb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-yield-star-sync-iterator.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-sync-iterator.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield * iterable;
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next.js
new file mode 100644
index 0000000000..25f0f09a64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..65942b1931
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-multiple.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Use yield value in a array spread position (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield [...yield yield];
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+
+item.then(({ done, value }) => {
+ item = iter.next(value);
+
+ item.then(({ done, value }) => {
+ assert.compareArray(value, arr);
+ assert.sameValue(done, false);
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-single.js
new file mode 100644
index 0000000000..67b22e88e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-single.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-single.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Use yield value in a array spread position (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield [...yield];
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next(false);
+var item = iter.next(arr);
+
+item.then(({ done, value }) => {
+ assert.notSameValue(value, arr, 'value is a new array');
+ assert(Array.isArray(value), 'value is an Array exotic object');
+ assert.sameValue(value.length, 3)
+ assert.sameValue(value[0], 'a');
+ assert.sameValue(value[1], 'b');
+ assert.sameValue(value[2], 'c');
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-obj.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-obj.js
new file mode 100644
index 0000000000..67812bf013
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-spread-obj.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-obj.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Use yield value in a object spread position (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [object-spread, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+item.then(({ done, value }) => {
+ assert.sameValue(value.x, 42);
+ assert.sameValue(value.y, 39);
+ assert.sameValue(Object.keys(value).length, 2);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-next.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-next.js
new file mode 100644
index 0000000000..ddac13eccf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-next.js
@@ -0,0 +1,247 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-next.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Execution order for yield* with async iterator and next() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({ name: "get [Symbol.iterator]" });
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({
+ name: "get [Symbol.asyncIterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.asyncIterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-promise-1",
+ get then() {
+ log.push({
+ name: "get next then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "next-promise-2",
+ get then() {
+ log.push({
+ name: "get next then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+ assert.sameValue(log[1].thisValue, obj, "get [Symbol.asyncIterator] thisValue");
+
+ assert.sameValue(log[2].name, "call [Symbol.asyncIterator]");
+ assert.sameValue(log[2].thisValue, obj, "[Symbol.asyncIterator] thisValue");
+ assert.sameValue(log[2].args.length, 0, "[Symbol.asyncIterator] args.length");
+
+ assert.sameValue(log[3].name, "get next");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "get next thisValue");
+
+ assert.sameValue(log[4].name, "call next");
+ assert.sameValue(log[4].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[4].args.length, 1, "next args.length");
+ assert.sameValue(log[4].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[5].name, "get next then (1)");
+ assert.sameValue(log[5].thisValue.name, "next-promise-1", "get next then thisValue");
+
+ assert.sameValue(log[6].name, "call next then (1)");
+ assert.sameValue(log[6].thisValue.name, "next-promise-1", "next then thisValue");
+ assert.sameValue(log[6].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[6].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[6].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[7].name, "get next done (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[8].name, "get next value (1)");
+ assert.sameValue(log[8].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 9, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[9].name, "call next");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[9].args.length, 1, "next args.length");
+ assert.sameValue(log[9].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[10].name, "get next then (2)");
+ assert.sameValue(log[10].thisValue.name, "next-promise-2", "get next then thisValue");
+
+ assert.sameValue(log[11].name, "call next then (2)");
+ assert.sameValue(log[11].thisValue.name, "next-promise-2", "next then thisValue");
+ assert.sameValue(log[11].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[12].name, "get next done (2)");
+ assert.sameValue(log[12].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[13].name, "get next value (2)");
+ assert.sameValue(log[13].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-return.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-return.js
new file mode 100644
index 0000000000..3c4a474b2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-return.js
@@ -0,0 +1,263 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-return.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: execution order for yield* with async iterator and return() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, Symbol.asyncIterator, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator, « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. If generatorKind is async, then set value to ? Await(value).
+ 3. Return Completion{[[Type]]: return, [[Value]]: value, [[Target]]: empty}.
+ ix. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var returnCount = 0;
+ return {
+ name: 'asyncIterator',
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-promise-1",
+ get then() {
+ log.push({
+ name: "get return then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "return-promise-2",
+ get then() {
+ log.push({
+ name: "get return then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return then (1)");
+ assert.sameValue(log[4].thisValue.name, "return-promise-1", "get return then thisValue");
+
+ assert.sameValue(log[5].name, "call return then (1)");
+ assert.sameValue(log[5].thisValue.name, "return-promise-1", "return then thisValue");
+ assert.sameValue(log[5].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[6].name, "get return done (1)");
+ assert.sameValue(log[6].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[7].name, "get return value (1)");
+ assert.sameValue(log[7].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.return("return-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get return");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[9].name, "call return");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[9].args.length, 1, "return args.length");
+ assert.sameValue(log[9].args[0], "return-arg-2", "return args[0]");
+
+ assert.sameValue(log[10].name, "get return then (2)");
+ assert.sameValue(log[10].thisValue.name, "return-promise-2", "get return then thisValue");
+
+ assert.sameValue(log[11].name, "call return then (2)");
+ assert.sameValue(log[11].thisValue.name, "return-promise-2", "return then thisValue");
+ assert.sameValue(log[11].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[12].name, "get return done (2)");
+ assert.sameValue(log[12].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[13].name, "get return value (2)");
+ assert.sameValue(log[13].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 14, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-throw.js
new file mode 100644
index 0000000000..6627b10e60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-async-throw.js
@@ -0,0 +1,271 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: execution order for yield* with async iterator and throw() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, Symbol.asyncIterator, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Let resultValue be Return ? IteratorValue(innerResult).
+ b. If generatorKind is async, then set resultValue to ? Await(resultValue).
+ c. Return resultValue.
+ 7. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var throwCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-promise-1",
+ get then() {
+ log.push({
+ name: "get throw then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "throw-promise-2",
+ get then() {
+ log.push({
+ name: "get throw then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw then (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-promise-1", "get throw thisValue");
+
+ assert.sameValue(log[5].name, "call throw then (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-promise-1", "throw thisValue");
+ assert.sameValue(log[5].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[6].name, "get throw done (1)");
+ assert.sameValue(log[6].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[7].name, "get throw value (1)");
+ assert.sameValue(log[7].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.throw("throw-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get throw");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[9].name, "call throw");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[9].args.length, 1, "throw args.length");
+ assert.sameValue(log[9].args[0], "throw-arg-2", "throw args[0]");
+
+ assert.sameValue(log[10].name, "get throw then (2)");
+ assert.sameValue(log[10].thisValue.name, "throw-promise-2", "get throw thisValue");
+
+ assert.sameValue(log[11].name, "call throw then (2)");
+ assert.sameValue(log[11].thisValue.name, "throw-promise-2", "throw thisValue");
+ assert.sameValue(log[11].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[12].name, "get throw done (2)");
+ assert.sameValue(log[12].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[13].name, "get throw value (2)");
+ assert.sameValue(log[13].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js
new file mode 100644
index 0000000000..8e47406b79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-expr-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while getting yield* operand (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ ...
+
+---*/
+var obj = {};
+var abrupt = function() {
+ throw obj;
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* abrupt();
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, obj, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js
new file mode 100644
index 0000000000..c97c341790
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-get-abrupt.js
@@ -0,0 +1,102 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while getting [Symbol.asyncIterator] (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ get [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..55f538fe56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-boolean-throw.js
@@ -0,0 +1,101 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js
new file mode 100644
index 0000000000..1014533cbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-number-throw.js
@@ -0,0 +1,101 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js
new file mode 100644
index 0000000000..d883087711
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-object-throw.js
@@ -0,0 +1,101 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js
new file mode 100644
index 0000000000..0c93ce30d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-string-throw.js
@@ -0,0 +1,101 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..671d88533b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-not-callable-symbol-throw.js
@@ -0,0 +1,101 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: Symbol.asyncIterator
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js
new file mode 100644
index 0000000000..6bfab44818
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-null-sync-get-abrupt.js
@@ -0,0 +1,107 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while getting @@iterator after null @@asyncIterator (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js
new file mode 100644
index 0000000000..59c737afa7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-abrupt.js
@@ -0,0 +1,98 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while calling [Symbol.asyncIterator] (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js
new file mode 100644
index 0000000000..bb47a63b8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-boolean-throw.js
@@ -0,0 +1,98 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - boolean (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js
new file mode 100644
index 0000000000..3d714358e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-null-throw.js
@@ -0,0 +1,98 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - null (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js
new file mode 100644
index 0000000000..2ef5888a9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-number-throw.js
@@ -0,0 +1,98 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - number (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return 42;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js
new file mode 100644
index 0000000000..dca0dd2b18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-string-throw.js
@@ -0,0 +1,98 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - string (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return '42';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js
new file mode 100644
index 0000000000..b1f79aad56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-symbol-throw.js
@@ -0,0 +1,98 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - symbol (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return Symbol.asyncIterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js
new file mode 100644
index 0000000000..d242e4b5af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-returns-undefined-throw.js
@@ -0,0 +1,98 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - undefined (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js
new file mode 100644
index 0000000000..c4697dc91e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js
@@ -0,0 +1,107 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js
new file mode 100644
index 0000000000..f2166f1822
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-get-abrupt.js
@@ -0,0 +1,101 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while getting [Symbol.iterator] (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..a51bb1dc62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js
new file mode 100644
index 0000000000..9ee061597c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-number-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js
new file mode 100644
index 0000000000..cdb8723bed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-object-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js
new file mode 100644
index 0000000000..21ea26481e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-string-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..b43852feb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: Symbol.iterator
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js
new file mode 100644
index 0000000000..676d38e67d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-abrupt.js
@@ -0,0 +1,95 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while calling [Symbol.iterator] (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js
new file mode 100644
index 0000000000..ff94fc055e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-boolean-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - boolean (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js
new file mode 100644
index 0000000000..d6da5ff2fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-null-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - null (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js
new file mode 100644
index 0000000000..db0e8b7ef8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-number-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - number (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return 0;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js
new file mode 100644
index 0000000000..906b3fb983
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-string-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - string (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return '';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js
new file mode 100644
index 0000000000..b98f887f1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-symbol-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - symbol (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return Symbol.iterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js
new file mode 100644
index 0000000000..df045b3506
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-getiter-sync-returns-undefined-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - undefined (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js
new file mode 100644
index 0000000000..f4f4bfcaa2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-done-get-abrupt.js
@@ -0,0 +1,101 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-done-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while getting done (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get done() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js
new file mode 100644
index 0000000000..44d53c9aeb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-returns-abrupt.js
@@ -0,0 +1,93 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while calling next (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js
new file mode 100644
index 0000000000..c67b429835
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-call-value-get-abrupt.js
@@ -0,0 +1,103 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-value-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while getting value (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ done: true,
+ get value() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js
new file mode 100644
index 0000000000..08dffdc7f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-get-abrupt.js
@@ -0,0 +1,93 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Abrupt completion while getting next (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ get next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js
new file mode 100644
index 0000000000..3f0aa165b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-non-object-ignores-then.js
@@ -0,0 +1,113 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-non-object-ignores-then.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: If next() value is not-object, do not access respective then property (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+
+---*/
+Number.prototype.then = function() {
+ throw new Test262Error('Number#then should not be used');
+};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return 42;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, 'TypeError');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..3464f628ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-boolean-throw.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Not-callable next value in a yield star position - boolean (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: true
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js
new file mode 100644
index 0000000000..57da39aeca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-null-throw.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-null-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Not-callable next value in a yield star position - null (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: null
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js
new file mode 100644
index 0000000000..8085cdc57a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-number-throw.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Not-callable next value in a yield star position - number (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: 42
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js
new file mode 100644
index 0000000000..c6a88ebefe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-object-throw.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Not-callable next value in a yield star position - object (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: {}
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js
new file mode 100644
index 0000000000..d4a7d99cbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-string-throw.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Not-callable next value in a yield star position - string (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: ''
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..c1af4d3e4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-symbol-throw.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Not-callable next value in a yield star position - symbol (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: Symbol('oi')
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js
new file mode 100644
index 0000000000..642e08097b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-not-callable-undefined-throw.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Not-callable next value in a yield star position - undefined (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: undefined
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js
new file mode 100644
index 0000000000..03d1fb048b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-get-abrupt.js
@@ -0,0 +1,117 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-get-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Return abrupt after getting next().then (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js
new file mode 100644
index 0000000000..25c210f1bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (boolean) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: true,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js
new file mode 100644
index 0000000000..b3f296d63a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (null) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: null,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js
new file mode 100644
index 0000000000..ba523fd14b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (number) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: 39,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js
new file mode 100644
index 0000000000..d333662616
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (object) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: {},
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js
new file mode 100644
index 0000000000..b5b2c43cfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (string) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: '',
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js
new file mode 100644
index 0000000000..3a79a2c162
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (symbol) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: Symbol('oi'),
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js
new file mode 100644
index 0000000000..dfbd1f5642
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (undefined) (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: undefined,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js
new file mode 100644
index 0000000000..5b23bd00c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-next-then-returns-abrupt.js
@@ -0,0 +1,117 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: Return abrupt after calling next().then (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-next.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-next.js
new file mode 100644
index 0000000000..b89eab149d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-next.js
@@ -0,0 +1,250 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-next.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: execution order for yield* with sync iterator and next() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ 5. Let received be NormalCompletion(undefined).
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]).
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ vii. Let received be GeneratorYield(innerResult).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.next ( value )
+
+ ...
+ 5. Let nextResult be IteratorNext(syncIterator, value).
+ ...
+ 7. Let nextValue be IteratorValue(nextResult).
+ ...
+ 9. Let nextDone be IteratorComplete(nextResult).
+ ...
+ 12. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « nextValue »).
+ ...
+ 14. Set onFulfilled.[[Done]] to nextDone.
+ 15. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+ Async Iterator Value Unwrap Functions
+
+ 1. Return ! CreateIterResultObject(value, F.[[Done]]).
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({
+ name: "get [Symbol.iterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.iterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ };
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({ name: "get [Symbol.asyncIterator]" });
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+
+ assert.sameValue(log[2].name, "get [Symbol.iterator]");
+ assert.sameValue(log[2].thisValue, obj, "get [Symbol.iterator] thisValue");
+
+ assert.sameValue(log[3].name, "call [Symbol.iterator]");
+ assert.sameValue(log[3].thisValue, obj, "[Symbol.iterator] thisValue");
+ assert.sameValue(log[3].args.length, 0, "[Symbol.iterator] args.length");
+
+ assert.sameValue(log[4].name, "get next");
+ assert.sameValue(log[4].thisValue.name, "syncIterator", "get next thisValue");
+
+ assert.sameValue(log[5].name, "call next");
+ assert.sameValue(log[5].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[5].args.length, 1, "next args.length");
+ assert.sameValue(log[5].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[6].name, "get next done (1)");
+ assert.sameValue(log[6].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[7].name, "get next value (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[8].name, "call next");
+ assert.sameValue(log[8].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[8].args.length, 1, "next args.length");
+ assert.sameValue(log[8].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[9].name, "get next done (2)");
+ assert.sameValue(log[9].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[10].name, "get next value (2)");
+ assert.sameValue(log[10].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[11].name, "after yield*");
+ assert.sameValue(log[11].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 12, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-return.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-return.js
new file mode 100644
index 0000000000..77a9271528
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-return.js
@@ -0,0 +1,225 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-return.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: execution order for yield* with sync iterator and return() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator,
+ « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to
+ ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. Return Completion{[[Type]]: return, [[Value]]: value,
+ [[Target]]: empty}.
+ ix. Let received be GeneratorYield(innerResult).
+
+ %AsyncFromSyncIteratorPrototype%.return ( value )
+
+ 5. Let return be GetMethod(syncIterator, "return").
+ ...
+ ...
+ 8. Let returnResult be Call(return, syncIterator, « value »).
+ ...
+ 11. Let returnValue be IteratorValue(returnResult).
+ ..
+ 13. Let returnDone be IteratorComplete(returnResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, « returnValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to returnDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var returnCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return done (1)");
+ assert.sameValue(log[4].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[5].name, "get return value (1)");
+ assert.sameValue(log[5].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.return().then(v => {
+ assert.sameValue(log[6].name, "get return");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[7].name, "call return");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "get return thisValue");
+ assert.sameValue(log[7].args.length, 1, "return args.length");
+ assert.sameValue(log[7].args[0], undefined, "return args[0]");
+
+ assert.sameValue(log[8].name, "get return done (2)");
+ assert.sameValue(log[8].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[9].name, "get return value (2)");
+ assert.sameValue(log[9].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 10, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-throw.js
new file mode 100644
index 0000000000..dfb64cf844
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method-static/yield-star-sync-throw.js
@@ -0,0 +1,231 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-throw.case
+// - src/async-generators/default/async-class-decl-static-private-method.template
+/*---
+description: execution order for yield* with sync iterator and throw() (Static async generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Return ? IteratorValue(innerResult).
+ 7. Let received be GeneratorYield(innerResult).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.throw ( value )
+
+ ...
+ 5. Let throw be GetMethod(syncIterator, "throw").
+ ...
+ 8. Let throwResult be Call(throw, syncIterator, « value »).
+ ...
+ 11. Let throwValue be IteratorValue(throwResult).
+ ...
+ 13. Let throwDone be IteratorComplete(throwResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « throwValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to throwDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var throwCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ static async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw done (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[5].name, "get throw value (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.throw().then(v => {
+ assert.sameValue(log[6].name, "get throw");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[7].name, "call throw");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[7].args.length, 1, "throw args.length");
+ assert.sameValue(log[7].args[0], undefined, "throw args[0]");
+
+ assert.sameValue(log[8].name, "get throw done (2)");
+ assert.sameValue(log[8].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[9].name, "get throw value (2)");
+ assert.sameValue(log[9].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[10].name, "after yield*");
+ assert.sameValue(log[10].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 11, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..9e78aaed3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ var \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-binding-identifier.js
new file mode 100644
index 0000000000..1e8be0a40c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ var await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..3946d6a560
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ void \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-identifier-reference.js
new file mode 100644
index 0000000000..7eab728df7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ void await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..94641fd63d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ \u0061wait: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-label-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-label-identifier.js
new file mode 100644
index 0000000000..5af287c972
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/await-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ await: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/browser.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/shell.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..589fa48c4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ var yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..27697e049c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ var yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..d67ee05eb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ void yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..110db6d7e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ void yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..6f91bff379
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ yi\u0065ld: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-label-identifier.js
new file mode 100644
index 0000000000..a35f903c9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator private method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * # PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *#gen() {
+ yield: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..ae61f6aca5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-spread-strict.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [object-spread, async-iteration, class-methods-private]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..3f4c11a46a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-identifier-strict-strict.js
@@ -0,0 +1,77 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-strict.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js
new file mode 100644
index 0000000000..8d8733af64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-catch.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}).catch(rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+});
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js
new file mode 100644
index 0000000000..04582ff261
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js
@@ -0,0 +1,88 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-async-iterator.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: yield * [Promise.reject(value)] is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ for await (let line of readFile()) {
+ yield line;
+ }
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js
new file mode 100644
index 0000000000..50f8910ce2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-sync-iterator.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-sync-iterator.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: yield Promise.reject(value) in for-await-of is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ for await (let value of iterable) {
+ yield value;
+ }
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js
new file mode 100644
index 0000000000..c169a9cfd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-async-iterator.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-async-iterator.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield * readFile();
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js
new file mode 100644
index 0000000000..dab0435550
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-yield-star-sync-iterator.js
@@ -0,0 +1,85 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-sync-iterator.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield * iterable;
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next.js
new file mode 100644
index 0000000000..8501934ec7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-promise-reject-next.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..eaad1ac942
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js
@@ -0,0 +1,88 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-multiple.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Use yield value in a array spread position (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield [...yield yield];
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+
+item.then(({ done, value }) => {
+ item = iter.next(value);
+
+ item.then(({ done, value }) => {
+ assert.compareArray(value, arr);
+ assert.sameValue(done, false);
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-arr-single.js
new file mode 100644
index 0000000000..760230055e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-arr-single.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-single.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Use yield value in a array spread position (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield [...yield];
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next(false);
+var item = iter.next(arr);
+
+item.then(({ done, value }) => {
+ assert.notSameValue(value, arr, 'value is a new array');
+ assert(Array.isArray(value), 'value is an Array exotic object');
+ assert.sameValue(value.length, 3)
+ assert.sameValue(value[0], 'a');
+ assert.sameValue(value[1], 'b');
+ assert.sameValue(value[2], 'c');
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-obj.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-obj.js
new file mode 100644
index 0000000000..bb1db84550
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-spread-obj.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-obj.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Use yield value in a object spread position (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [object-spread, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+item.then(({ done, value }) => {
+ assert.sameValue(value.x, 42);
+ assert.sameValue(value.y, 39);
+ assert.sameValue(Object.keys(value).length, 2);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-next.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-next.js
new file mode 100644
index 0000000000..fa862ba92d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-next.js
@@ -0,0 +1,257 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-next.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Execution order for yield* with async iterator and next() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({ name: "get [Symbol.iterator]" });
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({
+ name: "get [Symbol.asyncIterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.asyncIterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-promise-1",
+ get then() {
+ log.push({
+ name: "get next then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "next-promise-2",
+ get then() {
+ log.push({
+ name: "get next then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+ assert.sameValue(log[1].thisValue, obj, "get [Symbol.asyncIterator] thisValue");
+
+ assert.sameValue(log[2].name, "call [Symbol.asyncIterator]");
+ assert.sameValue(log[2].thisValue, obj, "[Symbol.asyncIterator] thisValue");
+ assert.sameValue(log[2].args.length, 0, "[Symbol.asyncIterator] args.length");
+
+ assert.sameValue(log[3].name, "get next");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "get next thisValue");
+
+ assert.sameValue(log[4].name, "call next");
+ assert.sameValue(log[4].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[4].args.length, 1, "next args.length");
+ assert.sameValue(log[4].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[5].name, "get next then (1)");
+ assert.sameValue(log[5].thisValue.name, "next-promise-1", "get next then thisValue");
+
+ assert.sameValue(log[6].name, "call next then (1)");
+ assert.sameValue(log[6].thisValue.name, "next-promise-1", "next then thisValue");
+ assert.sameValue(log[6].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[6].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[6].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[7].name, "get next done (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[8].name, "get next value (1)");
+ assert.sameValue(log[8].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 9, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[9].name, "call next");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[9].args.length, 1, "next args.length");
+ assert.sameValue(log[9].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[10].name, "get next then (2)");
+ assert.sameValue(log[10].thisValue.name, "next-promise-2", "get next then thisValue");
+
+ assert.sameValue(log[11].name, "call next then (2)");
+ assert.sameValue(log[11].thisValue.name, "next-promise-2", "next then thisValue");
+ assert.sameValue(log[11].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[12].name, "get next done (2)");
+ assert.sameValue(log[12].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[13].name, "get next value (2)");
+ assert.sameValue(log[13].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-return.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-return.js
new file mode 100644
index 0000000000..eb160aa548
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-return.js
@@ -0,0 +1,273 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-return.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: execution order for yield* with async iterator and return() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, Symbol.asyncIterator, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator, « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. If generatorKind is async, then set value to ? Await(value).
+ 3. Return Completion{[[Type]]: return, [[Value]]: value, [[Target]]: empty}.
+ ix. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var returnCount = 0;
+ return {
+ name: 'asyncIterator',
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-promise-1",
+ get then() {
+ log.push({
+ name: "get return then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "return-promise-2",
+ get then() {
+ log.push({
+ name: "get return then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return then (1)");
+ assert.sameValue(log[4].thisValue.name, "return-promise-1", "get return then thisValue");
+
+ assert.sameValue(log[5].name, "call return then (1)");
+ assert.sameValue(log[5].thisValue.name, "return-promise-1", "return then thisValue");
+ assert.sameValue(log[5].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[6].name, "get return done (1)");
+ assert.sameValue(log[6].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[7].name, "get return value (1)");
+ assert.sameValue(log[7].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.return("return-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get return");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[9].name, "call return");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[9].args.length, 1, "return args.length");
+ assert.sameValue(log[9].args[0], "return-arg-2", "return args[0]");
+
+ assert.sameValue(log[10].name, "get return then (2)");
+ assert.sameValue(log[10].thisValue.name, "return-promise-2", "get return then thisValue");
+
+ assert.sameValue(log[11].name, "call return then (2)");
+ assert.sameValue(log[11].thisValue.name, "return-promise-2", "return then thisValue");
+ assert.sameValue(log[11].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[12].name, "get return done (2)");
+ assert.sameValue(log[12].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[13].name, "get return value (2)");
+ assert.sameValue(log[13].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 14, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-throw.js
new file mode 100644
index 0000000000..96ff255a2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-async-throw.js
@@ -0,0 +1,281 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: execution order for yield* with async iterator and throw() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, Symbol.asyncIterator, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Let resultValue be Return ? IteratorValue(innerResult).
+ b. If generatorKind is async, then set resultValue to ? Await(resultValue).
+ c. Return resultValue.
+ 7. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var throwCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-promise-1",
+ get then() {
+ log.push({
+ name: "get throw then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "throw-promise-2",
+ get then() {
+ log.push({
+ name: "get throw then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw then (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-promise-1", "get throw thisValue");
+
+ assert.sameValue(log[5].name, "call throw then (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-promise-1", "throw thisValue");
+ assert.sameValue(log[5].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[6].name, "get throw done (1)");
+ assert.sameValue(log[6].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[7].name, "get throw value (1)");
+ assert.sameValue(log[7].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.throw("throw-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get throw");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[9].name, "call throw");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[9].args.length, 1, "throw args.length");
+ assert.sameValue(log[9].args[0], "throw-arg-2", "throw args[0]");
+
+ assert.sameValue(log[10].name, "get throw then (2)");
+ assert.sameValue(log[10].thisValue.name, "throw-promise-2", "get throw thisValue");
+
+ assert.sameValue(log[11].name, "call throw then (2)");
+ assert.sameValue(log[11].thisValue.name, "throw-promise-2", "throw thisValue");
+ assert.sameValue(log[11].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[12].name, "get throw done (2)");
+ assert.sameValue(log[12].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[13].name, "get throw value (2)");
+ assert.sameValue(log[13].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-expr-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-expr-abrupt.js
new file mode 100644
index 0000000000..91d08ffc93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-expr-abrupt.js
@@ -0,0 +1,92 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-expr-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while getting yield* operand (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ ...
+
+---*/
+var obj = {};
+var abrupt = function() {
+ throw obj;
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* abrupt();
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, obj, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js
new file mode 100644
index 0000000000..2b0d311b2e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-get-abrupt.js
@@ -0,0 +1,112 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-get-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while getting [Symbol.asyncIterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ get [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..b5a7b2a394
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-boolean-throw.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js
new file mode 100644
index 0000000000..7bfc8e0dbf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-number-throw.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js
new file mode 100644
index 0000000000..2bd00fd6a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-object-throw.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js
new file mode 100644
index 0000000000..077c8f6745
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-string-throw.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..443ac26876
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-not-callable-symbol-throw.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: Symbol.asyncIterator
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js
new file mode 100644
index 0000000000..e8b2f33c0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-null-sync-get-abrupt.js
@@ -0,0 +1,117 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while getting @@iterator after null @@asyncIterator (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js
new file mode 100644
index 0000000000..33db1241b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-abrupt.js
@@ -0,0 +1,108 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while calling [Symbol.asyncIterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js
new file mode 100644
index 0000000000..4f38c21ac6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-boolean-throw.js
@@ -0,0 +1,108 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - boolean (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js
new file mode 100644
index 0000000000..60af524617
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-null-throw.js
@@ -0,0 +1,108 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - null (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js
new file mode 100644
index 0000000000..3d8016897d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-number-throw.js
@@ -0,0 +1,108 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - number (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return 42;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js
new file mode 100644
index 0000000000..a30b5f666d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-string-throw.js
@@ -0,0 +1,108 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - string (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return '42';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js
new file mode 100644
index 0000000000..8f1f6b80f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-symbol-throw.js
@@ -0,0 +1,108 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - symbol (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return Symbol.asyncIterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js
new file mode 100644
index 0000000000..e7bc047cdf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-returns-undefined-throw.js
@@ -0,0 +1,108 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - undefined (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js
new file mode 100644
index 0000000000..4ac2e2c911
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-async-undefined-sync-get-abrupt.js
@@ -0,0 +1,117 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js
new file mode 100644
index 0000000000..741f3f3879
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-get-abrupt.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while getting [Symbol.iterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..14ed0208c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-boolean-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js
new file mode 100644
index 0000000000..631ffec6b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-number-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js
new file mode 100644
index 0000000000..e9f554efbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-object-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js
new file mode 100644
index 0000000000..aeb155bb63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-string-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..90515b351d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-not-callable-symbol-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: Symbol.iterator
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js
new file mode 100644
index 0000000000..73f3e12790
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-abrupt.js
@@ -0,0 +1,105 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while calling [Symbol.iterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js
new file mode 100644
index 0000000000..50015e0abd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-boolean-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - boolean (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js
new file mode 100644
index 0000000000..63546450d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-null-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - null (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js
new file mode 100644
index 0000000000..1f52d1a513
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-number-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - number (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return 0;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js
new file mode 100644
index 0000000000..1b0fdcb4a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-string-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - string (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return '';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js
new file mode 100644
index 0000000000..8e86c1bd75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-symbol-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - symbol (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return Symbol.iterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js
new file mode 100644
index 0000000000..eaf82447ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-getiter-sync-returns-undefined-throw.js
@@ -0,0 +1,110 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - undefined (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js
new file mode 100644
index 0000000000..d5bb772855
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-done-get-abrupt.js
@@ -0,0 +1,111 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-done-get-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while getting done (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get done() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js
new file mode 100644
index 0000000000..a6f731dc94
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-returns-abrupt.js
@@ -0,0 +1,103 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while calling next (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js
new file mode 100644
index 0000000000..c44953c1c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-call-value-get-abrupt.js
@@ -0,0 +1,113 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-value-get-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while getting value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ done: true,
+ get value() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js
new file mode 100644
index 0000000000..abeada6161
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js
@@ -0,0 +1,103 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-get-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Abrupt completion while getting next (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ get next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js
new file mode 100644
index 0000000000..ed897fb8c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-non-object-ignores-then.js
@@ -0,0 +1,123 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-non-object-ignores-then.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: If next() value is not-object, do not access respective then property (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+
+---*/
+Number.prototype.then = function() {
+ throw new Test262Error('Number#then should not be used');
+};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return 42;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, 'TypeError');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..daa99c2779
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-boolean-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Not-callable next value in a yield star position - boolean (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: true
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js
new file mode 100644
index 0000000000..525fe38596
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-null-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-null-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Not-callable next value in a yield star position - null (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: null
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js
new file mode 100644
index 0000000000..9883a3cdd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-number-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Not-callable next value in a yield star position - number (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: 42
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js
new file mode 100644
index 0000000000..1b592d2d99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-object-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Not-callable next value in a yield star position - object (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: {}
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js
new file mode 100644
index 0000000000..93f1525f17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-string-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Not-callable next value in a yield star position - string (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: ''
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..113904c014
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-symbol-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Not-callable next value in a yield star position - symbol (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: Symbol('oi')
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js
new file mode 100644
index 0000000000..bd66cf0493
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-not-callable-undefined-throw.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Not-callable next value in a yield star position - undefined (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: undefined
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js
new file mode 100644
index 0000000000..ad8c9590e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-get-abrupt.js
@@ -0,0 +1,127 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-get-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Return abrupt after getting next().then (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js
new file mode 100644
index 0000000000..e6b3723774
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (boolean) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: true,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js
new file mode 100644
index 0000000000..03a65a9806
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-null-fulfillpromise.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (null) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: null,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js
new file mode 100644
index 0000000000..612f73cafe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-number-fulfillpromise.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (number) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: 39,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js
new file mode 100644
index 0000000000..aa38dcfbe2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-object-fulfillpromise.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (object) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: {},
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js
new file mode 100644
index 0000000000..058b82d40a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-string-fulfillpromise.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (string) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: '',
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js
new file mode 100644
index 0000000000..121893b0ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (symbol) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: Symbol('oi'),
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js
new file mode 100644
index 0000000000..ac4111c2b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (undefined) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: undefined,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js
new file mode 100644
index 0000000000..16e6019abd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-next-then-returns-abrupt.js
@@ -0,0 +1,127 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: Return abrupt after calling next().then (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-next.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-next.js
new file mode 100644
index 0000000000..70ebbacca3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-next.js
@@ -0,0 +1,260 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-next.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: execution order for yield* with sync iterator and next() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ 5. Let received be NormalCompletion(undefined).
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]).
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ vii. Let received be GeneratorYield(innerResult).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.next ( value )
+
+ ...
+ 5. Let nextResult be IteratorNext(syncIterator, value).
+ ...
+ 7. Let nextValue be IteratorValue(nextResult).
+ ...
+ 9. Let nextDone be IteratorComplete(nextResult).
+ ...
+ 12. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « nextValue »).
+ ...
+ 14. Set onFulfilled.[[Done]] to nextDone.
+ 15. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+ Async Iterator Value Unwrap Functions
+
+ 1. Return ! CreateIterResultObject(value, F.[[Done]]).
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({
+ name: "get [Symbol.iterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.iterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ };
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({ name: "get [Symbol.asyncIterator]" });
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+
+ assert.sameValue(log[2].name, "get [Symbol.iterator]");
+ assert.sameValue(log[2].thisValue, obj, "get [Symbol.iterator] thisValue");
+
+ assert.sameValue(log[3].name, "call [Symbol.iterator]");
+ assert.sameValue(log[3].thisValue, obj, "[Symbol.iterator] thisValue");
+ assert.sameValue(log[3].args.length, 0, "[Symbol.iterator] args.length");
+
+ assert.sameValue(log[4].name, "get next");
+ assert.sameValue(log[4].thisValue.name, "syncIterator", "get next thisValue");
+
+ assert.sameValue(log[5].name, "call next");
+ assert.sameValue(log[5].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[5].args.length, 1, "next args.length");
+ assert.sameValue(log[5].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[6].name, "get next done (1)");
+ assert.sameValue(log[6].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[7].name, "get next value (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[8].name, "call next");
+ assert.sameValue(log[8].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[8].args.length, 1, "next args.length");
+ assert.sameValue(log[8].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[9].name, "get next done (2)");
+ assert.sameValue(log[9].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[10].name, "get next value (2)");
+ assert.sameValue(log[10].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[11].name, "after yield*");
+ assert.sameValue(log[11].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 12, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-return.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-return.js
new file mode 100644
index 0000000000..ea4577649c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-return.js
@@ -0,0 +1,235 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-return.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: execution order for yield* with sync iterator and return() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator,
+ « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to
+ ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. Return Completion{[[Type]]: return, [[Value]]: value,
+ [[Target]]: empty}.
+ ix. Let received be GeneratorYield(innerResult).
+
+ %AsyncFromSyncIteratorPrototype%.return ( value )
+
+ 5. Let return be GetMethod(syncIterator, "return").
+ ...
+ ...
+ 8. Let returnResult be Call(return, syncIterator, « value »).
+ ...
+ 11. Let returnValue be IteratorValue(returnResult).
+ ..
+ 13. Let returnDone be IteratorComplete(returnResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, « returnValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to returnDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var returnCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return done (1)");
+ assert.sameValue(log[4].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[5].name, "get return value (1)");
+ assert.sameValue(log[5].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.return().then(v => {
+ assert.sameValue(log[6].name, "get return");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[7].name, "call return");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "get return thisValue");
+ assert.sameValue(log[7].args.length, 1, "return args.length");
+ assert.sameValue(log[7].args[0], undefined, "return args[0]");
+
+ assert.sameValue(log[8].name, "get return done (2)");
+ assert.sameValue(log[8].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[9].name, "get return value (2)");
+ assert.sameValue(log[9].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 10, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-throw.js b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-throw.js
new file mode 100644
index 0000000000..3579ace644
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-gen-private-method/yield-star-sync-throw.js
@@ -0,0 +1,241 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-throw.case
+// - src/async-generators/default/async-class-decl-private-method.template
+/*---
+description: execution order for yield* with sync iterator and throw() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorPrivateMethod
+features: [Symbol.iterator, async-iteration, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Return ? IteratorValue(innerResult).
+ 7. Let received be GeneratorYield(innerResult).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.throw ( value )
+
+ ...
+ 5. Let throw be GetMethod(syncIterator, "throw").
+ ...
+ 8. Let throwResult be Call(throw, syncIterator, « value »).
+ ...
+ 11. Let throwValue be IteratorValue(throwResult).
+ ...
+ 13. Let throwDone be IteratorComplete(throwResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « throwValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to throwDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var throwCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C {
+ async *#gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw done (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[5].name, "get throw value (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.throw().then(v => {
+ assert.sameValue(log[6].name, "get throw");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[7].name, "call throw");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[7].args.length, 1, "throw args.length");
+ assert.sameValue(log[7].args[0], undefined, "throw args[0]");
+
+ assert.sameValue(log[8].name, "get throw done (2)");
+ assert.sameValue(log[8].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[9].name, "get throw value (2)");
+ assert.sameValue(log[9].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[10].name, "after yield*");
+ assert.sameValue(log[10].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 11, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "#gen does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "#gen does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "#gen does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..65094a194e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-binding-identifier-escaped.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier-escaped.case
+// - src/async-functions/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async #method() {
+ var \u0061wait;
+ }
+}
+
+
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-binding-identifier.js
new file mode 100644
index 0000000000..03633af3f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-binding-identifier.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier.case
+// - src/async-functions/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async #method() {
+ var await;
+ }
+}
+
+
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..9497de6af9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-identifier-reference-escaped.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference-escaped.case
+// - src/async-functions/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async #method() {
+ void \u0061wait;
+ }
+}
+
+
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-identifier-reference.js
new file mode 100644
index 0000000000..186b301db2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-identifier-reference.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference.case
+// - src/async-functions/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async #method() {
+ void await;
+ }
+}
+
+
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..79c9a46179
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-label-identifier-escaped.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier-escaped.case
+// - src/async-functions/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async #method() {
+ \u0061wait: ;
+ }
+}
+
+
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-label-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-label-identifier.js
new file mode 100644
index 0000000000..d0493a7bac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/await-as-label-identifier.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier.case
+// - src/async-functions/syntax/async-class-decl-static-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ static async #method() {
+ await: ;
+ }
+}
+
+
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/browser.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow-returns-arguments-from-parent-function.js
new file mode 100644
index 0000000000..8fceeed5d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow-returns-arguments-from-parent-function.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-arguments-from-parent-function.case
+// - src/async-functions/evaluation/async-class-decl-static-private-method.template
+/*---
+description: Async function returns an async function. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async #method(x) {
+ let a = arguments;
+ return async () => a === arguments;
+ }
+ static async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method.bind(C);
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, true);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow-returns-newtarget.js
new file mode 100644
index 0000000000..3946ffd23a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow-returns-newtarget.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-newtarget.case
+// - src/async-functions/evaluation/async-class-decl-static-private-method.template
+/*---
+description: Async function returns an async function. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async #method(x) {
+ return async () => new.target;
+ }
+ static async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method.bind(C);
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow.js
new file mode 100644
index 0000000000..ae1ac57bf9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-arrow.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow.case
+// - src/async-functions/evaluation/async-class-decl-static-private-method.template
+/*---
+description: Async function returns an async function. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async #method(x) {
+ return async () => x;
+ }
+ static async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method.bind(C);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function-returns-arguments-from-own-function.js
new file mode 100644
index 0000000000..692da97eee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function-returns-arguments-from-own-function.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-arguments-from-own-function.case
+// - src/async-functions/evaluation/async-class-decl-static-private-method.template
+/*---
+description: Async function returns an async function. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async #method(x) {
+ let a = arguments;
+ return async function() { return a === arguments; };
+ }
+ static async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method.bind(C);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, false);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function-returns-newtarget.js
new file mode 100644
index 0000000000..0b2351911d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function-returns-newtarget.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-newtarget.case
+// - src/async-functions/evaluation/async-class-decl-static-private-method.template
+/*---
+description: Async function returns an async function. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async #method(x) {
+ return async function() { return new.target; };
+ }
+ static async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method.bind(C);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function.js
new file mode 100644
index 0000000000..8bdec77ce3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/returns-async-function.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function.case
+// - src/async-functions/evaluation/async-class-decl-static-private-method.template
+/*---
+description: Async function returns an async function. (Static async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-static-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ static async #method(x) {
+ return async function() { return x; };
+ }
+ static async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let asyncFn = C.method.bind(C);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method-static/shell.js b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method-static/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..d40bf022b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-binding-identifier-escaped.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier-escaped.case
+// - src/async-functions/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async #method() {
+ var \u0061wait;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-binding-identifier.js
new file mode 100644
index 0000000000..cf96ab3b04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-binding-identifier.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier.case
+// - src/async-functions/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async #method() {
+ var await;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..6a0207039f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-identifier-reference-escaped.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference-escaped.case
+// - src/async-functions/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async #method() {
+ void \u0061wait;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-identifier-reference.js
new file mode 100644
index 0000000000..7931167ccd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-identifier-reference.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference.case
+// - src/async-functions/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async #method() {
+ void await;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..20905576ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-label-identifier-escaped.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier-escaped.case
+// - src/async-functions/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async #method() {
+ \u0061wait: ;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-label-identifier.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-label-identifier.js
new file mode 100644
index 0000000000..c6859c2ecc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/await-as-label-identifier.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier.case
+// - src/async-functions/syntax/async-class-decl-private-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C {
+ async #method() {
+ await: ;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/browser.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow-returns-arguments-from-parent-function.js
new file mode 100644
index 0000000000..a40fd874eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow-returns-arguments-from-parent-function.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-arguments-from-parent-function.case
+// - src/async-functions/evaluation/async-class-decl-private-method.template
+/*---
+description: Async function returns an async function. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async #method(x) {
+ let a = arguments;
+ return async () => a === arguments;
+ }
+ async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, true);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow-returns-newtarget.js
new file mode 100644
index 0000000000..f960ba8e6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow-returns-newtarget.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-newtarget.case
+// - src/async-functions/evaluation/async-class-decl-private-method.template
+/*---
+description: Async function returns an async function. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async #method(x) {
+ return async () => new.target;
+ }
+ async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow.js
new file mode 100644
index 0000000000..ee8b999095
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-arrow.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow.case
+// - src/async-functions/evaluation/async-class-decl-private-method.template
+/*---
+description: Async function returns an async function. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async #method(x) {
+ return async () => x;
+ }
+ async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function-returns-arguments-from-own-function.js
new file mode 100644
index 0000000000..462ae56bc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function-returns-arguments-from-own-function.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-arguments-from-own-function.case
+// - src/async-functions/evaluation/async-class-decl-private-method.template
+/*---
+description: Async function returns an async function. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async #method(x) {
+ let a = arguments;
+ return async function() { return a === arguments; };
+ }
+ async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, false);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function-returns-newtarget.js
new file mode 100644
index 0000000000..6046cef1b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function-returns-newtarget.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-newtarget.case
+// - src/async-functions/evaluation/async-class-decl-private-method.template
+/*---
+description: Async function returns an async function. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async #method(x) {
+ return async function() { return new.target; };
+ }
+ async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function.js
new file mode 100644
index 0000000000..2dc6bce21a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/returns-async-function.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function.case
+// - src/async-functions/evaluation/async-class-decl-private-method.template
+/*---
+description: Async function returns an async function. (Async private method as a ClassDeclaration element)
+esid: prod-AsyncMethod
+features: [async-functions, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ AsyncMethod
+
+ Async Function Definitions
+
+ AsyncMethod :
+ async [no LineTerminator here] # PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+class C {
+ async #method(x) {
+ return async function() { return x; };
+ }
+ async method(x) {
+ return this.#method(x);
+ }
+}
+// Stores a reference `asyncFn` for case evaluation
+let c = new C();
+let asyncFn = c.method.bind(c);
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/async-private-method/shell.js b/js/src/tests/test262/language/statements/class/elements/async-private-method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/async-private-method/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/browser.js b/js/src/tests/test262/language/statements/class/elements/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/class-field-is-observable-by-proxy.js b/js/src/tests/test262/language/statements/class/elements/class-field-is-observable-by-proxy.js
new file mode 100644
index 0000000000..9585324332
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/class-field-is-observable-by-proxy.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2019 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Public class fields initialization calls [[DefineOwnProperty]]
+esid: sec-define-field
+info: |
+ DefineField(receiver, fieldRecord)
+ ...
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+includes: [compareArray.js]
+features: [class, class-fields-public, Proxy]
+---*/
+
+let arr = [];
+let expectedTarget = null;
+function ProxyBase() {
+ expectedTarget = this;
+ return new Proxy(this, {
+ defineProperty: function (target, key, descriptor) {
+ arr.push(key);
+ arr.push(descriptor.value);
+ arr.push(target);
+ assert.sameValue(descriptor.enumerable, true);
+ assert.sameValue(descriptor.configurable, true);
+ assert.sameValue(descriptor.writable, true);
+ return Reflect.defineProperty(target, key, descriptor);
+ }
+ });
+}
+
+class Test extends ProxyBase {
+ f = 3;
+ g = "Test262";
+}
+
+let t = new Test();
+assert.sameValue(t.f, 3);
+assert.sameValue(t.g, "Test262");
+
+assert.compareArray(arr, ["f", 3, expectedTarget, "g", "Test262", expectedTarget]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/class-field-on-frozen-objects-strict.js b/js/src/tests/test262/language/statements/class/elements/class-field-on-frozen-objects-strict.js
new file mode 100644
index 0000000000..94a86d6694
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/class-field-on-frozen-objects-strict.js
@@ -0,0 +1,30 @@
+'use strict';
+// Copyright (C) 2019 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Public class field initialization fails on frozen object
+esid: sec-define-field
+info: |
+ DefineField(receiver, fieldRecord)
+ ...
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+features: [class, class-fields-public]
+flags: [onlyStrict]
+---*/
+
+class Test {
+ f = Object.freeze(this);
+ g = "Test262";
+}
+
+assert.throws(TypeError, function() {
+ new Test();
+}, "Frozen objects can't be changed");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/comp-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/comp-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..2b0b71942b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/comp-name-init-err-contains-arguments.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-comp-name.template
+/*---
+description: Syntax error if `arguments` used in class field (computed ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, computed-property-names]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+var x = "string";
+class C {
+ [x] = arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/comp-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/comp-name-init-err-contains-super.js
new file mode 100644
index 0000000000..84a2c49a34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/comp-name-init-err-contains-super.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-comp-name.template
+/*---
+description: Syntax error if `super()` used in class field (computed ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, computed-property-names]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+var x = "string";
+class C {
+ [x] = super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/computed-name-toprimitive-symbol.js b/js/src/tests/test262/language/statements/class/elements/computed-name-toprimitive-symbol.js
new file mode 100644
index 0000000000..ead50e26dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/computed-name-toprimitive-symbol.js
@@ -0,0 +1,123 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-name-toprimitive-symbol.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, Symbol.toPrimitive, Symbol, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of me is false, then
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+ ...
+
+ Runtime Semantics: ClassElementEvaluation
+
+ ClassElement: FieldDefinition;
+ Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
+
+ Runtime Semantics: ClassFieldDefinitionEvaluation
+ With parameters isStatic and homeObject.
+
+ 1. Let fieldName be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(fieldName).
+ ...
+
+ Runtime Semantics: Evaluation
+ ComputedPropertyName: [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+---*/
+var s1 = Symbol();
+var s2 = Symbol();
+var s3 = Symbol();
+var err = function() { throw new Test262Error(); };
+var obj1 = {
+ [Symbol.toPrimitive]: function() { return s1; },
+ toString: err,
+ valueOf: err
+};
+
+var obj2 = {
+ toString: function() { return s2; },
+ valueOf: err
+};
+
+var obj3 = {
+ toString: undefined,
+ valueOf: function() { return s3; }
+};
+
+
+
+class C {
+ [obj1] = 42;
+ [obj2] = 43;
+ [obj3] = 44;
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, s1),
+ "s1 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, s1),
+ "s1 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, s1, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, s2),
+ "s2 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, s2),
+ "s2 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, s2, {
+ value: 43,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, s3),
+ "s3 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, s3),
+ "s3 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, s3, {
+ value: 44,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/computed-name-toprimitive.js b/js/src/tests/test262/language/statements/class/elements/computed-name-toprimitive.js
new file mode 100644
index 0000000000..684907a32d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/computed-name-toprimitive.js
@@ -0,0 +1,120 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-name-toprimitive.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, Symbol.toPrimitive, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of me is false, then
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+ ...
+
+ Runtime Semantics: ClassElementEvaluation
+
+ ClassElement: FieldDefinition;
+ Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
+
+ Runtime Semantics: ClassFieldDefinitionEvaluation
+ With parameters isStatic and homeObject.
+
+ 1. Let fieldName be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(fieldName).
+ ...
+
+ Runtime Semantics: Evaluation
+ ComputedPropertyName: [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+---*/
+var err = function() { throw new Test262Error(); };
+var obj1 = {
+ [Symbol.toPrimitive]: function() { return "d"; },
+ toString: err,
+ valueOf: err
+};
+
+var obj2 = {
+ toString: function() { return "e"; },
+ valueOf: err
+};
+
+var obj3 = {
+ toString: undefined,
+ valueOf: function() { return "f"; }
+};
+
+
+
+class C {
+ [obj1] = 42;
+ [obj2] = 43;
+ [obj3] = 44;
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "e"),
+ "e doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "e"),
+ "e doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "e", {
+ value: 43,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "f"),
+ "f doesn't appear as an own property on C prototype"
+);
+assert(!
+ Object.prototype.hasOwnProperty.call(C, "f"),
+ "f doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "f", {
+ value: 44,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/computed-property-abrupt-completition.js b/js/src/tests/test262/language/statements/class/elements/computed-property-abrupt-completition.js
new file mode 100644
index 0000000000..c07ed35e8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/computed-property-abrupt-completition.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateFieldGet should return with abrupt completion
+esid: runtime-semantics-class-definition-evaluation
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ i. Let field be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let field be the result of performing PropertyDefinitionEvaluation for mClassElementEvaluation for e with arguments F and false.
+ c. If field is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(field).
+ ...
+features: [class-fields-public, class-static-fields-public, class]
+---*/
+
+function abruptCompletion() {
+ throw new Test262Error();
+}
+
+let neverExecuted = false;
+
+assert.throws(Test262Error, function() {
+ class C {
+ [abruptCompletion()];
+ [neverExecuted = true];
+ }
+}, 'computed property should have abrupt completion');
+assert.sameValue(neverExecuted, false);
+
+assert.throws(Test262Error, function() {
+ class C {
+ static [abruptCompletion()];
+ [neverExecuted = true];
+ }
+}, 'static computed property should have abrupt completion');
+assert.sameValue(neverExecuted, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/ctor-called-after-fields-init.js b/js/src/tests/test262/language/statements/class/elements/ctor-called-after-fields-init.js
new file mode 100644
index 0000000000..77e483856d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/ctor-called-after-fields-init.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/ctor-called-after-fields-init.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: The constructor method is called after the fields are initalized (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ [[Construct]] ( argumentsList, newTarget)
+
+ 8. If kind is "base", then
+ a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ ...
+ ...
+ 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ ...
+
+---*/
+var ctor;
+
+
+class C {
+ constructor() {
+ ctor = this.foo;
+ }
+ foo = 42;
+}
+
+var c = new C();
+
+assert.sameValue(ctor, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..ae4d849ba1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-contains-superproperty-1.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-eval.template
+/*---
+description: super.x in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super.x;');
+}
+
+new C();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..f070550b43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-contains-superproperty-2.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-eval.template
+/*---
+description: super['x'] in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super["x"];');
+}
+
+new C();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..3bee4474f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-eval.template
+/*---
+description: error if `super()['x']` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..ce07927be2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-eval.template
+/*---
+description: error if `super().x` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..cd2af53ae0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-direct-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-eval.template
+/*---
+description: error if `super()` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..27895ab1a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-contains-superproperty-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-indirect-eval.template
+/*---
+description: super.x in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super.x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..a6f86a2af5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-contains-superproperty-2.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-indirect-eval.template
+/*---
+description: super['x'] in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..6daeaa5d31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-indirect-eval.template
+/*---
+description: error if `super()['x']` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..ac275cc028
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-indirect-eval.template
+/*---
+description: error if `super().x` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..08f77e8118
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/derived-cls-indirect-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-indirect-eval.template
+/*---
+description: error if `super()` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/direct-eval-err-contains-arguments.js
new file mode 100644
index 0000000000..32ef0e5489
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/direct-eval-err-contains-arguments.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-arguments.case
+// - src/class-elements/initializer-direct-eval-arguments/cls-decl-fields-eval.template
+/*---
+description: error if `arguments` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if ContainsArguments of StatementList is true.
+ ...
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+var executed = false;
+class C {
+ x = eval('executed = true; arguments;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/direct-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..8097d57801
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/direct-eval-err-contains-newtarget.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-fields-eval.template
+/*---
+description: error if `new.target` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ x = eval('executed = true; new.target;');
+}
+
+var c = new C();
+
+assert.sameValue(executed, true);
+assert.sameValue(c.x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/equality-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/equality-init-err-contains-arguments.js
new file mode 100644
index 0000000000..7d88fd26f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/equality-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-equality.template
+/*---
+description: Syntax error if `arguments` used in class field (equality expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = {} == arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/equality-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/equality-init-err-contains-super.js
new file mode 100644
index 0000000000..5eba280e2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/equality-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-equality.template
+/*---
+description: Syntax error if `super()` used in class field (equality expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = {} == super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/evaluation-error/browser.js b/js/src/tests/test262/language/statements/class/elements/evaluation-error/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/evaluation-error/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-referenceerror.js b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-referenceerror.js
new file mode 100644
index 0000000000..4c59e16268
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-referenceerror.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-name-referenceerror.case
+// - src/class-elements/class-evaluation-error/cls-decl.template
+/*---
+description: ReferenceError evaluating a computed property name (field definitions in a class declaration)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of me is false, then
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+ ...
+
+ Runtime Semantics: ClassElementEvaluation
+
+ ClassElement: FieldDefinition;
+ Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
+
+ Runtime Semantics: ClassFieldDefinitionEvaluation
+ With parameters isStatic and homeObject.
+
+ 1. Let fieldName be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(fieldName).
+ ...
+
+ Runtime Semantics: Evaluation
+ ComputedPropertyName: [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+---*/
+function fn() {
+ throw new Test262Error();
+}
+
+
+
+function evaluate() {
+ class C {
+ [noRef] = fn();
+ }
+}
+
+assert.throws(ReferenceError, evaluate);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-err.js b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-err.js
new file mode 100644
index 0000000000..204d772fbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-name-toprimitive-err.case
+// - src/class-elements/class-evaluation-error/cls-decl.template
+/*---
+description: Custom error evaluating a computed property name (field definitions in a class declaration)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class-fields-public, computed-property-names, Symbol.toPrimitive, class]
+flags: [generated]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of me is false, then
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+ ...
+
+ Runtime Semantics: ClassElementEvaluation
+
+ ClassElement: FieldDefinition;
+ Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
+
+ Runtime Semantics: ClassFieldDefinitionEvaluation
+ With parameters isStatic and homeObject.
+
+ 1. Let fieldName be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(fieldName).
+ ...
+
+ Runtime Semantics: Evaluation
+ ComputedPropertyName: [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+---*/
+var obj = {
+ [Symbol.toPrimitive]: function() {
+ throw new Test262Error();
+ }
+};
+
+
+
+function evaluate() {
+ class C {
+ [obj]
+ }
+}
+
+assert.throws(Test262Error, evaluate);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-returns-noncallable.js b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-returns-noncallable.js
new file mode 100644
index 0000000000..f995fe93e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-returns-noncallable.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-name-toprimitive-returns-noncallable.case
+// - src/class-elements/class-evaluation-error/cls-decl.template
+/*---
+description: Custom error evaluating a computed property name (field definitions in a class declaration)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class-fields-public, computed-property-names, Symbol.toPrimitive, class]
+flags: [generated]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of me is false, then
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+ ...
+
+ Runtime Semantics: ClassElementEvaluation
+
+ ClassElement: FieldDefinition;
+ Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
+
+ Runtime Semantics: ClassFieldDefinitionEvaluation
+ With parameters isStatic and homeObject.
+
+ 1. Let fieldName be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(fieldName).
+ ...
+
+ Runtime Semantics: Evaluation
+ ComputedPropertyName: [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+---*/
+var obj = {
+ [Symbol.toPrimitive]: {}
+};
+
+
+
+function evaluate() {
+ class C {
+ [obj] = refErrorIfEvaluated;
+ }
+}
+
+assert.throws(TypeError
+, evaluate);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-returns-nonobject.js b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-returns-nonobject.js
new file mode 100644
index 0000000000..46d6d5f852
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-toprimitive-returns-nonobject.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-name-toprimitive-returns-nonobject.case
+// - src/class-elements/class-evaluation-error/cls-decl.template
+/*---
+description: Custom error evaluating a computed property name (field definitions in a class declaration)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class-fields-public, computed-property-names, Symbol.toPrimitive, class]
+flags: [generated]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of me is false, then
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+ ...
+
+ Runtime Semantics: ClassElementEvaluation
+
+ ClassElement: FieldDefinition;
+ Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
+
+ Runtime Semantics: ClassFieldDefinitionEvaluation
+ With parameters isStatic and homeObject.
+
+ 1. Let fieldName be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(fieldName).
+ ...
+
+ Runtime Semantics: Evaluation
+ ComputedPropertyName: [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+---*/
+var obj = {
+ [Symbol.toPrimitive]: 42
+};
+
+
+
+function evaluate() {
+ class C {
+ [obj] = refErrorIfEvaluated;
+ }
+}
+
+assert.throws(TypeError, evaluate);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-tostring-err.js b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-tostring-err.js
new file mode 100644
index 0000000000..3a43e1560d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-tostring-err.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-name-tostring-err.case
+// - src/class-elements/class-evaluation-error/cls-decl.template
+/*---
+description: Custom error evaluating a computed property name (field definitions in a class declaration)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of me is false, then
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+ ...
+
+ Runtime Semantics: ClassElementEvaluation
+
+ ClassElement: FieldDefinition;
+ Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
+
+ Runtime Semantics: ClassFieldDefinitionEvaluation
+ With parameters isStatic and homeObject.
+
+ 1. Let fieldName be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(fieldName).
+ ...
+
+ Runtime Semantics: Evaluation
+ ComputedPropertyName: [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+---*/
+var obj = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+
+
+function evaluate() {
+ class C {
+ [obj]
+ }
+}
+
+assert.throws(Test262Error
+, evaluate);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-valueof-err.js b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-valueof-err.js
new file mode 100644
index 0000000000..126a0e0a40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/evaluation-error/computed-name-valueof-err.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-name-valueof-err.case
+// - src/class-elements/class-evaluation-error/cls-decl.template
+/*---
+description: Custom error evaluating a computed property name (field definitions in a class declaration)
+esid: sec-runtime-semantics-classdefinitionevaluation
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of me is false, then
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+ ...
+
+ Runtime Semantics: ClassElementEvaluation
+
+ ClassElement: FieldDefinition;
+ Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
+
+ Runtime Semantics: ClassFieldDefinitionEvaluation
+ With parameters isStatic and homeObject.
+
+ 1. Let fieldName be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(fieldName).
+ ...
+
+ Runtime Semantics: Evaluation
+ ComputedPropertyName: [ AssignmentExpression ]
+
+ 1. Let exprValue be the result of evaluating AssignmentExpression.
+ 2. Let propName be ? GetValue(exprValue).
+ 3. Return ? ToPropertyKey(propName).
+
+---*/
+var obj = {
+ toString: undefined,
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+
+
+function evaluate() {
+ class C {
+ [obj]
+ }
+}
+
+assert.throws(Test262Error, evaluate);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/evaluation-error/shell.js b/js/src/tests/test262/language/statements/class/elements/evaluation-error/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/evaluation-error/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/field-declaration.js b/js/src/tests/test262/language/statements/class/elements/field-declaration.js
new file mode 100644
index 0000000000..b8c0fcc6c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/field-declaration.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/field-declaration.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Fields are defined (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+ StringLiteral
+ NumericLiteral
+
+ ClassDefinitionEvaluation:
+ ...
+
+ 26. Let instanceFields be a new empty List.
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ i. Let field be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. ...
+ c. ...
+ d. If field is not empty, append field to instanceFields.
+
+ ...
+
+ 30. Set F.[[Fields]] to instanceFields.
+ ...
+
+---*/
+var computed = 'h';
+
+
+class C {
+ f = 'test262';
+ 'g';
+ 0 = 'bar';
+ [computed];
+}
+
+let c = new C();
+
+assert.sameValue(C.f, undefined);
+assert.sameValue(C.g, undefined);
+assert.sameValue(C.h, undefined);
+assert.sameValue(C[0], undefined);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C, 'f'),
+ "f does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, 'g'),
+ "g does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, 'h'),
+ "h does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, 0),
+ "0 does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, 'f', {
+ value: 'test262',
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+verifyProperty(c, 'g', {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+verifyProperty(c, 0, {
+ value: 'bar',
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+verifyProperty(c, 'h', {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/field-definition-accessor-no-line-terminator.js b/js/src/tests/test262/language/statements/class/elements/field-definition-accessor-no-line-terminator.js
new file mode 100644
index 0000000000..bea195d730
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/field-definition-accessor-no-line-terminator.js
@@ -0,0 +1,52 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/class-elements/field-definition-accessor-no-line-terminator.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Valid accessor FieldDefinition, ClassElementName, PropertyName Syntax (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [decorators, class]
+flags: [generated]
+info: |
+ FieldDefinition[Yield, Await] :
+ accessor [no LineTerminator here] ClassElementName[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt
+
+---*/
+
+
+class C {
+ accessor
+ $;
+ static accessor
+ $;
+
+}
+
+let c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, 'accessor'),
+ "accessor doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, '$'),
+ "$ doesn't appear as an own property on C prototype"
+);
+assert(
+ Object.prototype.hasOwnProperty.call(C, 'accessor'),
+ "C constructor has an own property accessor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, '$'),
+ "$ doesn't appear as an own property on C constructor"
+);
+assert(
+ Object.prototype.hasOwnProperty.call(c, 'accessor'),
+ "C instance has an own property accessor"
+);
+assert(
+ Object.prototype.hasOwnProperty.call(c, '$'),
+ "C instance has an own property $"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fielddefinition-initializer-abrupt-completion.js b/js/src/tests/test262/language/statements/class/elements/fielddefinition-initializer-abrupt-completion.js
new file mode 100644
index 0000000000..a29b1d94c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fielddefinition-initializer-abrupt-completion.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Class construction should error if evaluation of field initializer errors
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+info: |
+ [[Construct]] ( argumentsList, newTarget)
+ ...
+ 8. If kind is "base", then
+ a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ c. If result is an abrupt completion, then
+ i. Remove calleeContext from execution context stack and restore callerContext as the running execution context.
+ ii. Return Completion(result).
+
+ InitializeInstanceFields ( O, constructor )
+ 1. Assert: Type ( O ) is Object.
+ 2. Assert: Assert constructor is an ECMAScript function object.
+ 3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
+ 4. For each item fieldRecord in order from fieldRecords,
+ a. If fieldRecord.[[static]] is false, then
+ i. Perform ? DefineField(O, fieldRecord).
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let fieldName be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a.Let initValue be ? Call(initializer, receiver).
+
+features: [class, class-fields-public]
+---*/
+
+function f() {
+ throw new Test262Error();
+}
+
+class C {
+ x = f();
+}
+
+assert.throws(Test262Error, function() {
+ new C();
+})
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-anonymous-function-length.js b/js/src/tests/test262/language/statements/class/elements/fields-anonymous-function-length.js
new file mode 100644
index 0000000000..38280bdfca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-anonymous-function-length.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/fields-anonymous-function-length.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Anonymous functions in field initializer have length properly set (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ InitializeInstanceFields ( O, constructor )
+ 1. Assert: Type ( O ) is Object.
+ 2. Assert: constructor is an ECMAScript function object.
+ 3. Let fields be the value of constructor.[[Fields]].
+ 4. For each item fieldRecord in order from fields,
+ a. Perform ? DefineField(O, fieldRecord).
+ 5. Return.
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let name be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a. Let initValue be ? Call(initializer, receiver).
+ ...
+
+---*/
+
+
+class C {
+ field = function() {};
+ #field = (a, b, c, d) => undefined;
+
+ accessPrivateField() {
+ return this.#field;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.accessPrivateField().length, 4);
+assert.sameValue(c.field.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-asi-1.js b/js/src/tests/test262/language/statements/class/elements/fields-asi-1.js
new file mode 100644
index 0000000000..440e30d93f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-asi-1.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: ASI test in field declarations -- computed name interpreted as property
+esid: sec-automatic-semicolon-insertion
+features: [class, class-fields-public]
+---*/
+
+var obj = {}
+class C {
+ x = obj
+ ['lol'] = 42
+}
+
+var c = new C();
+
+assert.sameValue(c.x, 42);
+assert.sameValue(obj['lol'], 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-asi-2.js b/js/src/tests/test262/language/statements/class/elements/fields-asi-2.js
new file mode 100644
index 0000000000..e7b2ce6a5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-asi-2.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: ASI test in field declarations -- computed name interpreted as string index
+esid: sec-automatic-semicolon-insertion
+features: [class, class-fields-public]
+---*/
+
+class C {
+ x = "lol"
+ [1]
+}
+
+var c = new C();
+
+assert.sameValue(c.x, 'o');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-asi-3.js b/js/src/tests/test262/language/statements/class/elements/fields-asi-3.js
new file mode 100644
index 0000000000..8bced9d0ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-asi-3.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: ASI test in field declarations -- error when computed name interpreted as index
+esid: sec-automatic-semicolon-insertion
+features: [class, class-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = "string"
+ [0]() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-asi-4.js b/js/src/tests/test262/language/statements/class/elements/fields-asi-4.js
new file mode 100644
index 0000000000..b22cb71831
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-asi-4.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: ASI test in field declarations -- error when generator interpreted as multiplication
+esid: sec-automatic-semicolon-insertion
+features: [class, class-fields-public, generators]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = 42
+ *gen() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-asi-5.js b/js/src/tests/test262/language/statements/class/elements/fields-asi-5.js
new file mode 100644
index 0000000000..55ab32690f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-asi-5.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: ASI test in field declarations -- field with PropertyName "in" interpreted as index
+esid: sec-automatic-semicolon-insertion
+features: [class, class-fields-public]
+---*/
+
+var x = 0;
+var y = 1;
+var z = [42];
+
+class C {
+ a = x
+ in
+ z
+ b = y
+ in
+ z
+}
+
+var c = new C();
+
+assert.sameValue(c.a, true, 'a = x in z');
+assert.sameValue(c.b, false, 'b = y in z');
+assert(!Object.prototype.hasOwnProperty.call(c, "in"), "'in' is not parsed as a field declaration");
+assert(!Object.prototype.hasOwnProperty.call(c, "z"), "'z' is not parsed as a field declaration");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-asi-same-line-1.js b/js/src/tests/test262/language/statements/class/elements/fields-asi-same-line-1.js
new file mode 100644
index 0000000000..f1badcbafb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-asi-same-line-1.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Jason Orendorff. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: ASI test in field declarations -- error when method on same line
+esid: sec-automatic-semicolon-insertion
+features: [class, class-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ field /* no ASI here */ method(){}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-asi-same-line-2.js b/js/src/tests/test262/language/statements/class/elements/fields-asi-same-line-2.js
new file mode 100644
index 0000000000..8ee4caebd9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-asi-same-line-2.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Jason Orendorff. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: ASI test in field declarations -- error when method on same line after initializer
+esid: sec-automatic-semicolon-insertion
+features: [class, class-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ field = 1 /* no ASI here */ method(){}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-computed-name-propname-constructor.js b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-propname-constructor.js
new file mode 100644
index 0000000000..2eef946b50
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-propname-constructor.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: class fields forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+info: |
+ Static Semantics: PropName
+ ...
+ ComputedPropertyName : [ AssignmentExpression ]
+ Return empty.
+
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : FieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "constructor".
+
+ DefineField(receiver, fieldRecord)
+
+ ...
+ 8. If fieldName is a Private Name,
+ ...
+ 9. Else,
+ a. ...
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+
+ CreateDataPropertyOrThrow ( O, P, V )
+
+ ...
+ 3. Let success be ? CreateDataProperty(O, P, V).
+ 4. If success is false, throw a TypeError exception.
+ ...
+
+ CreateDataProperty ( O, P, V )
+
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true,
+ [[Configurable]]: true }.
+ 4. Return ? O.[[DefineOwnProperty]](P, newDesc).
+---*/
+
+var x = "constructor";
+class C1 {
+ [x];
+}
+
+var c1 = new C1();
+
+assert.sameValue(c1.hasOwnProperty("constructor"), true);
+assert.sameValue(C1.hasOwnProperty("constructor"), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-computed-var-propname-constructor.js b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-computed-var-propname-constructor.js
new file mode 100644
index 0000000000..585dbac7de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-computed-var-propname-constructor.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2017 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: static class fields forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-static-fields-public]
+info: |
+ Static Semantics: PropName
+ ...
+ ComputedPropertyName : [ AssignmentExpression ]
+ Return empty.
+
+ This test file tests the following early error is only valid for a matching PropName:
+
+ Static Semantics: Early Errors
+
+ ClassElement : static FieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
+
+ -- IDK what is calling InitializeClassElements but I guess it's supposed to be called to
+ -- set the fields
+
+ InitializeClassElements(F, proto)
+
+ ...
+ 6. For each item element in order from elements,
+ a. If element.[[Kind]] is "field" and element.[[Placement]] is "static" or "prototype",
+ ...
+ ii. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto.
+ iii. Perform ? DefineClassElement(receiver, element).
+
+ -- DefineClassElement is probably DefineField in the class fields proposal
+
+ DefineField(receiver, fieldRecord)
+
+ ...
+ 8. If fieldName is a Private Name,
+ ...
+ 9. Else,
+ a. ...
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+
+ CreateDataPropertyOrThrow ( O, P, V )
+
+ ...
+ 3. Let success be ? CreateDataProperty(O, P, V).
+ 4. If success is false, throw a TypeError exception.
+ ...
+
+ CreateDataProperty ( O, P, V )
+
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true,
+ [[Configurable]]: true }.
+ 4. Return ? O.[[DefineOwnProperty]](P, newDesc).
+includes: [propertyHelper.js]
+---*/
+
+var x = 'constructor';
+class C1 {
+ static [x];
+}
+
+verifyProperty(C1, 'constructor', {
+ value: undefined,
+ configurable: true,
+ writable: true,
+ enumerable: true,
+});
+
+class C2 {
+ static [x] = 42;
+}
+
+verifyProperty(C2, 'constructor', {
+ value: 42,
+ configurable: true,
+ writable: true,
+ enumerable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-computed-var-propname-prototype.js b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-computed-var-propname-prototype.js
new file mode 100644
index 0000000000..7f4c43c8d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-computed-var-propname-prototype.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: static class fields forbid PropName 'prototype' (no early error -- PropName of ComputedPropertyName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-static-fields-public]
+info: |
+ 14.6.13 Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 16. Perform MakeConstructor(F, false, proto).
+ ...
+
+ 9.2.10 MakeConstructor ( F [ , writablePrototype [ , prototype ] ] )
+
+ 6. Perform ! DefinePropertyOrThrow(F, "prototype", PropertyDescriptor { [[Value]]: prototype,
+ [[Writable]]: writablePrototype, [[Enumerable]]: false, [[Configurable]]: false }).
+---*/
+
+var x = "prototype";
+
+assert.throws(TypeError, function() {
+ class C {
+ static [x] = 42;
+ }
+});
+
+assert.throws(TypeError, function() {
+ class C {
+ static [x];
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-propname-constructor.js b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-propname-constructor.js
new file mode 100644
index 0000000000..b8bf0f8826
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-propname-constructor.js
@@ -0,0 +1,81 @@
+// Copyright (C) 2017 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: static class fields forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-static-fields-public]
+info: |
+ Static Semantics: PropName
+ ...
+ ComputedPropertyName : [ AssignmentExpression ]
+ Return empty.
+
+ This test file tests the following early error is only valid for a matching PropName:
+
+ Static Semantics: Early Errors
+
+ ClassElement : static FieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
+
+ -- IDK what is calling InitializeClassElements but I guess it's supposed to be called to
+ -- set the fields
+
+ InitializeClassElements(F, proto)
+
+ ...
+ 6. For each item element in order from elements,
+ a. If element.[[Kind]] is "field" and element.[[Placement]] is "static" or "prototype",
+ ...
+ ii. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto.
+ iii. Perform ? DefineClassElement(receiver, element).
+
+ -- DefineClassElement is probably DefineField in the class fields proposal
+
+ DefineField(receiver, fieldRecord)
+
+ ...
+ 8. If fieldName is a Private Name,
+ ...
+ 9. Else,
+ a. ...
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+
+ CreateDataPropertyOrThrow ( O, P, V )
+
+ ...
+ 3. Let success be ? CreateDataProperty(O, P, V).
+ 4. If success is false, throw a TypeError exception.
+ ...
+
+ CreateDataProperty ( O, P, V )
+
+ ...
+ 3. Let newDesc be the PropertyDescriptor { [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true,
+ [[Configurable]]: true }.
+ 4. Return ? O.[[DefineOwnProperty]](P, newDesc).
+includes: [propertyHelper.js]
+---*/
+
+class C1 {
+ static ['constructor'];
+}
+
+verifyProperty(C1, 'constructor', {
+ value: undefined,
+ configurable: true,
+ writable: true,
+ enumerable: true,
+});
+
+class C2 {
+ static ['constructor'] = 42;
+}
+
+verifyProperty(C2, 'constructor', {
+ value: 42,
+ configurable: true,
+ writable: true,
+ enumerable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-propname-prototype.js b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-propname-prototype.js
new file mode 100644
index 0000000000..5fba6d2d6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-computed-name-static-propname-prototype.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: static class fields forbid PropName 'prototype' (no early error -- PropName of ComputedPropertyName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-static-fields-public]
+info: |
+ 14.6.13 Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 16. Perform MakeConstructor(F, false, proto).
+ ...
+
+ 9.2.10 MakeConstructor ( F [ , writablePrototype [ , prototype ] ] )
+
+ 6. Perform ! DefinePropertyOrThrow(F, "prototype", PropertyDescriptor { [[Value]]: prototype,
+ [[Writable]]: writablePrototype, [[Enumerable]]: false, [[Configurable]]: false }).
+---*/
+
+assert.throws(TypeError, function() {
+ class C {
+ static ['prototype'] = 42;
+ }
+});
+
+assert.throws(TypeError, function() {
+ class C {
+ static ['prototype'];
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-duplicate-privatenames.js b/js/src/tests/test262/language/statements/class/elements/fields-duplicate-privatenames.js
new file mode 100644
index 0000000000..da13cf7b43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-duplicate-privatenames.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Syntax error if the same private field defined twice
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries.
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ #x;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-hash-constructor-is-a-valid-name.js b/js/src/tests/test262/language/statements/class/elements/fields-hash-constructor-is-a-valid-name.js
new file mode 100644
index 0000000000..0372cfa317
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-hash-constructor-is-a-valid-name.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2018 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: "#constructor is a valid property name for a public field"
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+info: |
+ ClassElementName : PrivateName;
+
+ It is a Syntax Error if StringValue of PrivateName is "#constructor".
+includes: [propertyHelper.js]
+---*/
+
+class C1 {
+ ["#constructor"];
+}
+
+var c1 = new C1();
+
+assert.sameValue(Object.prototype.hasOwnProperty.call(C1, '#constructor'), false);
+verifyProperty(c1, '#constructor', {
+ value: undefined,
+ configurable: true,
+ enumerable: true,
+ writable: true,
+});
+
+class C2 {
+ ["#constructor"] = 42;
+}
+
+var c2 = new C2();
+
+assert.sameValue(Object.prototype.hasOwnProperty.call(C2, '#constructor'), false);
+verifyProperty(c2, '#constructor', {
+ value: 42,
+ configurable: true,
+ enumerable: true,
+ writable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-literal-name-propname-constructor.js b/js/src/tests/test262/language/statements/class/elements/fields-literal-name-propname-constructor.js
new file mode 100644
index 0000000000..3bb17a4524
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-literal-name-propname-constructor.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: class fields forbid PropName 'constructor' (early error -- PropName of IdentifierName is forbidden value)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: PropName
+ LiteralPropertyName : IdentifierName
+ Return StringValue of IdentifierName.
+
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : FieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "constructor".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ constructor;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-literal-name-static-propname-constructor.js b/js/src/tests/test262/language/statements/class/elements/fields-literal-name-static-propname-constructor.js
new file mode 100644
index 0000000000..27b3ed35d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-literal-name-static-propname-constructor.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: static class field forbid PropName 'constructor' (early error -- PropName of IdentifierName is forbidden value)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-static-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: PropName
+ LiteralPropertyName : IdentifierName
+ Return StringValue of IdentifierName.
+
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : staticFieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static constructor;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-literal-name-static-propname-prototype.js b/js/src/tests/test262/language/statements/class/elements/fields-literal-name-static-propname-prototype.js
new file mode 100644
index 0000000000..032744bc63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-literal-name-static-propname-prototype.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: static class fields forbid PropName 'prototype' (early error -- PropName of IdentifierName is forbidden value)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-static-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: PropName
+ LiteralPropertyName : IdentifierName
+ Return StringValue of IdentifierName.
+
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : staticFieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static prototype;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-string-name-propname-constructor.js b/js/src/tests/test262/language/statements/class/elements/fields-string-name-propname-constructor.js
new file mode 100644
index 0000000000..f81ce20424
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-string-name-propname-constructor.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: class fields forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden value)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: PropName
+ ...
+ LiteralPropertyName : StringLiteral
+ Return the String value whose code units are the SV of the StringLiteral.
+
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : FieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "constructor".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ 'constructor';
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-string-name-static-propname-constructor.js b/js/src/tests/test262/language/statements/class/elements/fields-string-name-static-propname-constructor.js
new file mode 100644
index 0000000000..fe1a8bdbd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-string-name-static-propname-constructor.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: static class field forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden value)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-static-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: PropName
+ ...
+ LiteralPropertyName : StringLiteral
+ Return the String value whose code units are the SV of the StringLiteral.
+
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : staticFieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static 'constructor';
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/fields-string-name-static-propname-prototype.js b/js/src/tests/test262/language/statements/class/elements/fields-string-name-static-propname-prototype.js
new file mode 100644
index 0000000000..3a8b62d3c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/fields-string-name-static-propname-prototype.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: static class fields forbid PropName 'prototype' (early error -- PropName of StringLiteral is forbidden value)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-static-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: PropName
+ ...
+ LiteralPropertyName : StringLiteral
+ Return the String value whose code units are the SV of the StringLiteral.
+
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : staticFieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static 'prototype';
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/browser.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/shell.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..0e43f77456
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier-escaped.case
+// - src/generators/syntax/class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *#gen() {
+ var yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..b33a4d456b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-binding-identifier.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier.case
+// - src/generators/syntax/class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *#gen() {
+ var yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..04677528e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference-escaped.case
+// - src/generators/syntax/class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *#gen() {
+ void yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..be6cfcd5bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-identifier-reference.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference.case
+// - src/generators/syntax/class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *#gen() {
+ void yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..5dcb4df908
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-label-identifier-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier-escaped.case
+// - src/generators/syntax/class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *#gen() {
+ yi\u0065ld: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-label-identifier.js
new file mode 100644
index 0000000000..4371c8dba0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-as-label-identifier.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier.case
+// - src/generators/syntax/class-decl-static-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-static-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *#gen() {
+ yield: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..258b126d5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,75 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-spread-strict.case
+// - src/generators/default/class-decl-static-private-method.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Static generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [object-spread, generators, class-static-methods-private]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+class C {
+ static *#gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..38bd773506
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-identifier-strict-strict.js
@@ -0,0 +1,66 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-strict.case
+// - src/generators/default/class-decl-static-private-method.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Static generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [generators, class-static-methods-private]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+class C {
+ static *#gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..c1ba1a5916
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-multiple.case
+// - src/generators/default/class-decl-static-private-method.template
+/*---
+description: Use yield value in a array spread position (Static generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [generators, class-static-methods-private]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+var callCount = 0;
+
+class C {
+ static *#gen() {
+ callCount += 1;
+ yield [...yield yield];
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+item = iter.next(item.value);
+
+assert.compareArray(item.value, arr);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-arr-single.js
new file mode 100644
index 0000000000..06b50e2a37
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-arr-single.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-single.case
+// - src/generators/default/class-decl-static-private-method.template
+/*---
+description: Use yield value in a array spread position (Static generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [generators, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+---*/
+var arr = ['a', 'b', 'c'];
+
+var callCount = 0;
+
+class C {
+ static *#gen() {
+ callCount += 1;
+ yield [...yield];
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next(false);
+var item = iter.next(arr);
+var value = item.value;
+
+assert.notSameValue(value, arr, 'value is a new array');
+assert(Array.isArray(value), 'value is an Array exotic object');
+assert.sameValue(value.length, 3)
+assert.sameValue(value[0], 'a');
+assert.sameValue(value[1], 'b');
+assert.sameValue(value[2], 'c');
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-obj.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-obj.js
new file mode 100644
index 0000000000..a98fdf4aad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method-static/yield-spread-obj.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-obj.case
+// - src/generators/default/class-decl-static-private-method.template
+/*---
+description: Use yield value in a object spread position (Static generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [object-spread, generators, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ static PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+var callCount = 0;
+
+class C {
+ static *#gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+ }
+ static get gen() { return this.#gen; }
+}
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+
+var iter = C.gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+assert.sameValue(item.value.x, 42);
+assert.sameValue(item.value.y, 39);
+assert.sameValue(Object.keys(item.value).length, 2);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/browser.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/shell.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..385e2b978c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier-escaped.case
+// - src/generators/syntax/class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *#gen() {
+ var yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..22dbaab59b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-binding-identifier.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier.case
+// - src/generators/syntax/class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *#gen() {
+ var yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..2795745d2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference-escaped.case
+// - src/generators/syntax/class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *#gen() {
+ void yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..b67e9655e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-identifier-reference.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference.case
+// - src/generators/syntax/class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *#gen() {
+ void yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..c08efad0c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-label-identifier-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier-escaped.case
+// - src/generators/syntax/class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *#gen() {
+ yi\u0065ld: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-label-identifier.js
new file mode 100644
index 0000000000..3137bbb7dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-as-label-identifier.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier.case
+// - src/generators/syntax/class-decl-private-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators, class-methods-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * # PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *#gen() {
+ yield: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..d8ec3056cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,85 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-spread-strict.case
+// - src/generators/default/class-decl-private-method.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [object-spread, generators, class-methods-private]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+class C {
+ *#gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..0d4ecfecc4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-identifier-strict-strict.js
@@ -0,0 +1,76 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-strict.case
+// - src/generators/default/class-decl-private-method.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [generators, class-methods-private]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+class C {
+ *#gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..5f066c3b1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-multiple.case
+// - src/generators/default/class-decl-private-method.template
+/*---
+description: Use yield value in a array spread position (Generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [generators, class-methods-private]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+var callCount = 0;
+
+class C {
+ *#gen() {
+ callCount += 1;
+ yield [...yield yield];
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+item = iter.next(item.value);
+
+assert.compareArray(item.value, arr);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-arr-single.js
new file mode 100644
index 0000000000..e683264094
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-arr-single.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-single.case
+// - src/generators/default/class-decl-private-method.template
+/*---
+description: Use yield value in a array spread position (Generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [generators, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+---*/
+var arr = ['a', 'b', 'c'];
+
+var callCount = 0;
+
+class C {
+ *#gen() {
+ callCount += 1;
+ yield [...yield];
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next(false);
+var item = iter.next(arr);
+var value = item.value;
+
+assert.notSameValue(value, arr, 'value is a new array');
+assert(Array.isArray(value), 'value is an Array exotic object');
+assert.sameValue(value.length, 3)
+assert.sameValue(value[0], 'a');
+assert.sameValue(value[1], 'b');
+assert.sameValue(value[2], 'c');
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-obj.js b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-obj.js
new file mode 100644
index 0000000000..cf3eb131fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/gen-private-method/yield-spread-obj.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-obj.case
+// - src/generators/default/class-decl-private-method.template
+/*---
+description: Use yield value in a object spread position (Generator private method as a ClassDeclaration element)
+esid: prod-GeneratorPrivateMethod
+features: [object-spread, generators, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ PrivateMethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+var callCount = 0;
+
+class C {
+ *#gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+ }
+ get gen() { return this.#gen; }
+}
+
+const c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
+
+var iter = c.gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+assert.sameValue(item.value.x, 42);
+assert.sameValue(item.value.y, 39);
+assert.sameValue(Object.keys(item.value).length, 2);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+// Test the private fields do not appear as properties after set to value
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"),
+ "Private field '#gen' does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "#gen"),
+ "Private field '#gen' does not appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "#gen"),
+ "Private field '#gen' does not appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/get-access-of-missing-private-getter.js b/js/src/tests/test262/language/statements/class/elements/get-access-of-missing-private-getter.js
new file mode 100644
index 0000000000..900bb55fe0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/get-access-of-missing-private-getter.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Trying to get a private member without getter throws TypeError
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet ( P, O )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+features: [class-methods-private, class]
+---*/
+
+class C {
+ set #f(v) {
+ throw new Test262Error();
+ }
+
+ getAccess() {
+ return this.#f;
+ }
+}
+
+let c = new C();
+assert.throws(TypeError, function() {
+ c.getAccess();
+}, 'get operation on private accessor without getter should throw TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/get-access-of-missing-private-static-getter.js b/js/src/tests/test262/language/statements/class/elements/get-access-of-missing-private-static-getter.js
new file mode 100644
index 0000000000..9958b1e474
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/get-access-of-missing-private-static-getter.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Trying to get a private member without getter throws TypeError
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet ( P, O )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+features: [class-static-methods-private, class]
+---*/
+
+class C {
+ static set #f(v) {
+ throw new Test262Error();
+ }
+
+ static getAccess() {
+ return this.#f;
+ }
+}
+
+assert.throws(TypeError, function() {
+ C.getAccess();
+}, 'get operation on private accessor without getter should throw TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/get-access-of-missing-shadowed-private-getter.js b/js/src/tests/test262/language/statements/class/elements/get-access-of-missing-shadowed-private-getter.js
new file mode 100644
index 0000000000..c35e339eef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/get-access-of-missing-shadowed-private-getter.js
@@ -0,0 +1,91 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Trying to get from PrivateName without [[Get]] throws TypeError
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+class A {
+ get #f() {
+ throw new Test262Error();
+ }
+}
+
+class C extends A {
+ set #f(v) {
+ throw new Test262Error();
+ }
+
+ getAccess() {
+ return this.#f;
+ }
+}
+
+let c = new C();
+assert.throws(TypeError, function() {
+ c.getAccess();
+}, 'subclass private accessor should shadow super class private accessor');
+
+class B {
+ get #f() {
+ throw new Test262Error();
+ }
+
+ Inner = class {
+ set #f(v) {
+ throw new Test262Error();
+ }
+
+ getAccess() {
+ return this.#f;
+ }
+ }
+}
+
+let b = new B();
+let innerB = new b.Inner();
+assert.throws(TypeError, function() {
+ innerB.getAccess();
+}, 'inner class private accessor should shadow outer class private accessor');
+
+class D {
+ set #f(v) {
+ throw new Test262Error();
+ }
+
+ Inner = class {
+ get #f() {
+ throw new Test262Error();
+ }
+ }
+
+ getAccess() {
+ return this.#f;
+ }
+}
+
+let d = new D();
+assert.throws(TypeError, function() {
+ d.getAccess();
+}, 'inner class private accessor should not be visible to outer class private accessor');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/grammar-private-field-optional-chaining.js b/js/src/tests/test262/language/statements/class/elements/grammar-private-field-optional-chaining.js
new file mode 100644
index 0000000000..d0c3fc7cbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/grammar-private-field-optional-chaining.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-private-field-optional-chaining.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName after '?.' is valid syntax (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, optional-chaining, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ OptionalChain[Yield, Await]:
+ `?.` `[` Expression[+In, ?Yield, ?Await] `]`
+ `?.` IdentifierName
+ `?.` Arguments[?Yield, ?Await]
+ `?.` TemplateLiteral[?Yield, ?Await, +Tagged]
+ `?.` PrivateIdentifier
+
+---*/
+
+
+class C {
+ #m = 'test262';
+
+ static access(obj) {
+ return obj?.#m;
+ }
+}
+
+let c = new C();
+
+assert.sameValue(C.access(c), 'test262');
+
+assert.sameValue(C.access(null), undefined);
+assert.sameValue(C.access(undefined), undefined);
+
+assert.throws(TypeError, function() {
+ C.access({});
+}, 'accessed private field from an ordinary object');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/indirect-eval-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/indirect-eval-contains-arguments.js
new file mode 100644
index 0000000000..5223d5dd2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/indirect-eval-contains-arguments.js
@@ -0,0 +1,23 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-arguments.case
+// - src/class-elements/initializer-indirect-eval-arguments/cls-decl-fields-indirect-eval.template
+/*---
+description: No error if `arguments` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated, noStrict]
+info: |
+ For indirect eval, the "Additional Early Error Rules for Eval Inside Initializer"
+ (in #sec-performeval-rules-in-initializer) are NOT applicable.
+
+---*/
+
+
+var arguments = 1;
+class C {
+ x = (0, eval)('arguments;');
+}
+
+assert.sameValue(new C().x, arguments);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/indirect-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..23dfc171bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/indirect-eval-err-contains-newtarget.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-fields-indirect-eval.template
+/*---
+description: error if `new.target` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ x = (0, eval)('executed = true; new.target;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/init-err-evaluation.js b/js/src/tests/test262/language/statements/class/elements/init-err-evaluation.js
new file mode 100644
index 0000000000..d661a37ab6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/init-err-evaluation.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-evaluation.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Return abrupt completion evaluating the field initializer (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ [[Construct]] ( argumentsList, newTarget)
+
+ 8. If kind is "base", then
+ a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ ...
+ ...
+ 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ ...
+
+---*/
+var x = 0;
+function fn1() { x += 1; }
+function fn2() { throw new Test262Error(); }
+
+
+class C {
+ x = fn1();
+ y = fn2();
+ z = fn1();
+}
+
+assert.throws(Test262Error, function() {
+ new C();
+});
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/init-value-defined-after-class.js b/js/src/tests/test262/language/statements/class/elements/init-value-defined-after-class.js
new file mode 100644
index 0000000000..d5e0029d15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/init-value-defined-after-class.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-value-defined-after-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: The initializer value is defined after the class evaluation (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ [[Construct]] ( argumentsList, newTarget)
+
+ 8. If kind is "base", then
+ a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ ...
+ ...
+ 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ ...
+
+---*/
+var x = false;
+
+
+class C {
+ [x] = x;
+}
+
+var c1 = new C();
+
+x = true;
+var c2 = new C();
+
+verifyProperty(c1, "false", {
+ value: false,
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+verifyProperty(c2, "false", {
+ value: true,
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c1.hasOwnProperty("true"), false);
+assert.sameValue(c2.hasOwnProperty("true"), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/init-value-incremental.js b/js/src/tests/test262/language/statements/class/elements/init-value-incremental.js
new file mode 100644
index 0000000000..6fd18c1f7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/init-value-incremental.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-value-incremental.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: The initializer value is defined during the class instatiation (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ 27. For each ClassElement e in order from elements
+ ...
+ d. Append to fieldRecords the elements of fields.
+ ...
+ 33. Let result be InitializeStaticFields(F).
+ ...
+
+ [[Construct]] ( argumentsList, newTarget)
+
+ 8. If kind is "base", then
+ a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ ...
+ ...
+ 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ ...
+
+---*/
+var x = 1;
+
+
+class C {
+ [x++] = x++;
+ [x++] = x++;
+}
+
+var c1 = new C();
+var c2 = new C();
+
+verifyProperty(c1, "1", {
+ value: 3,
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+verifyProperty(c1, "2", {
+ value: 4,
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+verifyProperty(c2, "1", {
+ value: 5,
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+verifyProperty(c2, "2", {
+ value: 6,
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/intercalated-static-non-static-computed-fields.js b/js/src/tests/test262/language/statements/class/elements/intercalated-static-non-static-computed-fields.js
new file mode 100644
index 0000000000..5cd4ef79f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/intercalated-static-non-static-computed-fields.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/intercalated-static-non-static-computed-fields.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Computed class fields are executed in the order they are delcared, regardless it is static or instance field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-public, class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ i. Let field be the result of performing ClassElementEvaluation for e with arguments proto and false.
+ b. Else,
+ i. Let field be the result of performing PropertyDefinitionEvaluation for mClassElementEvaluation for e with arguments F and false.
+ c. If field is an abrupt completion, then
+ ...
+ d. If field is not empty,
+ i. If IsStatic of e is false, append field to instanceFields.
+ ii. Otherwise, append field to staticFields.
+ ...
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+ ...
+
+ [[Construct]] (argumentsList, newTarget)
+ ...
+ 8. If kind is "base", then
+ a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ c. If result is an abrupt completion, then
+ i. Remove calleeContext from execution context stack and restore callerContext as the running execution context.
+ ii. Return Completion(result).
+
+---*/
+
+let i = 0;
+
+
+class C {
+ [i++] = i++;
+ static [i++] = i++;
+ [i++] = i++;
+}
+
+let c = new C();
+
+// It is important to notice that static field initializer will run before any instance initializer
+verifyProperty(c, "0", {
+ value: 4,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+verifyProperty(c, "2", {
+ value: 5,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+verifyProperty(C, "1", {
+ value: 3,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(i, 6);
+assert.sameValue(c.hasOwnProperty('1'), false);
+assert.sameValue(C.hasOwnProperty('0'), false);
+assert.sameValue(C.hasOwnProperty('2'), false);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/literal-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..39a2bd81fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/literal-name-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-literal-name.template
+/*---
+description: Syntax error if `arguments` used in class field (literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/literal-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/literal-name-init-err-contains-super.js
new file mode 100644
index 0000000000..a44c5fbb79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/literal-name-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-literal-name.template
+/*---
+description: Syntax error if `super()` used in class field (literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-computed-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-computed-names.js
new file mode 100644
index 0000000000..860928b3e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-computed-names.js
@@ -0,0 +1,158 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Computed property names (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ [x] = 42; [10] = "meep"; ["not initialized"]
+ m2() { return 39 }
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-computed-symbol-names.js
new file mode 100644
index 0000000000..fe31aada9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-computed-symbol-names.js
@@ -0,0 +1,156 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Computed property symbol names (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ [x]; [y] = 42
+ m2() { return 39 }
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..d014f636f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,160 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: PrivateName Static Semantics, StringValue (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;
+ m2() { return 39 }
+ bar = "barbaz";
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-literal-names-asi.js
new file mode 100644
index 0000000000..8ed80fdd78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-literal-names-asi.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Literal property names with ASI (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ a
+ b = 42;
+ m2() { return 39 }
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-literal-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-literal-names.js
new file mode 100644
index 0000000000..052d34112d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-literal-names.js
@@ -0,0 +1,147 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Literal property names (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ a; b = 42;
+ c = fn
+ m2() { return 39 }
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-field-usage.js
new file mode 100644
index 0000000000..66093b3c15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-field-usage.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: PrivateName CallExpression usage (private field) (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #m = 'test262';
+ m2() { return 39 }
+ bar = "barbaz";
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-method-getter-usage.js
new file mode 100644
index 0000000000..b750b761cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-method-getter-usage.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ get #m() { return 'test262'; }
+ m2() { return 39 }
+ bar = "barbaz";
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-method-usage.js
new file mode 100644
index 0000000000..b4818b335d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-method-usage.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: PrivateName CallExpression usage (private method) (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #m() { return 'test262'; }
+ m2() { return 39 }
+ bar = "barbaz";
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-names.js
new file mode 100644
index 0000000000..a369a26e8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-private-names.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: private names (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #x; #y
+ m2() { return 39 }
+ bar = "barbaz";
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..6cb971c04a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-field-identifier-initializer.js
@@ -0,0 +1,138 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid FieldDefinition (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1
+ m2() { return 39 }
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-field-identifier.js
new file mode 100644
index 0000000000..a239133820
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-field-identifier.js
@@ -0,0 +1,145 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid FieldDefinition (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J
+ m2() { return 39 }
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-getter-alt.js
new file mode 100644
index 0000000000..3a346bad69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-getter-alt.js
@@ -0,0 +1,179 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName as private getter (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+
+ m2() { return 39 }
+ bar = "barbaz";
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-getter.js
new file mode 100644
index 0000000000..7825d5d35d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-getter.js
@@ -0,0 +1,179 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName as private getter (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+
+ m2() { return 39 }
+ bar = "barbaz";
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-method-alt.js
new file mode 100644
index 0000000000..424a19e2e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-method-alt.js
@@ -0,0 +1,178 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName as private method (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+
+ m2() { return 39 }
+ bar = "barbaz";
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-method.js
new file mode 100644
index 0000000000..e956a4dc94
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-method.js
@@ -0,0 +1,178 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName as private method (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+
+ m2() { return 39 }
+ bar = "barbaz";
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-setter-alt.js
new file mode 100644
index 0000000000..ec5b69c42d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-setter-alt.js
@@ -0,0 +1,178 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName as private setter (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+
+ m2() { return 39 }
+ bar = "barbaz";
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-setter.js
new file mode 100644
index 0000000000..7d8736bd41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-private-setter.js
@@ -0,0 +1,178 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName as private setter (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+
+ m2() { return 39 }
+ bar = "barbaz";
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..62f2d55a44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-alt.js
@@ -0,0 +1,160 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J
+ m2() { return 39 }
+ bar = "barbaz";
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..984a087064
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,154 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1
+ m2() { return 39 }
+ bar = "barbaz";
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..ae13ceac12
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier-initializer.js
@@ -0,0 +1,154 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1
+ m2() { return 39 }
+ bar = "barbaz";
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier.js
new file mode 100644
index 0000000000..745f56f68d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-privatename-identifier.js
@@ -0,0 +1,160 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J
+ m2() { return 39 }
+ bar = "barbaz";
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..aa20ede391
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,185 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ }
+ m2() { return 39 }
+ bar = "barbaz";
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..b627bf9127
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,186 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ }
+ m2() { return 39 }
+ bar = "barbaz";
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..ac5f408b1b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,185 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static AsyncMethod PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ }
+ m2() { return 39 }
+ bar = "barbaz";
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..32a004095c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,186 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static AsyncMethod PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ }
+ m2() { return 39 }
+ bar = "barbaz";
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..95ebc4013d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,175 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ }
+ m2() { return 39 }
+ bar = "barbaz";
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..4829fb1886
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,176 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ }
+ m2() { return 39 }
+ bar = "barbaz";
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..81d12a9690
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,173 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static Method PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ }
+ m2() { return 39 }
+ bar = "barbaz";
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..9605b7ee9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js
@@ -0,0 +1,173 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static Method PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ }
+ m2() { return 39 }
+ bar = "barbaz";
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..86ab6e2259
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,161 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J
+ m2() { return 39 }
+ bar = "barbaz";
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..06b667ddf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,161 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J
+ m2() { return 39 }
+ bar = "barbaz";
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..c0ba4475a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,161 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J
+ m2() { return 39 }
+ bar = "barbaz";
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..fde32f87d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,155 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1
+ m2() { return 39 }
+ bar = "barbaz";
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..1800c41d03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,155 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1
+ m2() { return 39 }
+ bar = "barbaz";
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..8da79d7865
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,155 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1
+ m2() { return 39 }
+ bar = "barbaz";
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..6aa6f017c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-rs-static-privatename-identifier.js
@@ -0,0 +1,161 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: Valid Static PrivateName (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J
+ m2() { return 39 }
+ bar = "barbaz";
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-fields.js
new file mode 100644
index 0000000000..2d79468c3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-fields.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: static private fields (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #x; static #y
+ m2() { return 39 }
+ bar = "barbaz";
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..ae07f13ca4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-methods-with-fields.js
@@ -0,0 +1,139 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: static private methods with fields (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ static #xVal; static #yVal
+ m2() { return 39 }
+ bar = "barbaz";
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-methods.js
new file mode 100644
index 0000000000..73afd18ea3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-static-private-methods.js
@@ -0,0 +1,126 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: static private methods (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+
+ m2() { return 39 }
+ bar = "barbaz";
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-definitions-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-string-literal-names.js
new file mode 100644
index 0000000000..0c19e95ae7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-definitions-string-literal-names.js
@@ -0,0 +1,160 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-multiple-definitions.template
+/*---
+description: String literal names (multiple fields definitions)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ 'a'; "b"; 'c' = 39;
+ "d" = 42
+ m2() { return 39 }
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert(!
+ Object.prototype.hasOwnProperty.call(c, "m2"),
+ "m2 doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-computed-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-computed-names.js
new file mode 100644
index 0000000000..33a3cd84b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-computed-names.js
@@ -0,0 +1,130 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Computed property names (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ [x] = 42; [10] = "meep"; ["not initialized"]
+ foo = "foobar"
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-computed-symbol-names.js
new file mode 100644
index 0000000000..dcc67070a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-computed-symbol-names.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Computed property symbol names (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ [x]; [y] = 42
+ foo = "foobar"
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..24576d030b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,132 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: PrivateName Static Semantics, StringValue (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;
+ foo = "foobar"
+ bar = "barbaz";
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-literal-names-asi.js
new file mode 100644
index 0000000000..18a29a486f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-literal-names-asi.js
@@ -0,0 +1,100 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Literal property names with ASI (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ a
+ b = 42;
+ foo = "foobar"
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-literal-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-literal-names.js
new file mode 100644
index 0000000000..24d02c0387
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-literal-names.js
@@ -0,0 +1,119 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Literal property names (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ a; b = 42;
+ c = fn
+ foo = "foobar"
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-field-usage.js
new file mode 100644
index 0000000000..924a3e50bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-field-usage.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: PrivateName CallExpression usage (private field) (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = 'test262';
+ foo = "foobar"
+ bar = "barbaz";
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-method-getter-usage.js
new file mode 100644
index 0000000000..852b25356f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-method-getter-usage.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'test262'; }
+ foo = "foobar"
+ bar = "barbaz";
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-method-usage.js
new file mode 100644
index 0000000000..5a14646ea9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-method-usage.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: PrivateName CallExpression usage (private method) (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'test262'; }
+ foo = "foobar"
+ bar = "barbaz";
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-names.js
new file mode 100644
index 0000000000..84db117fb4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-private-names.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: private names (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ #x; #y
+ foo = "foobar"
+ bar = "barbaz";
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..533d2babf1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid FieldDefinition (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1
+ foo = "foobar"
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier.js
new file mode 100644
index 0000000000..b374d79f0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-field-identifier.js
@@ -0,0 +1,117 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid FieldDefinition (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J
+ foo = "foobar"
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-getter-alt.js
new file mode 100644
index 0000000000..b7f773d106
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-getter-alt.js
@@ -0,0 +1,151 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName as private getter (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+
+ foo = "foobar"
+ bar = "barbaz";
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-getter.js
new file mode 100644
index 0000000000..48445c7ee5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-getter.js
@@ -0,0 +1,151 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName as private getter (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+
+ foo = "foobar"
+ bar = "barbaz";
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-method-alt.js
new file mode 100644
index 0000000000..748cf0bee8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-method-alt.js
@@ -0,0 +1,150 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName as private method (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+
+ foo = "foobar"
+ bar = "barbaz";
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-method.js
new file mode 100644
index 0000000000..a73cd7cae0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-method.js
@@ -0,0 +1,150 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName as private method (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+
+ foo = "foobar"
+ bar = "barbaz";
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-setter-alt.js
new file mode 100644
index 0000000000..06ba60b3aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-setter-alt.js
@@ -0,0 +1,150 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName as private setter (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+
+ foo = "foobar"
+ bar = "barbaz";
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-setter.js
new file mode 100644
index 0000000000..1e148929e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-private-setter.js
@@ -0,0 +1,150 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName as private setter (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+
+ foo = "foobar"
+ bar = "barbaz";
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..b091d5ae3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-alt.js
@@ -0,0 +1,132 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J
+ foo = "foobar"
+ bar = "barbaz";
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..e9ad66b790
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,126 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1
+ foo = "foobar"
+ bar = "barbaz";
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..d492a9b06f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer.js
@@ -0,0 +1,126 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1
+ foo = "foobar"
+ bar = "barbaz";
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier.js
new file mode 100644
index 0000000000..750081b1a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-privatename-identifier.js
@@ -0,0 +1,132 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J
+ foo = "foobar"
+ bar = "barbaz";
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..8acf08510e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,157 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ }
+ foo = "foobar"
+ bar = "barbaz";
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..f70868376a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,158 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ }
+ foo = "foobar"
+ bar = "barbaz";
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..32a2350244
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,157 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static AsyncMethod PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ }
+ foo = "foobar"
+ bar = "barbaz";
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..376984d386
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,158 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static AsyncMethod PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ }
+ foo = "foobar"
+ bar = "barbaz";
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..3e03c04c06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,147 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ }
+ foo = "foobar"
+ bar = "barbaz";
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..35b1823259
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,148 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ }
+ foo = "foobar"
+ bar = "barbaz";
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..fcf9196c27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,145 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static Method PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ }
+ foo = "foobar"
+ bar = "barbaz";
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..6ac8ee35a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js
@@ -0,0 +1,145 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static Method PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ }
+ foo = "foobar"
+ bar = "barbaz";
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..bead6c078e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,133 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J
+ foo = "foobar"
+ bar = "barbaz";
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..08cc2b9518
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,133 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J
+ foo = "foobar"
+ bar = "barbaz";
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..1a2de43efb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,133 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J
+ foo = "foobar"
+ bar = "barbaz";
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..303c606354
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1
+ foo = "foobar"
+ bar = "barbaz";
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..d2871d3ed9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1
+ foo = "foobar"
+ bar = "barbaz";
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..71d2d785a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1
+ foo = "foobar"
+ bar = "barbaz";
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..981cc5077c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier.js
@@ -0,0 +1,133 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: Valid Static PrivateName (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J
+ foo = "foobar"
+ bar = "barbaz";
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-fields.js
new file mode 100644
index 0000000000..c6a380b05f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-fields.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: static private fields (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #x; static #y
+ foo = "foobar"
+ bar = "barbaz";
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..f277b44498
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: static private methods with fields (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #xVal; static #yVal
+ foo = "foobar"
+ bar = "barbaz";
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-methods.js
new file mode 100644
index 0000000000..7eb936ac03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-static-private-methods.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: static private methods (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+
+ foo = "foobar"
+ bar = "barbaz";
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-string-literal-names.js
new file mode 100644
index 0000000000..c9d5175d3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-string-literal-names.js
@@ -0,0 +1,132 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-multiple-stacked-definitions.template
+/*---
+description: String literal names (multiple stacked fields definitions through ASI)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ 'a'; "b"; 'c' = 39;
+ "d" = 42
+ foo = "foobar"
+ bar = "barbaz";
+
+}
+
+var c = new C();
+
+assert.sameValue(c.foo, "foobar");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "foo"),
+ "foo doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
+ "foo doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "bar"),
+ "bar doesn't appear as an own property on the C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
+ "bar doesn't appear as an own property on the C prototype"
+);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: true,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-arrow-fnc-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-arrow-fnc-init-err-contains-arguments.js
new file mode 100644
index 0000000000..d777f2b55d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-arrow-fnc-init-err-contains-arguments.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-arrow-fnc-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (arrow function expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, arrow-function]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => {
+ var t = () => arguments;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-arrow-fnc-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-arrow-fnc-init-err-contains-super.js
new file mode 100644
index 0000000000..10f67a1320
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-arrow-fnc-init-err-contains-super.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-arrow-fnc-nested.template
+/*---
+description: Syntax error if `super()` used in class field (arrow function expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, arrow-function]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => {
+ var t = () => super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-comp-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-comp-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..97177d04c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-comp-name-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-comp-name-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (computed ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, computed-property-names]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+var x = "string";
+class C {
+ [x] = () => arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-comp-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-comp-name-init-err-contains-super.js
new file mode 100644
index 0000000000..e0bd645948
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-comp-name-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-comp-name-nested.template
+/*---
+description: Syntax error if `super()` used in class field (computed ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, computed-property-names]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+var x = "string";
+class C {
+ [x] = () => super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..d875a6e5b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-contains-superproperty-1.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-eval-nested.template
+/*---
+description: super.x in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super.x;');
+}
+
+new C();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..16ae4d6b01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-contains-superproperty-2.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-eval-nested.template
+/*---
+description: super['x'] in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super["x"];');
+}
+
+new C();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..569749c78d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-eval-nested.template
+/*---
+description: error if `super()['x']` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..3ab9102756
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-eval-nested.template
+/*---
+description: error if `super().x` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..d93ba84757
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-direct-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-eval-nested.template
+/*---
+description: error if `super()` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = eval('executed = true; super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..c1e072e3e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-indirect-eval-nested.template
+/*---
+description: super.x in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super.x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..abc413ecb9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-contains-superproperty-2.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-fields-indirect-eval-nested.template
+/*---
+description: super['x'] in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..d20d056c18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-indirect-eval-nested.template
+/*---
+description: error if `super()['x']` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..0f10cd6926
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-indirect-eval-nested.template
+/*---
+description: error if `super().x` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..d5a13181f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-derived-cls-indirect-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-fields-indirect-eval-nested.template
+/*---
+description: error if `super()` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ x = (0, eval)('executed = true; super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-direct-eval-err-contains-arguments.js
new file mode 100644
index 0000000000..031e5086d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-direct-eval-err-contains-arguments.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-arguments.case
+// - src/class-elements/initializer-direct-eval-arguments/cls-decl-fields-eval-nested.template
+/*---
+description: error if `arguments` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if ContainsArguments of StatementList is true.
+ ...
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+var executed = false;
+class C {
+ x = () => {
+ var t = () => { eval('executed = true; arguments;'); };
+ t();
+ }
+}
+
+assert.throws(SyntaxError, function() {
+ new C().x();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/nested-direct-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..eec4e3a676
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-direct-eval-err-contains-newtarget.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-fields-eval-nested.template
+/*---
+description: error if `new.target` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ x = eval('executed = true; new.target;');
+}
+
+var c = new C();
+
+assert.sameValue(executed, true);
+assert.sameValue(c.x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-equality-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-equality-init-err-contains-arguments.js
new file mode 100644
index 0000000000..097ec48013
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-equality-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-equality-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (equality expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => {} == arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-equality-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-equality-init-err-contains-super.js
new file mode 100644
index 0000000000..161d0fb529
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-equality-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-equality-nested.template
+/*---
+description: Syntax error if `super()` used in class field (equality expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => {} == super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-indirect-eval-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-indirect-eval-contains-arguments.js
new file mode 100644
index 0000000000..ac4e817cd0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-indirect-eval-contains-arguments.js
@@ -0,0 +1,25 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-arguments.case
+// - src/class-elements/initializer-indirect-eval-arguments/cls-decl-fields-indirect-eval-nested.template
+/*---
+description: No error if `arguments` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public]
+flags: [generated, noStrict]
+info: |
+ For indirect eval, the "Additional Early Error Rules for Eval Inside Initializer"
+ (in #sec-performeval-rules-in-initializer) are NOT applicable.
+
+---*/
+
+
+var arguments = 1;
+class C {
+ x = () => {
+ var t = () => (0, eval)('arguments;');
+ return t();
+ }
+}
+assert.sameValue(new C().x(), arguments);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/nested-indirect-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..19eae85f80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-indirect-eval-err-contains-newtarget.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-fields-indirect-eval-nested.template
+/*---
+description: error if `new.target` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-public]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ x = (0, eval)('executed = true; new.target;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-literal-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..1c7453e69d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-literal-name-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-literal-name-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-literal-name-init-err-contains-super.js
new file mode 100644
index 0000000000..bda742293c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-literal-name-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-literal-name-nested.template
+/*---
+description: Syntax error if `super()` used in class field (literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-arrow-fnc-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-private-arrow-fnc-init-err-contains-arguments.js
new file mode 100644
index 0000000000..ad61eb20a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-arrow-fnc-init-err-contains-arguments.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-arrow-fnc-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (private field, arrow function expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, arrow-function, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => {
+ var t = () => arguments;
+ t();
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-arrow-fnc-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-private-arrow-fnc-init-err-contains-super.js
new file mode 100644
index 0000000000..57f5aff25e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-arrow-fnc-init-err-contains-super.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-arrow-fnc-nested.template
+/*---
+description: Syntax error if `super()` used in class field (private field, arrow function expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, arrow-function, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => {
+ var t = () => super();
+ t();
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..d01a521970
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-1.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-eval-nested.template
+/*---
+description: super.x in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super.x;');
+}
+
+new C();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..d667ad9743
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-contains-superproperty-2.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-eval-nested.template
+/*---
+description: super['x'] in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super["x"];');
+}
+
+new C();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..ed1137492c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-eval-nested.template
+/*---
+description: error if `super()['x']` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..292515caf1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-eval-nested.template
+/*---
+description: error if `super().x` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..ca01d01130
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-direct-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-eval-nested.template
+/*---
+description: error if `super()` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..ae20c0061a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-indirect-eval-nested.template
+/*---
+description: super.x in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super.x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..1c5fda8bd9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-contains-superproperty-2.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-indirect-eval-nested.template
+/*---
+description: super['x'] in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..b0f130dc03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-indirect-eval-nested.template
+/*---
+description: error if `super()['x']` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..4683284688
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-indirect-eval-nested.template
+/*---
+description: error if `super().x` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..246de345ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-derived-cls-indirect-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-indirect-eval-nested.template
+/*---
+description: error if `super()` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-private-direct-eval-err-contains-arguments.js
new file mode 100644
index 0000000000..d4829e845d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-direct-eval-err-contains-arguments.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-arguments.case
+// - src/class-elements/initializer-direct-eval-arguments/cls-decl-private-fields-eval-nested.template
+/*---
+description: error if `arguments` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if ContainsArguments of StatementList is true.
+ ...
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+var executed = false;
+class C {
+ #x = () => {
+ var t = () => { eval('executed = true; arguments;'); };
+ t();
+ }
+ constructor() {
+ this.#x();
+ }
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/nested-private-direct-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..c6a569e620
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-direct-eval-err-contains-newtarget.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-private-fields-eval-nested.template
+/*---
+description: error if `new.target` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ #x = eval('executed = true; new.target;');
+}
+
+var c = new C();
+
+assert.sameValue(executed, true);
+assert.sameValue(c.x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-indirect-eval-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-private-indirect-eval-contains-arguments.js
new file mode 100644
index 0000000000..289dc6ac40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-indirect-eval-contains-arguments.js
@@ -0,0 +1,26 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-arguments.case
+// - src/class-elements/initializer-indirect-eval-arguments/cls-decl-private-fields-indirect-eval-nested.template
+/*---
+description: No error if `arguments` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated, noStrict]
+info: |
+ For indirect eval, the "Additional Early Error Rules for Eval Inside Initializer"
+ (in #sec-performeval-rules-in-initializer) are NOT applicable.
+
+---*/
+
+
+var arguments = 1;
+class C {
+ #x = (0, eval)('arguments;');
+ x() {
+ return this.#x;
+ }
+}
+
+assert.sameValue(new C().x(), arguments);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/nested-private-indirect-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..f9f824135c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-indirect-eval-err-contains-newtarget.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-private-fields-indirect-eval-nested.template
+/*---
+description: error if `new.target` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ #x = (0, eval)('executed = true; new.target;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-private-literal-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..394b818a8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-literal-name-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-name-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (ClassElementName PrivateName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-private-literal-name-init-err-contains-super.js
new file mode 100644
index 0000000000..3897026538
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-literal-name-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-name-nested.template
+/*---
+description: Syntax error if `super()` used in class field (ClassElementName PrivateName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-ternary-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-private-ternary-init-err-contains-arguments.js
new file mode 100644
index 0000000000..1679bacb40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-ternary-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-ternary-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (private field, ternary expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => false ? {} : arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-ternary-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-private-ternary-init-err-contains-super.js
new file mode 100644
index 0000000000..c94b09834e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-ternary-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-ternary-nested.template
+/*---
+description: Syntax error if `super()` used in class field (private field, ternary expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => false ? {} : super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-typeof-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-private-typeof-init-err-contains-arguments.js
new file mode 100644
index 0000000000..a065f17a75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-typeof-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-typeof-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (private field, typeof expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => typeof arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-private-typeof-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-private-typeof-init-err-contains-super.js
new file mode 100644
index 0000000000..8932fdcd0b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-private-typeof-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-typeof-nested.template
+/*---
+description: Syntax error if `super()` used in class field (private field, typeof expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => typeof super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-static-comp-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-static-comp-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..96be893a02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-static-comp-name-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-comp-name-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (static computed ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public, computed-property-names]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+var x = "string";
+class C {
+ static [x] = () => arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-static-comp-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-static-comp-name-init-err-contains-super.js
new file mode 100644
index 0000000000..533d727312
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-static-comp-name-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-comp-name-nested.template
+/*---
+description: Syntax error if `super()` used in class field (static computed ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public, computed-property-names]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+var x = "string";
+class C {
+ static [x] = () => super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-static-literal-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-static-literal-init-err-contains-arguments.js
new file mode 100644
index 0000000000..3dcf75e485
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-static-literal-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-literal-name-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (static literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static x = () => arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-static-literal-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-static-literal-init-err-contains-super.js
new file mode 100644
index 0000000000..a211594fda
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-static-literal-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-literal-name-nested.template
+/*---
+description: Syntax error if `super()` used in class field (static literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static x = () => super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-static-private-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-static-private-init-err-contains-arguments.js
new file mode 100644
index 0000000000..a02931ce9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-static-private-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-private-name-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (static PrivateName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static #x = () => arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-static-private-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-static-private-init-err-contains-super.js
new file mode 100644
index 0000000000..5247871b54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-static-private-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-private-name-nested.template
+/*---
+description: Syntax error if `super()` used in class field (static PrivateName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static #x = () => super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-static-string-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-static-string-literal-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..ee3bf5639e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-static-string-literal-name-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-string-literal-name-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (static string literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static 'x' = () => arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-static-string-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-static-string-literal-name-init-err-contains-super.js
new file mode 100644
index 0000000000..26c744f4f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-static-string-literal-name-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-string-literal-name-nested.template
+/*---
+description: Syntax error if `super()` used in class field (static string literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static 'x' = () => super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-string-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-string-literal-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..cb03937f68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-string-literal-name-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-string-literal-name-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (string literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ 'x' = () => arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-string-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-string-literal-name-init-err-contains-super.js
new file mode 100644
index 0000000000..08f9b9fe11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-string-literal-name-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-string-literal-name-nested.template
+/*---
+description: Syntax error if `super()` used in class field (string literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ 'x' = () => super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-ternary-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-ternary-init-err-contains-arguments.js
new file mode 100644
index 0000000000..4868adf924
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-ternary-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-ternary-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (ternary expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => false ? {} : arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-ternary-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-ternary-init-err-contains-super.js
new file mode 100644
index 0000000000..2b9ec450d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-ternary-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-ternary-nested.template
+/*---
+description: Syntax error if `super()` used in class field (ternary expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => false ? {} : super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-typeof-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/nested-typeof-init-err-contains-arguments.js
new file mode 100644
index 0000000000..f3fd252bcc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-typeof-init-err-contains-arguments.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-typeof-nested.template
+/*---
+description: Syntax error if `arguments` used in class field (typeof expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => typeof arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/nested-typeof-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/nested-typeof-init-err-contains-super.js
new file mode 100644
index 0000000000..cffa546d4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/nested-typeof-init-err-contains-super.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-typeof-nested.template
+/*---
+description: Syntax error if `super()` used in class field (typeof expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ x = () => typeof super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-computed-names.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-computed-names.js
new file mode 100644
index 0000000000..5772bdea7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-computed-names.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Computed property names (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ [x] = 42; [10] = "meep"; ["not initialized"]
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-computed-symbol-names.js
new file mode 100644
index 0000000000..c65e3a6c7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-computed-symbol-names.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Computed property symbol names (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ [x]; [y] = 42
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..d5358ecc82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;
+ m() { return 42; }
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-literal-names-asi.js
new file mode 100644
index 0000000000..730fec9f6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-literal-names-asi.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Literal property names with ASI (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ a
+ b = 42;
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-literal-names.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-literal-names.js
new file mode 100644
index 0000000000..2ba4cf4418
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-literal-names.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Literal property names (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ a; b = 42;
+ c = fn
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-field-usage.js
new file mode 100644
index 0000000000..f4c1de7f9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-field-usage.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = 'test262';
+ m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-method-getter-usage.js
new file mode 100644
index 0000000000..cc6ada0071
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-method-getter-usage.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'test262'; }
+ m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-method-usage.js
new file mode 100644
index 0000000000..ed4e7aa0ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-method-usage.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'test262'; }
+ m() { return 42; }
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-names.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-names.js
new file mode 100644
index 0000000000..7e7e12716a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-private-names.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: private names (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ #x; #y
+ m() { return 42; }
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..0aa8cf5549
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier.js
new file mode 100644
index 0000000000..f82c1d13b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-field-identifier.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-getter-alt.js
new file mode 100644
index 0000000000..25431263b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-getter-alt.js
@@ -0,0 +1,129 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+
+ m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-getter.js
new file mode 100644
index 0000000000..642a2eb491
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-getter.js
@@ -0,0 +1,129 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+
+ m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-method-alt.js
new file mode 100644
index 0000000000..6bb366ad75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-method-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+
+ m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-method.js
new file mode 100644
index 0000000000..72947f435c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-method.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+
+ m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-setter-alt.js
new file mode 100644
index 0000000000..04a7af2f92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-setter-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+
+ m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-setter.js
new file mode 100644
index 0000000000..478b154ae1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-private-setter.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+
+ m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..71a5f0d71e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-alt.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J
+ m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..6401ea1ada
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1
+ m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..cddab94cb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1
+ m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier.js
new file mode 100644
index 0000000000..9cd8abddef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-privatename-identifier.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J
+ m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..1115796bfd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ }
+ m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..01c5527c19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,136 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ }
+ m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..6fb19f0e10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ }
+ m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..2fedbcc4e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,136 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ }
+ m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..3db89f438d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ }
+ m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..b65b950b05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,126 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ }
+ m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..f60b0ac875
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,123 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ }
+ m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..f5bf797fff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-method-privatename-identifier.js
@@ -0,0 +1,123 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ }
+ m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..4b82b013c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J
+ m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..47b387cfb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J
+ m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..0e2b75505c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J
+ m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..932cab6817
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1
+ m() { return 42; }
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..0fd537d010
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1
+ m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..6c7ca87eac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1
+ m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..a275dbeeee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-rs-static-privatename-identifier.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J
+ m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-fields.js
new file mode 100644
index 0000000000..6c01d01493
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-fields.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: static private fields (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #x; static #y
+ m() { return 42; }
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..ea43ef6308
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-methods-with-fields.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: static private methods with fields (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #xVal; static #yVal
+ m() { return 42; }
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-methods.js
new file mode 100644
index 0000000000..a1368e60ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-static-private-methods.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: static private methods (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+
+ m() { return 42; }
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-string-literal-names.js
new file mode 100644
index 0000000000..1d90148868
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-no-sc-line-method-string-literal-names.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-new-no-sc-line-method.template
+/*---
+description: String literal names (field definitions followed by a method in a new line without a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ 'a'; "b"; 'c' = 39;
+ "d" = 42
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-computed-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-computed-names.js
new file mode 100644
index 0000000000..0d162e255e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-computed-names.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Computed property names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ [x] = 42; [10] = "meep"; ["not initialized"];
+ *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-computed-symbol-names.js
new file mode 100644
index 0000000000..7dc9395d6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-computed-symbol-names.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Computed property symbol names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ [x]; [y] = 42;
+ *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..026640d37a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ *m() { return 42; }
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-literal-names-asi.js
new file mode 100644
index 0000000000..a5d140da93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-literal-names-asi.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Literal property names with ASI (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ a
+ b = 42;;
+ *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-literal-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-literal-names.js
new file mode 100644
index 0000000000..2725d067a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-literal-names.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Literal property names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ a; b = 42;
+ c = fn;
+ *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-field-usage.js
new file mode 100644
index 0000000000..81e3a294de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-field-usage.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = 'test262';;
+ *m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-method-getter-usage.js
new file mode 100644
index 0000000000..7cfb03aad9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-method-getter-usage.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'test262'; };
+ *m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-method-usage.js
new file mode 100644
index 0000000000..ed69bf33f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-method-usage.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'test262'; };
+ *m() { return 42; }
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-names.js
new file mode 100644
index 0000000000..939372768d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-private-names.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: private names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ #x; #y;
+ *m() { return 42; }
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..2dc3866901
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-field-identifier-initializer.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+ *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-field-identifier.js
new file mode 100644
index 0000000000..71d68269be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-field-identifier.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+ *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-getter-alt.js
new file mode 100644
index 0000000000..c189c19726
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-getter-alt.js
@@ -0,0 +1,129 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ *m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-getter.js
new file mode 100644
index 0000000000..8d6f5c08ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-getter.js
@@ -0,0 +1,129 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ *m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-method-alt.js
new file mode 100644
index 0000000000..ba250447a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-method-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ *m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-method.js
new file mode 100644
index 0000000000..b900f33e56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-method.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ *m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-setter-alt.js
new file mode 100644
index 0000000000..225e4b4edb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-setter-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ *m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-setter.js
new file mode 100644
index 0000000000..c41b4487a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-private-setter.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ *m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..35498f2223
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-alt.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ *m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..fba538c7d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ *m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..b145ef1dd4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ *m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier.js
new file mode 100644
index 0000000000..855a649b26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-privatename-identifier.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ *m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..67cfec91a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ *m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..d11b746cb8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,136 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ *m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..2829df2ddf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ *m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..3a0eee48bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,136 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ *m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..6432137d51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ *m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..6c3c2e45bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,126 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ *m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..2397b6c820
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,123 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ *m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..acb708bb49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js
@@ -0,0 +1,123 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ *m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..a558cd6148
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ *m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..03efb13b72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ *m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..3ba13a2e10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ *m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..d6d305fc67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ *m() { return 42; }
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..dba6c15312
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ *m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..73f5afb3a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ *m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..0c59b4f671
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-rs-static-privatename-identifier.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ *m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-fields.js
new file mode 100644
index 0000000000..4a158fc799
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-fields.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: static private fields (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #x; static #y;
+ *m() { return 42; }
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..9e35870051
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-methods-with-fields.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: static private methods with fields (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #xVal; static #yVal;
+ *m() { return 42; }
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-methods.js
new file mode 100644
index 0000000000..f184130b48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-static-private-methods.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: static private methods (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ ;
+ *m() { return 42; }
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-string-literal-names.js
new file mode 100644
index 0000000000..9eae83137e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-gen-string-literal-names.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-generator.template
+/*---
+description: String literal names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ 'a'; "b"; 'c' = 39;
+ "d" = 42;
+ *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-computed-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-computed-names.js
new file mode 100644
index 0000000000..1fc29ec2ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-computed-names.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Computed property names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ [x] = 42; [10] = "meep"; ["not initialized"];
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-computed-symbol-names.js
new file mode 100644
index 0000000000..a056e38fb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-computed-symbol-names.js
@@ -0,0 +1,106 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Computed property symbol names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ [x]; [y] = 42;
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..da1063e3e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ m() { return 42; }
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-literal-names-asi.js
new file mode 100644
index 0000000000..1d58676f76
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-literal-names-asi.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Literal property names with ASI (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ a
+ b = 42;;
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-literal-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-literal-names.js
new file mode 100644
index 0000000000..182103077c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-literal-names.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Literal property names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ a; b = 42;
+ c = fn;
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-field-usage.js
new file mode 100644
index 0000000000..9bc9044082
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-field-usage.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = 'test262';;
+ m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-method-getter-usage.js
new file mode 100644
index 0000000000..e879cf66c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-method-getter-usage.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'test262'; };
+ m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-method-usage.js
new file mode 100644
index 0000000000..a3c1f7b671
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-method-usage.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'test262'; };
+ m() { return 42; }
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-names.js
new file mode 100644
index 0000000000..4874428248
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-private-names.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: private names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ #x; #y;
+ m() { return 42; }
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..c4d712146c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-field-identifier-initializer.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-field-identifier.js
new file mode 100644
index 0000000000..2372787738
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-field-identifier.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-getter-alt.js
new file mode 100644
index 0000000000..bb4149d6ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-getter-alt.js
@@ -0,0 +1,129 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-getter.js
new file mode 100644
index 0000000000..9f5b4ece4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-getter.js
@@ -0,0 +1,129 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-method-alt.js
new file mode 100644
index 0000000000..239d65744e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-method-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-method.js
new file mode 100644
index 0000000000..0056ecde83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-method.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-setter-alt.js
new file mode 100644
index 0000000000..c95ce333ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-setter-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-setter.js
new file mode 100644
index 0000000000..33b324895b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-private-setter.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..6826cb6dea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-alt.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..a01e4f7b14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..5fe94107f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier-initializer.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier.js
new file mode 100644
index 0000000000..01c917154e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-privatename-identifier.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..5ad352be49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..13bf7cefb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,136 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..4ddcf3c8c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..85de245b7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,136 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..78a95feb85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..82b2ec6d18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,126 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..35b209fff2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,123 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..7fbc907383
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js
@@ -0,0 +1,123 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..ba19461f26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..3f64c4b090
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..6702dff50a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..45a772c8f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ m() { return 42; }
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..42f363a9cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..b5b7b7e340
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..4c51ca0bd4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-rs-static-privatename-identifier.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-fields.js
new file mode 100644
index 0000000000..ecb032989a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-fields.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: static private fields (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #x; static #y;
+ m() { return 42; }
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..fa2cf48168
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-methods-with-fields.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: static private methods with fields (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #xVal; static #yVal;
+ m() { return 42; }
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-methods.js
new file mode 100644
index 0000000000..160950265f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-static-private-methods.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: static private methods (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ ;
+ m() { return 42; }
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-string-literal-names.js
new file mode 100644
index 0000000000..09c7a06843
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/new-sc-line-method-string-literal-names.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-new-sc-line-method.template
+/*---
+description: String literal names (field definitions followed by a method in a new line with a semicolon)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ 'a'; "b"; 'c' = 39;
+ "d" = 42;
+ m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-is-visible-in-computed-properties.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-is-visible-in-computed-properties.js
new file mode 100644
index 0000000000..0084349ef3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-is-visible-in-computed-properties.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private getter of a class is visible in its ComputetProperty scope
+esid: prod-ClassTail
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ 1. Let lex be the LexicalEnvironment of the running execution context.
+ 2. Let classScope be NewDeclarativeEnvironment(lex).
+ 3. Let classScopeEnvRec be classScope's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of e is false, then
+ i. Let field be the result of ClassElementEvaluation for e with arguments proto and false.
+ ...
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+assert.throws(TypeError, function() {
+ class C {
+ get #f() {
+ throw new Test262Error();
+ }
+
+ [this.#f] = 'Test262';
+ }
+}, 'access to a private acessor from ordinary object');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/browser.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-ZWJ.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-ZWJ.js
new file mode 100644
index 0000000000..ac75d7fc59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-ZWJ.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-escape-sequence-ZWJ.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - ZWJ (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #ZW_\u200D_J() { return 'get string'; }
+ set #ZW_\u200D_J(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#ZW_‍_J;
+ }
+
+ setPrivateReference(value) {
+ this.#ZW_‍_J = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-ZWNJ.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-ZWNJ.js
new file mode 100644
index 0000000000..d99e759d6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-ZWNJ.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-escape-sequence-ZWNJ.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - ZWNJ (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #ZW_\u200C_NJ() { return 'get string'; }
+ set #ZW_\u200C_NJ(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#ZW_‌_NJ;
+ }
+
+ setPrivateReference(value) {
+ this.#ZW_‌_NJ = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-u2118.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-u2118.js
new file mode 100644
index 0000000000..c9470c32e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-u2118.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-escape-sequence-u2118.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - u2118 (℘) (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #\u2118() { return 'get string'; }
+ set #\u2118(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#℘;
+ }
+
+ setPrivateReference(value) {
+ this.#℘ = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-u6F.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-u6F.js
new file mode 100644
index 0000000000..7bd39f4bb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-escape-sequence-u6F.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-escape-sequence-u6F.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - u6F (o) (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #\u{6F}() { return 'get string'; }
+ set #\u{6F}(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#o;
+ }
+
+ setPrivateReference(value) {
+ this.#o = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-ZWJ.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-ZWJ.js
new file mode 100644
index 0000000000..5c8ebeaef5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-ZWJ.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-ZWJ.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - ZWJ (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #ZW_‍_J() { return 'get string'; }
+ set #ZW_‍_J(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#ZW_‍_J;
+ }
+
+ setPrivateReference(value) {
+ this.#ZW_‍_J = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-ZWNJ.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-ZWNJ.js
new file mode 100644
index 0000000000..85a6a43601
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-ZWNJ.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-ZWNJ.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - ZWNJ (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #ZW_‌_NJ() { return 'get string'; }
+ set #ZW_‌_NJ(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#ZW_‌_NJ;
+ }
+
+ setPrivateReference(value) {
+ this.#ZW_‌_NJ = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-common.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-common.js
new file mode 100644
index 0000000000..70756ae6ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-common.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-common.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - common (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #test262() { return 'get string'; }
+ set #test262(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#test262;
+ }
+
+ setPrivateReference(value) {
+ this.#test262 = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-dollar.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-dollar.js
new file mode 100644
index 0000000000..e151c45262
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-dollar.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-dollar.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - $ (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #$() { return 'get string'; }
+ set #$(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#$;
+ }
+
+ setPrivateReference(value) {
+ this.#$ = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-u2118.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-u2118.js
new file mode 100644
index 0000000000..9e000f3a63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-u2118.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-u2118.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - ℘ (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #℘() { return 'get string'; }
+ set #℘(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#℘;
+ }
+
+ setPrivateReference(value) {
+ this.#℘ = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-underscore.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-underscore.js
new file mode 100644
index 0000000000..febea21fec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/inst-private-name-underscore.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-underscore.case
+// - src/accessor-names/private/cls-private-decl-inst.template
+/*---
+description: Private IdentifierName - _ (Class declaration, private instance method)
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ get #_() { return 'get string'; }
+ set #_(param) { stringSet = param; }
+
+ getPrivateReference() {
+ return this.#_;
+ }
+
+ setPrivateReference(value) {
+ this.#_ = value;
+ }
+};
+
+var inst = new C();
+
+assert.sameValue(inst.getPrivateReference(), 'get string');
+
+inst.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/shell.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-ZWJ.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-ZWJ.js
new file mode 100644
index 0000000000..351eb7f5b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-ZWJ.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-escape-sequence-ZWJ.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - ZWJ (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #ZW_\u200D_J() { return 'get string'; }
+ static set #ZW_\u200D_J(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#ZW_‍_J;
+ }
+
+ static setPrivateReference(value) {
+ this.#ZW_‍_J = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-ZWNJ.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-ZWNJ.js
new file mode 100644
index 0000000000..05ea4118f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-ZWNJ.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-escape-sequence-ZWNJ.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - ZWNJ (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #ZW_\u200C_NJ() { return 'get string'; }
+ static set #ZW_\u200C_NJ(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#ZW_‌_NJ;
+ }
+
+ static setPrivateReference(value) {
+ this.#ZW_‌_NJ = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-u2118.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-u2118.js
new file mode 100644
index 0000000000..554a6a1034
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-u2118.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-escape-sequence-u2118.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - u2118 (℘) (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #\u2118() { return 'get string'; }
+ static set #\u2118(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#℘;
+ }
+
+ static setPrivateReference(value) {
+ this.#℘ = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-u6F.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-u6F.js
new file mode 100644
index 0000000000..1420f0d547
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-escape-sequence-u6F.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-escape-sequence-u6F.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - u6F (o) (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #\u{6F}() { return 'get string'; }
+ static set #\u{6F}(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#o;
+ }
+
+ static setPrivateReference(value) {
+ this.#o = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-ZWJ.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-ZWJ.js
new file mode 100644
index 0000000000..fa0d3b1a6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-ZWJ.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-ZWJ.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - ZWJ (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #ZW_‍_J() { return 'get string'; }
+ static set #ZW_‍_J(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#ZW_‍_J;
+ }
+
+ static setPrivateReference(value) {
+ this.#ZW_‍_J = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-ZWNJ.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-ZWNJ.js
new file mode 100644
index 0000000000..15fc7dbbd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-ZWNJ.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-ZWNJ.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - ZWNJ (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #ZW_‌_NJ() { return 'get string'; }
+ static set #ZW_‌_NJ(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#ZW_‌_NJ;
+ }
+
+ static setPrivateReference(value) {
+ this.#ZW_‌_NJ = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-common.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-common.js
new file mode 100644
index 0000000000..ddc98e5e34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-common.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-common.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - common (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #test262() { return 'get string'; }
+ static set #test262(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#test262;
+ }
+
+ static setPrivateReference(value) {
+ this.#test262 = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-dollar.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-dollar.js
new file mode 100644
index 0000000000..a71d3733a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-dollar.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-dollar.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - $ (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #$() { return 'get string'; }
+ static set #$(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#$;
+ }
+
+ static setPrivateReference(value) {
+ this.#$ = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-u2118.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-u2118.js
new file mode 100644
index 0000000000..914573983b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-u2118.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-u2118.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - ℘ (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #℘() { return 'get string'; }
+ static set #℘(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#℘;
+ }
+
+ static setPrivateReference(value) {
+ this.#℘ = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-underscore.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-underscore.js
new file mode 100644
index 0000000000..7356830d4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-name/static-private-name-underscore.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/accessor-names/private-name-underscore.case
+// - src/accessor-names/private/cls-private-decl-static.template
+/*---
+description: Private IdentifierName - _ (Class declaration, static method)
+features: [class, class-static-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+var stringSet;
+
+class C {
+ static get #_() { return 'get string'; }
+ static set #_(param) { stringSet = param; }
+
+ static getPrivateReference() {
+ return this.#_;
+ }
+
+ static setPrivateReference(value) {
+ this.#_ = value;
+ }
+}
+
+assert.sameValue(C.getPrivateReference(), 'get string');
+
+C.setPrivateReference('set string');
+assert.sameValue(stringSet, 'set string');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-arrow-fnc-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/private-arrow-fnc-init-err-contains-arguments.js
new file mode 100644
index 0000000000..651ce6c2e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-arrow-fnc-init-err-contains-arguments.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-arrow-fnc.template
+/*---
+description: Syntax error if `arguments` used in class field (private field, arrow function expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, arrow-function, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => arguments;
+}
+
diff --git a/js/src/tests/test262/language/statements/class/elements/private-arrow-fnc-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/private-arrow-fnc-init-err-contains-super.js
new file mode 100644
index 0000000000..63e05382c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-arrow-fnc-init-err-contains-super.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-arrow-fnc.template
+/*---
+description: Syntax error if `super()` used in class field (private field, arrow function expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, arrow-function, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = () => super();
+}
+
diff --git a/js/src/tests/test262/language/statements/class/elements/private-async-generator-method-name.js b/js/src/tests/test262/language/statements/class/elements/private-async-generator-method-name.js
new file mode 100644
index 0000000000..6d631f0d72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-async-generator-method-name.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-async-generator-method-name.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private async generators methods have name property properly configured (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement : MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
+
+ ClassElement : MethodDefinition
+ ClassElement : static MethodDefinition
+ 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
+ 2. Return empty.
+
+ AsyncMethod : async [no LineTerminator here] * ClassElementName (UniqueFormalParameters) { AsyncFunctionBody }
+ 1. Let propKey be the result of evaluating ClassElementName.
+ ...
+ 12. Perform ? DefineOrdinaryMethod(key, homeObject, closure, enumerable).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let bindingName be StringValue of PrivateIdentifier.
+ ...
+ 5. If scopeEnvRec's binding for bindingName is uninitialized,
+ a. Let field be NewPrivateName(bindingName).
+ b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
+ 6. Otherwise,
+ a. Let field be scopeEnvRec.GetBindingValue(bindingName).
+ 7. Assert: field.[[Description]] is bindingName.
+ 8. Return field.
+
+ DefineOrdinaryMethod(key, homeObject, closure, enumerable)
+ 1. Perform SetFunctionName(closure, key).
+ 2. If key is a Private Name,
+ a. Assert: key does not have a [[Kind]] field.
+ b. Set key.[[Kind]] to "method".
+ c. Set key.[[Value]] to closure.
+ d. Set key.[[Brand]] to homeObject.
+ 3. Else,
+ a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
+
+---*/
+
+
+class C {
+ async * #method() {};
+
+ getPrivateMethod() {
+ return this.#method;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.getPrivateMethod().name, "#method");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-async-method-name.js b/js/src/tests/test262/language/statements/class/elements/private-async-method-name.js
new file mode 100644
index 0000000000..f7318e2cea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-async-method-name.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-async-method-name.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private async methods have name property properly configured (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement : MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
+
+ ClassElement : MethodDefinition
+ ClassElement : static MethodDefinition
+ 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
+ 2. Return empty.
+
+ AsyncMethod : async [no LineTerminator here] ClassElementName (UniqueFormalParameters) { AsyncFunctionBody }
+ 1. Let propKey be the result of evaluating ClassElementName.
+ ...
+ 10. Perform ? DefineOrdinaryMethod(key, homeObject, closure, enumerable).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let bindingName be StringValue of PrivateIdentifier.
+ ...
+ 5. If scopeEnvRec's binding for bindingName is uninitialized,
+ a. Let field be NewPrivateName(bindingName).
+ b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
+ 6. Otherwise,
+ a. Let field be scopeEnvRec.GetBindingValue(bindingName).
+ 7. Assert: field.[[Description]] is bindingName.
+ 8. Return field.
+
+ DefineOrdinaryMethod(key, homeObject, closure, enumerable)
+ 1. Perform SetFunctionName(closure, key).
+ 2. If key is a Private Name,
+ a. Assert: key does not have a [[Kind]] field.
+ b. Set key.[[Kind]] to "method".
+ c. Set key.[[Value]] to closure.
+ d. Set key.[[Brand]] to homeObject.
+ 3. Else,
+ a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
+
+---*/
+
+
+class C {
+ async #method() {};
+
+ getPrivateMethod() {
+ return this.#method;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.getPrivateMethod().name, "#method");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-class-field-on-frozen-objects-strict.js b/js/src/tests/test262/language/statements/class/elements/private-class-field-on-frozen-objects-strict.js
new file mode 100644
index 0000000000..8c90bfdd31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-class-field-on-frozen-objects-strict.js
@@ -0,0 +1,34 @@
+'use strict';
+// Copyright (C) 2019 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: It is possible to add private fields on frozen objects
+esid: sec-define-field
+info: |
+ DefineField(receiver, fieldRecord)
+ ...
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+features: [class, class-fields-private, class-fields-public]
+flags: [onlyStrict]
+---*/
+
+class Test {
+ f = this;
+ #g = (Object.freeze(this), "Test262");
+
+ get g() {
+ return this.#g;
+ }
+}
+
+let t = new Test();
+assert.sameValue(t.f, t);
+assert.sameValue(t.g, "Test262");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..b7a7ecf1b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-contains-superproperty-1.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-eval.template
+/*---
+description: super.x in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super.x;');
+}
+
+new C();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..ba434a3f39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-contains-superproperty-2.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-eval.template
+/*---
+description: super['x'] in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super["x"];');
+}
+
+new C();
+
+assert.sameValue(executed, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..5a6449746f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-eval.template
+/*---
+description: error if `super()['x']` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..31b908edd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-eval.template
+/*---
+description: error if `super().x` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..e565f03a28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-direct-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-eval.template
+/*---
+description: error if `super()` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = eval('executed = true; super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-contains-superproperty-1.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-contains-superproperty-1.js
new file mode 100644
index 0000000000..2d40dd1074
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-contains-superproperty-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-1.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-indirect-eval.template
+/*---
+description: super.x in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super.x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-contains-superproperty-2.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-contains-superproperty-2.js
new file mode 100644
index 0000000000..f8a3a172f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-contains-superproperty-2.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-superproperty-2.case
+// - src/class-elements/initializer-eval-super-property/cls-decl-private-fields-indirect-eval.template
+/*---
+description: super['x'] in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1.js
new file mode 100644
index 0000000000..531cb1436b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-1.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-1.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-indirect-eval.template
+/*---
+description: error if `super()['x']` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super()["x"];');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2.js
new file mode 100644
index 0000000000..1f2393a9c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall-2.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall-2.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-indirect-eval.template
+/*---
+description: error if `super().x` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super().x;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall.js b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall.js
new file mode 100644
index 0000000000..b034236fee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-derived-cls-indirect-eval-err-contains-supercall.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-supercall.case
+// - src/class-elements/initializer-eval-super-call/cls-decl-private-fields-indirect-eval.template
+/*---
+description: error if `super()` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+
+---*/
+
+
+var executed = false;
+class A {}
+class C extends A {
+ #x = (0, eval)('executed = true; super();');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-direct-eval-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/private-direct-eval-err-contains-arguments.js
new file mode 100644
index 0000000000..1e10f34afd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-direct-eval-err-contains-arguments.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-arguments.case
+// - src/class-elements/initializer-direct-eval-arguments/cls-decl-private-fields-eval.template
+/*---
+description: error if `arguments` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if ContainsArguments of StatementList is true.
+ ...
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+var executed = false;
+class C {
+ #x = eval('executed = true; arguments;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-direct-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/private-direct-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..296e3c82f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-direct-eval-err-contains-newtarget.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-private-fields-eval.template
+/*---
+description: error if `new.target` in StatementList of eval (direct eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ #x = eval('executed = true; new.target;');
+}
+
+var c = new C();
+
+assert.sameValue(executed, true);
+assert.sameValue(c.x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-access-on-inner-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/private-field-access-on-inner-arrow-function.js
new file mode 100644
index 0000000000..15051fcb92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-access-on-inner-arrow-function.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-access-on-inner-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private field is visible on inner arrow function of class scope (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #f = 'Test262';
+
+ method() {
+ let arrowFunction = () => {
+ return this.#f;
+ }
+
+ return arrowFunction();
+ }
+}
+
+let c = new C();
+assert.sameValue(c.method(), 'Test262');
+let o = {};
+assert.throws(TypeError, function() {
+ c.method.call(o);
+}, 'accessed private field from an ordinary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-access-on-inner-function.js b/js/src/tests/test262/language/statements/class/elements/private-field-access-on-inner-function.js
new file mode 100644
index 0000000000..e2d3d663ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-access-on-inner-function.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-access-on-inner-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private field is visible on inner function of class scope (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #f = 'Test262';
+
+ method() {
+ let self = this;
+ function innerFunction() {
+ return self.#f;
+ }
+
+ return innerFunction();
+ }
+}
+
+let c = new C();
+assert.sameValue(c.method(), 'Test262');
+let o = {};
+assert.throws(TypeError, function() {
+ c.method.call(o);
+}, 'accessed private field from an ordinary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-after-optional-chain.js b/js/src/tests/test262/language/statements/class/elements/private-field-after-optional-chain.js
new file mode 100644
index 0000000000..9ed4c44f1b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-after-optional-chain.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-after-optional-chain.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: OptionalChain.PrivateIdentifier is a valid syntax (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, optional-chaining, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ OptionalChain[Yield, Await] :
+ `?.` `[` Expression[+In, ?Yield, ?Await] `]`
+ `?.` IdentifierName
+ `?.` Arguments[?Yield, ?Await]
+ `?.` TemplateLiteral[?Yield, ?Await, +Tagged]
+ OptionalChain[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await] `]`
+ OptionalChain[?Yield, ?Await] `.` IdentifierName
+ OptionalChain[?Yield, ?Await] Arguments[?Yield, ?Await]
+ OptionalChain[?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged]
+ OptionalChain[?Yield, ?Await] `.` PrivateIdentifier
+
+---*/
+
+
+class C {
+ #f = 'Test262';
+
+ method(o) {
+ return o?.c.#f;
+ }
+}
+
+let c = new C();
+let o = {c: c};
+assert.sameValue(c.method(o), 'Test262');
+
+assert.sameValue(c.method(null), undefined);
+assert.sameValue(c.method(undefined), undefined);
+
+o = {c: new Object()};
+assert.throws(TypeError, function() {
+ c.method(o);
+}, 'accessed private field from an ordinary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-as-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/private-field-as-arrow-function.js
new file mode 100644
index 0000000000..85e3f2c133
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-as-arrow-function.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-as-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Calling arrow function returned from private field access (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, arrow-function, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = () => 'test262';
+
+ method() {
+ return this.#m();
+ }
+}
+
+let c = new C();
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-as-async-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/private-field-as-async-arrow-function.js
new file mode 100644
index 0000000000..1adaa1c557
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-as-async-arrow-function.js
@@ -0,0 +1,37 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-as-async-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Calling async arrow function returned from private field access (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, async-functions, arrow-function, class]
+flags: [generated, async]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = async () => 'test262';
+
+ method() {
+ return this.#m();
+ }
+}
+
+let c = new C();
+
+c.method().then((value) => assert.sameValue(value, 'test262'))
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-as-async-function.js b/js/src/tests/test262/language/statements/class/elements/private-field-as-async-function.js
new file mode 100644
index 0000000000..80d08d209b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-as-async-function.js
@@ -0,0 +1,37 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-as-async-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Calling async function returned from private field access (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, async-functions, class]
+flags: [generated, async]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = async function() { return 'test262'; };
+
+ method() {
+ return this.#m();
+ }
+}
+
+let c = new C();
+
+c.method().then((value) => assert.sameValue(value, 'test262'))
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-as-function.js b/js/src/tests/test262/language/statements/class/elements/private-field-as-function.js
new file mode 100644
index 0000000000..e710d58eb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-as-function.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-as-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Calling result returned from private field access (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = function () { return 'test262'; };
+
+ method() {
+ return this.#m();
+ }
+}
+
+let c = new C();
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-is-not-clobbered-by-computed-property.js b/js/src/tests/test262/language/statements/class/elements/private-field-is-not-clobbered-by-computed-property.js
new file mode 100644
index 0000000000..1121bb41f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-is-not-clobbered-by-computed-property.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private field is not clobbered by computed property
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+features: [class-fields-public, class-fields-private, class]
+---*/
+
+class C {
+ #m = 44;
+ ["#m"] = this.#m / 11;
+
+ checkPrivateField() {
+ assert.sameValue(this.hasOwnProperty("#m"), true);
+ assert.sameValue("#m" in this, true);
+
+ assert.sameValue(this["#m"], 4);
+
+ assert.sameValue(this.#m, 44);
+
+ return 0;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.checkPrivateField(), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-is-visible-in-computed-properties.js b/js/src/tests/test262/language/statements/class/elements/private-field-is-visible-in-computed-properties.js
new file mode 100644
index 0000000000..cb2bb60987
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-is-visible-in-computed-properties.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateName of a class is visible in its ComputetProperty scope
+esid: prod-ClassTail
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ 1. Let lex be the LexicalEnvironment of the running execution context.
+ 2. Let classScope be NewDeclarativeEnvironment(lex).
+ 3. Let classScopeEnvRec be classScope's EnvironmentRecord.
+ ...
+ 8. If ClassBodyopt is present, then
+ a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt,
+ i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
+ ii. Let privateName be NewPrivateName(dn).
+ iii. Perform ! classPrivateEnvRec.InitializeBinding(dn, dn).
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of e is false, then
+ i. Let field be the result of ClassElementEvaluation for e with arguments proto and false.
+ ...
+
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Return ? PrivateFieldGet(GetReferencedName(V), base).
+
+ PrivateFieldGet ( P, O )
+ ...
+ 4. If entry is empty, throw a TypeError exception.
+ ...
+
+features: [class-fields-private, class-fields-public, class]
+---*/
+
+const self = this;
+assert.throws(TypeError, function() {
+ class C {
+ [self.#f] = 'Test262';
+ #f = 'foo';
+ }
+}, 'access to a not defined private field in object should throw a TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-field-on-nested-class.js
new file mode 100644
index 0000000000..fe62912de9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-on-nested-class.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #outer = 'test262';
+
+ B_withoutPrivateField = class {
+ method(o) {
+ return o.#outer;
+ }
+ }
+
+ B_withPrivateField = class {
+ #inner = 42;
+ method(o) {
+ return o.#outer;
+ }
+ }
+}
+
+let c = new C();
+let innerB1 = new c.B_withoutPrivateField();
+assert.sameValue(innerB1.method(c), 'test262');
+let innerB2 = new c.B_withPrivateField();
+assert.sameValue(innerB2.method(c), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-visible-to-direct-eval-on-initializer.js b/js/src/tests/test262/language/statements/class/elements/private-field-visible-to-direct-eval-on-initializer.js
new file mode 100644
index 0000000000..5abd78669d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-visible-to-direct-eval-on-initializer.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private field is visible on initializer with direct eval
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-fields-private, class-fields-public, class]
+---*/
+
+class C {
+ #m = 44;
+ v = eval("this.#m");
+}
+
+let c = new C();
+assert.sameValue(c.v, 44);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-visible-to-direct-eval.js b/js/src/tests/test262/language/statements/class/elements/private-field-visible-to-direct-eval.js
new file mode 100644
index 0000000000..706e4a64b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-visible-to-direct-eval.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private field is visible to direct eval code
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-fields-private, class]
+---*/
+
+class C {
+ #m = 44;
+
+ getWithEval() {
+ return eval("this.#m");
+ }
+}
+
+class D {
+ #m = 44;
+}
+
+let c = new C();
+assert.sameValue(c.getWithEval(), 44);
+
+let d = new D();
+assert.throws(TypeError, function() {
+ c.getWithEval.call(d);
+}, "invalid access to a private field");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-field-with-initialized-id-is-visible-in-computed-properties.js b/js/src/tests/test262/language/statements/class/elements/private-field-with-initialized-id-is-visible-in-computed-properties.js
new file mode 100644
index 0000000000..5945177e73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-field-with-initialized-id-is-visible-in-computed-properties.js
@@ -0,0 +1,78 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateName of a class is visible in its ComputetProperty scope
+esid: prod-ClassTail
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ 1. Let lex be the LexicalEnvironment of the running execution context.
+ 2. Let classScope be NewDeclarativeEnvironment(lex).
+ 3. Let classScopeEnvRec be classScope's EnvironmentRecord.
+ ...
+ 8. If ClassBodyopt is present, then
+ a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt,
+ i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of e is false, then
+ i. Let field be the result of ClassElementEvaluation for e with arguments proto and false.
+ ...
+
+ FieldDefinition : ClassElementName Initializer
+ 1. Let name be the result of evaluating ClassElementName.
+ ...
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MemberExpression : MemberExpression . PrivateIdentifier
+ ...
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ ...
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ ...
+
+ GetValue (V)
+ ...
+ 5. If IsPropertyReference(V), then
+ a. If HasPrimitiveBase(V), then
+ i. Assert: In this case, base will never be null or undefined.
+ ii. Let base be ToObject(base).
+ b. If IsPrivateReference(V), then
+ i. Return ? PrivateFieldGet(GetReferencedName(V), base).
+ 6. Else,
+ a. Assert: base is an Environment Record.
+ b. Return ? base.GetBindingValue(GetReferencedName(V), IsStrictReference(V)).
+
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. Assert: Type(O) is Object.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+ 5. Return entry.[[PrivateFieldValue]].
+
+features: [class-fields-private, class-fields-public, class]
+---*/
+
+const self = this;
+assert.throws(TypeError, function() {
+ class C {
+ #f = 'foo';
+ [self.#f] = 'Test262';
+ }
+}, 'access to a not defined private field in object should throw a TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-generator-method-name.js b/js/src/tests/test262/language/statements/class/elements/private-generator-method-name.js
new file mode 100644
index 0000000000..d2650dbbdf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-generator-method-name.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-generator-method-name.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private generator methods have name property properly configured (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement : MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
+
+ GeneratorMethod : * ClassElementName (UniqueFormalParameters) { GeneratorBody }
+ 1. Let key be the result of evaluating ClassElementName.
+ ...
+ 12. Return DefineOrdinaryMethod(key, homeObject, closure, enumerable).
+
+ ClassElement : MethodDefinition
+ ClassElement : static MethodDefinition
+ 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
+ 2. Return empty.
+
+ ClassElementName : PrivateIdentifier
+ 1. Let bindingName be StringValue of PrivateIdentifier.
+ ...
+ 5. If scopeEnvRec's binding for bindingName is uninitialized,
+ a. Let field be NewPrivateName(bindingName).
+ b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
+ 6. Otherwise,
+ a. Let field be scopeEnvRec.GetBindingValue(bindingName).
+ 7. Assert: field.[[Description]] is bindingName.
+ 8. Return field.
+
+ DefineOrdinaryMethod(key, homeObject, closure, enumerable)
+ 1. Perform SetFunctionName(closure, key).
+ 2. If key is a Private Name,
+ a. Assert: key does not have a [[Kind]] field.
+ b. Set key.[[Kind]] to "method".
+ c. Set key.[[Value]] to closure.
+ d. Set key.[[Brand]] to homeObject.
+ 3. Else,
+ a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
+
+---*/
+
+
+class C {
+ * #method() {};
+
+ getPrivateMethod() {
+ return this.#method;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.getPrivateMethod().name, "#method");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-access-on-inner-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/private-getter-access-on-inner-arrow-function.js
new file mode 100644
index 0000000000..eb230b531f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-access-on-inner-arrow-function.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-getter-access-on-inner-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private getter is visible on inner arrow function of class scope (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'Test262'; }
+
+ method() {
+ let arrowFunction = () => {
+ return this.#m;
+ }
+
+ return arrowFunction();
+ }
+}
+
+let c = new C();
+assert.sameValue(c.method(), 'Test262');
+let o = {};
+assert.throws(TypeError, function() {
+ c.method.call(o);
+}, 'accessed private accessor from an ordinary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-access-on-inner-function.js b/js/src/tests/test262/language/statements/class/elements/private-getter-access-on-inner-function.js
new file mode 100644
index 0000000000..0f5ea60b1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-access-on-inner-function.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-getter-access-on-inner-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private getter is visible on inner function of class scope (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'Test262'; }
+
+ method() {
+ let self = this;
+ function innerFunction() {
+ return self.#m;
+ }
+
+ return innerFunction();
+ }
+}
+
+let c = new C();
+assert.sameValue(c.method(), 'Test262');
+let o = {};
+assert.throws(TypeError, function() {
+ c.method.call(o);
+}, 'accessed private accessor from an ordinary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-brand-check-multiple-evaluations-of-class.js b/js/src/tests/test262/language/statements/class/elements/private-getter-brand-check-multiple-evaluations-of-class.js
new file mode 100644
index 0000000000..ce8089407e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-brand-check-multiple-evaluations-of-class.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Every new evaluation of a class creates a different brand (private getter)
+esid: sec-privatefieldget
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 11. Let proto be ObjectCreate(protoParent).
+ ...
+ 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor",
+ a. Set F.[[PrivateBrand]] to proto.
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+features: [class, class-methods-private]
+---*/
+
+let createAndInstantiateClass = function () {
+ class C {
+ get #m() { return 'test262'; }
+
+ access(o) {
+ return o.#m;
+ }
+ }
+
+ let c = new C();
+ return c;
+};
+
+let c1 = createAndInstantiateClass();
+let c2 = createAndInstantiateClass();
+
+assert.sameValue(c1.access(c1), 'test262');
+assert.sameValue(c2.access(c2), 'test262');
+
+assert.throws(TypeError, function() {
+ c1.access(c2);
+}, 'invalid access of c1 private method');
+
+assert.throws(TypeError, function() {
+ c2.access(c1);
+}, 'invalid access of c2 private method');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-brand-check-super-class.js b/js/src/tests/test262/language/statements/class/elements/private-getter-brand-check-super-class.js
new file mode 100644
index 0000000000..e0fd805fed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-brand-check-super-class.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Subclass can access private methods of a superclass (private getter)
+esid: sec-privatefieldget
+info: |
+ SuperCall : super Arguments
+ ...
+ 10. Perform ? InitializeInstanceElements(result, F).
+ ...
+
+ InitializeInstanceFieldsElements ( O, constructor )
+ 1. Assert: Type ( O ) is Object.
+ 2. Assert: Assert constructor is an ECMAScript function object.
+ 3. If constructor.[[PrivateBrand]] is not undefined,
+ a. Perform ? PrivateBrandAdd(O, constructor.[[PrivateBrand]]).
+ 4. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
+ 5. For each item fieldRecord in order from fieldRecords,
+ a. Perform ? DefineField(O, fieldRecord).
+ 6. Return.
+features: [class, class-methods-private]
+---*/
+
+class S {
+ get #m() { return 'super class'; }
+
+ superAccess() { return this.#m; }
+}
+
+class C extends S {
+ get #m() { return 'test262'; }
+
+ access() {
+ return this.#m;
+ }
+}
+
+let c = new C();
+
+assert.sameValue(c.access(), 'test262');
+assert.sameValue(c.superAccess(), 'super class');
+
+let s = new S();
+assert.sameValue(s.superAccess(), 'super class');
+assert.throws(TypeError, function() {
+ c.access.call(s);
+}, 'invalid access of C private method');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-brand-check.js b/js/src/tests/test262/language/statements/class/elements/private-getter-brand-check.js
new file mode 100644
index 0000000000..775a26d7bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-brand-check.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateBrandCheck fails when the object O doesn't have P.[[Brand]] (private getter)
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+features: [class, class-methods-private]
+---*/
+
+class C {
+ get #m() { return 'test262'; }
+
+ access(o) {
+ return o.#m;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.access(c), 'test262');
+
+let o = {};
+assert.throws(TypeError, function() {
+ c.access(o);
+}, 'invalid access a private method');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-is-not-a-own-property.js b/js/src/tests/test262/language/statements/class/elements/private-getter-is-not-a-own-property.js
new file mode 100644
index 0000000000..71901a7d2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-is-not-a-own-property.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-getter-is-not-a-own-property.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private getter is not stored as an own property of objects (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+---*/
+
+
+class C {
+ get #m() { return "Test262"; }
+
+ checkPrivateGetter() {
+ assert.sameValue(this.hasOwnProperty("#m"), false);
+ assert.sameValue("#m" in this, false);
+
+ assert.sameValue(this.__lookupGetter__("#m"), undefined);
+
+ assert.sameValue(this.#m, "Test262");
+
+ return 0;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.checkPrivateGetter(), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-is-not-clobbered-by-computed-property.js b/js/src/tests/test262/language/statements/class/elements/private-getter-is-not-clobbered-by-computed-property.js
new file mode 100644
index 0000000000..14bae94912
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-is-not-clobbered-by-computed-property.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private getter is not clobbered by computed property
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+class C {
+ get #m() { return "Test262"; }
+ ["#m"] = 0;
+
+ checkPrivateGetter() {
+ assert.sameValue(this.hasOwnProperty("#m"), true);
+ assert.sameValue("#m" in this, true);
+
+ assert.sameValue(this["#m"], 0);
+
+ assert.sameValue(this.#m, "Test262");
+
+ return 0;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.checkPrivateGetter(), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-getter-on-nested-class.js
new file mode 100644
index 0000000000..bdda163475
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-on-nested-class.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-getter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private getter is available on inner classes (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'test262'; }
+
+ B = class {
+ method(o) {
+ return o.#m;
+ }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+assert.sameValue(innerB.method(c), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-field-on-nested-class.js
new file mode 100644
index 0000000000..94bcb313bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-field-on-nested-class.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-getter-shadowed-by-field-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private getter can be shadowed on inner classes by a private field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'outer class'; }
+
+ method() { return this.#m; }
+
+ B = class {
+ method(o) {
+ return o.#m;
+ }
+
+ #m = 'test262';
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+assert.sameValue(innerB.method(innerB), 'test262');
+assert.sameValue(c.method(), 'outer class');
+assert.throws(TypeError, function() {
+ innerB.method(c);
+}, 'accessed inner class field from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-getter-on-nested-class.js
new file mode 100644
index 0000000000..b1d797b880
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-getter-on-nested-class.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-getter-shadowed-by-getter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private getter can be shadowed on inner classes by a private getter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'outer class'; }
+
+ method() { return this.#m; }
+
+ B = class {
+ method(o) {
+ return o.#m;
+ }
+
+ get #m() { return 'test262'; }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+assert.sameValue(innerB.method(innerB), 'test262');
+assert.sameValue(c.method(), 'outer class');
+assert.throws(TypeError, function() {
+ innerB.method(c);
+}, 'accessed inner class getter from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-method-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-method-on-nested-class.js
new file mode 100644
index 0000000000..941ce75429
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-method-on-nested-class.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-getter-shadowed-by-method-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private getter can be shadowed on inner class by a private method (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { throw new Test262Error(); }
+
+ B = class {
+ method(o) {
+ return o.#m();
+ }
+
+ #m() { return 'test262'; }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+assert.sameValue(innerB.method(innerB), 'test262');
+assert.throws(TypeError, function() {
+ innerB.method(c);
+}, 'accessed inner class method from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-setter-on-nested-class.js
new file mode 100644
index 0000000000..4a042516a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-shadowed-by-setter-on-nested-class.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-getter-shadowed-by-setter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private getter can be shadowed on inner classes by a private setter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'outer class'; }
+
+ method() { return this.#m; }
+
+ B = class {
+ method(o) {
+ return o.#m;
+ }
+
+ set #m(v) { this._v = v; }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+
+assert.throws(TypeError, function() {
+ innerB.method(innerB);
+}, '[[Get]] operation of an accessor without getter');
+
+assert.sameValue(c.method(), 'outer class');
+
+assert.throws(TypeError, function() {
+ innerB.method(c);
+}, 'access of inner class accessor from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-visible-to-direct-eval-on-initializer.js b/js/src/tests/test262/language/statements/class/elements/private-getter-visible-to-direct-eval-on-initializer.js
new file mode 100644
index 0000000000..113f29c138
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-visible-to-direct-eval-on-initializer.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private getter is visible on initializer with direct eval
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+class C {
+ get #m() { return "Test262"; };
+ v = eval("this.#m");
+}
+
+let c = new C();
+assert.sameValue(c.v, "Test262");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-getter-visible-to-direct-eval.js b/js/src/tests/test262/language/statements/class/elements/private-getter-visible-to-direct-eval.js
new file mode 100644
index 0000000000..55a54f0d16
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-getter-visible-to-direct-eval.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private getter is visible to direct eval code
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-methods-private, class]
+---*/
+
+class C {
+ get #m() { return "Test262"; };
+
+ getWithEval() {
+ return eval("this.#m");
+ }
+}
+
+class D {
+ get #m() { throw new Test262Error(); };
+}
+
+let c = new C();
+assert.sameValue(c.getWithEval(), "Test262");
+
+let d = new D();
+assert.throws(TypeError, function() {
+ c.getWithEval.call(d);
+}, "invalid access to a private getter");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-indirect-eval-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/private-indirect-eval-contains-arguments.js
new file mode 100644
index 0000000000..4b58b0b29e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-indirect-eval-contains-arguments.js
@@ -0,0 +1,25 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-contains-arguments.case
+// - src/class-elements/initializer-indirect-eval-arguments/cls-decl-private-fields-indirect-eval.template
+/*---
+description: No error if `arguments` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, class-fields-public, class-fields-private]
+flags: [generated, noStrict]
+info: |
+ For indirect eval, the "Additional Early Error Rules for Eval Inside Initializer"
+ (in #sec-performeval-rules-in-initializer) are NOT applicable.
+
+---*/
+
+
+var arguments = 1;
+class C {
+ #x = (0, eval)('arguments;');
+ x() {
+ return this.#x;
+ }
+}
+assert.sameValue(new C().x(), arguments);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-indirect-eval-err-contains-newtarget.js b/js/src/tests/test262/language/statements/class/elements/private-indirect-eval-err-contains-newtarget.js
new file mode 100644
index 0000000000..a55ad8388d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-indirect-eval-err-contains-newtarget.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/eval-err-contains-newtarget.case
+// - src/class-elements/initializer-eval-newtarget/cls-decl-private-fields-indirect-eval.template
+/*---
+description: error if `new.target` in StatementList of eval (indirect eval)
+esid: sec-performeval-rules-in-initializer
+features: [class, new.target, class-fields-private]
+flags: [generated]
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+
+---*/
+
+
+var executed = false;
+class C {
+ #x = (0, eval)('executed = true; new.target;');
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/private-literal-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..bc1117bcfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-literal-name-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-name.template
+/*---
+description: Syntax error if `arguments` used in class field (ClassElementName PrivateName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/private-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/private-literal-name-init-err-contains-super.js
new file mode 100644
index 0000000000..57126d4e80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-literal-name-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-name.template
+/*---
+description: Syntax error if `super()` used in class field (ClassElementName PrivateName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-access-on-inner-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/private-method-access-on-inner-arrow-function.js
new file mode 100644
index 0000000000..a0e1670cfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-access-on-inner-arrow-function.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-access-on-inner-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private method is visible on inner arrow function of class scope (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'Test262'; }
+
+ method() {
+ let arrowFunction = () => {
+ return this.#m();
+ }
+
+ return arrowFunction();
+ }
+}
+
+let c = new C();
+assert.sameValue(c.method(), 'Test262');
+let o = {};
+assert.throws(TypeError, function() {
+ c.method.call(o);
+}, 'accessed private method from an ordinary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-access-on-inner-function.js b/js/src/tests/test262/language/statements/class/elements/private-method-access-on-inner-function.js
new file mode 100644
index 0000000000..00d4ba02fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-access-on-inner-function.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-access-on-inner-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private method is visible on inner function of class scope (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'Test262'; }
+
+ method() {
+ let self = this;
+ function innerFunction() {
+ return self.#m();
+ }
+
+ return innerFunction();
+ }
+}
+
+let c = new C();
+assert.sameValue(c.method(), 'Test262');
+let o = {};
+assert.throws(TypeError, function() {
+ c.method.call(o);
+}, 'accessed private method from an ordinary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-brand-check-multiple-evaluations-of-class.js b/js/src/tests/test262/language/statements/class/elements/private-method-brand-check-multiple-evaluations-of-class.js
new file mode 100644
index 0000000000..1a04a5c24f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-brand-check-multiple-evaluations-of-class.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Every new evaluation of a class creates a different brand (private method)
+esid: sec-privatefieldget
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 11. Let proto be ObjectCreate(protoParent).
+ ...
+ 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor",
+ a. Set F.[[PrivateBrand]] to proto.
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+features: [class, class-methods-private]
+---*/
+
+let createAndInstantiateClass = function () {
+ class C {
+ #m() { return 'test262'; }
+
+ access(o) {
+ return o.#m();
+ }
+ }
+
+ let c = new C();
+ return c;
+};
+
+let c1 = createAndInstantiateClass();
+let c2 = createAndInstantiateClass();
+
+assert.sameValue(c1.access(c1), 'test262');
+assert.sameValue(c2.access(c2), 'test262');
+
+assert.throws(TypeError, function() {
+ c1.access(c2);
+}, 'invalid access of c1 private method');
+
+assert.throws(TypeError, function() {
+ c2.access(c1);
+}, 'invalid access of c2 private method');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-brand-check-super-class.js b/js/src/tests/test262/language/statements/class/elements/private-method-brand-check-super-class.js
new file mode 100644
index 0000000000..76387409ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-brand-check-super-class.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Subclass can access private methods of a superclass (private method)
+esid: sec-privatefieldget
+info: |
+ SuperCall : super Arguments
+ ...
+ 10. Perform ? InitializeInstanceElements(result, F).
+ ...
+
+ InitializeInstanceFieldsElements ( O, constructor )
+ 1. Assert: Type ( O ) is Object.
+ 2. Assert: Assert constructor is an ECMAScript function object.
+ 3. If constructor.[[PrivateBrand]] is not undefined,
+ a. Perform ? PrivateBrandAdd(O, constructor.[[PrivateBrand]]).
+ 4. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
+ 5. For each item fieldRecord in order from fieldRecords,
+ a. Perform ? DefineField(O, fieldRecord).
+ 6. Return.
+features: [class, class-methods-private]
+---*/
+
+class S {
+ #method() { return 'super class'; }
+
+ superAccess() { return this.#method(); }
+}
+
+class C extends S {
+ #method() { return 'test262'; }
+
+ access() {
+ return this.#method();
+ }
+}
+
+let c = new C();
+
+assert.sameValue(c.access(), 'test262');
+assert.sameValue(c.superAccess(), 'super class');
+
+let s = new S();
+assert.sameValue(s.superAccess(), 'super class');
+assert.throws(TypeError, function() {
+ c.access.call(s);
+}, 'invalid access of C private method');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-brand-check.js b/js/src/tests/test262/language/statements/class/elements/private-method-brand-check.js
new file mode 100644
index 0000000000..29d0a0ddec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-brand-check.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateBrandCheck fails when the object O doesn't have P.[[Brand]] (private method)
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+features: [class, class-methods-private]
+---*/
+
+class C {
+ #m() { return 'test262'; }
+
+ access(o) {
+ return o.#m();
+ }
+}
+
+let c = new C();
+assert.sameValue(c.access(c), 'test262');
+
+let o = {};
+assert.throws(TypeError, function() {
+ c.access(o);
+}, 'invalid access a private method');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-comparison-multiple-evaluations-of-class.js b/js/src/tests/test262/language/statements/class/elements/private-method-comparison-multiple-evaluations-of-class.js
new file mode 100644
index 0000000000..5e63ac2f19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-comparison-multiple-evaluations-of-class.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Every new evaluation of a class creates a different brand (private getter)
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+features: [class, class-methods-private]
+---*/
+
+let createAndInstantiateClass = function () {
+ class C {
+ #m() { return 'test262'; }
+
+ getPrivateMethod() {
+ return this.#m;
+ }
+ }
+
+ return new C();
+};
+
+let c1 = createAndInstantiateClass();
+let c2 = createAndInstantiateClass();
+
+assert.notSameValue(c1.getPrivateMethod(), c2.getPrivateMethod());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-comparison.js b/js/src/tests/test262/language/statements/class/elements/private-method-comparison.js
new file mode 100644
index 0000000000..94b8d120bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-comparison.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-comparison.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateFieldGet of a private method returns the same function object to every instance of the same class (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ #m() { return 'test262'; }
+
+ getPrivateMethod() {
+ return this.#m;
+ }
+
+}
+
+let c1 = new C();
+let c2 = new C();
+
+assert.sameValue(c1.getPrivateMethod(), c2.getPrivateMethod());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-get-and-set.js b/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-get-and-set.js
new file mode 100644
index 0000000000..09ab4f46c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-get-and-set.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws TypeError when attempting to install private methods multiple times.
+esid: sec-privatemethodoraccessoradd
+info: |
+ 7.3.28 PrivateMethodOrAccessorAdd ( method, O )
+ 1. Assert: method.[[Kind]] is either method or accessor.
+ 2. Let entry be ! PrivateElementFind(method.[[Key]], O).
+ 3. If entry is not empty, throw a TypeError exception.
+ ...
+
+features: [class, class-methods-private]
+---*/
+
+class Base {
+ constructor(o) {
+ return o;
+ }
+}
+
+class C extends Base {
+ get #p() {}
+ set #p(x) {}
+}
+
+var obj = {};
+
+new C(obj);
+
+assert.throws(TypeError, function() {
+ new C(obj);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-get.js b/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-get.js
new file mode 100644
index 0000000000..7669951721
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-get.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws TypeError when attempting to install private methods multiple times.
+esid: sec-privatemethodoraccessoradd
+info: |
+ 7.3.28 PrivateMethodOrAccessorAdd ( method, O )
+ 1. Assert: method.[[Kind]] is either method or accessor.
+ 2. Let entry be ! PrivateElementFind(method.[[Key]], O).
+ 3. If entry is not empty, throw a TypeError exception.
+ ...
+
+features: [class, class-methods-private]
+---*/
+
+class Base {
+ constructor(o) {
+ return o;
+ }
+}
+
+class C extends Base {
+ get #p() {}
+}
+
+var obj = {};
+
+new C(obj);
+
+assert.throws(TypeError, function() {
+ new C(obj);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-set.js b/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-set.js
new file mode 100644
index 0000000000..41a8f92878
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation-set.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws TypeError when attempting to install private methods multiple times.
+esid: sec-privatemethodoraccessoradd
+info: |
+ 7.3.28 PrivateMethodOrAccessorAdd ( method, O )
+ 1. Assert: method.[[Kind]] is either method or accessor.
+ 2. Let entry be ! PrivateElementFind(method.[[Key]], O).
+ 3. If entry is not empty, throw a TypeError exception.
+ ...
+
+features: [class, class-methods-private]
+---*/
+
+class Base {
+ constructor(o) {
+ return o;
+ }
+}
+
+class C extends Base {
+ set #p(x) {}
+}
+
+var obj = {};
+
+new C(obj);
+
+assert.throws(TypeError, function() {
+ new C(obj);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation.js b/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation.js
new file mode 100644
index 0000000000..cef42e6c13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-double-initialisation.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws TypeError when attempting to install private methods multiple times.
+esid: sec-privatemethodoraccessoradd
+info: |
+ 7.3.28 PrivateMethodOrAccessorAdd ( method, O )
+ 1. Assert: method.[[Kind]] is either method or accessor.
+ 2. Let entry be ! PrivateElementFind(method.[[Key]], O).
+ 3. If entry is not empty, throw a TypeError exception.
+ ...
+
+features: [class, class-methods-private]
+---*/
+
+class Base {
+ constructor(o) {
+ return o;
+ }
+}
+
+class C extends Base {
+ #m() {}
+}
+
+var obj = {};
+
+new C(obj);
+
+assert.throws(TypeError, function() {
+ new C(obj);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-get-and-call.js b/js/src/tests/test262/language/statements/class/elements/private-method-get-and-call.js
new file mode 100644
index 0000000000..863eb31b80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-get-and-call.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-get-and-call.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Function returned by a private method can be called with other values as 'this' (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ #m() { return this._v; }
+
+ getPrivateMethod() {
+ return this.#m;
+ }
+
+}
+
+let c = new C();
+
+let o1 = {_v: 'test262'};
+let o2 = {_v: 'foo'};
+assert.sameValue(c.getPrivateMethod().call(o1), 'test262');
+assert.sameValue(c.getPrivateMethod().call(o2), 'foo');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-is-not-a-own-property.js b/js/src/tests/test262/language/statements/class/elements/private-method-is-not-a-own-property.js
new file mode 100644
index 0000000000..1998389348
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-is-not-a-own-property.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-is-not-a-own-property.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private method is not stored as an own property of objects (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+---*/
+
+
+class C {
+ #m() { return "Test262"; }
+
+ checkPrivateMethod() {
+ assert.sameValue(this.hasOwnProperty("#m"), false);
+ assert.sameValue("#m" in this, false);
+
+ assert.sameValue(this.#m(), "Test262");
+
+ return 0;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.checkPrivateMethod(), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-is-not-clobbered-by-computed-property.js b/js/src/tests/test262/language/statements/class/elements/private-method-is-not-clobbered-by-computed-property.js
new file mode 100644
index 0000000000..381b1cd6fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-is-not-clobbered-by-computed-property.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private method is not clobbered by computed property
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+class C {
+ #m() { return "Test262"; }
+ ["#m"] = 0;
+
+ checkPrivateMethod() {
+ assert.sameValue(this.hasOwnProperty("#m"), true);
+ assert.sameValue("#m" in this, true);
+
+ assert.sameValue(this["#m"], 0);
+
+ assert.sameValue(this.#m(), "Test262");
+
+ return 0;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.checkPrivateMethod(), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-is-visible-in-computed-properties.js b/js/src/tests/test262/language/statements/class/elements/private-method-is-visible-in-computed-properties.js
new file mode 100644
index 0000000000..2c85c9c7a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-is-visible-in-computed-properties.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private method of a class is visible in its ComputetProperty scope
+esid: prod-ClassTail
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ 1. Let lex be the LexicalEnvironment of the running execution context.
+ 2. Let classScope be NewDeclarativeEnvironment(lex).
+ 3. Let classScopeEnvRec be classScope's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of e is false, then
+ i. Let field be the result of ClassElementEvaluation for e with arguments proto and false.
+ ...
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+assert.throws(TypeError, function() {
+ class C {
+ #m() {
+ throw new Test262Error();
+ }
+
+ [this.#m()] = 'Test262';
+ }
+}, 'access to a private method from ordinary object');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-length.js b/js/src/tests/test262/language/statements/class/elements/private-method-length.js
new file mode 100644
index 0000000000..8e3f61770a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-length.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-length.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private methods have length property properly configured (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement : MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
+
+ ClassElement : static MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static".
+
+ MethodDefinition : ClassElementName( UniqueFormalParameters ) { FunctionBody }
+ 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
+ 2. ReturnIfAbrupt(methodDef).
+ 3. Perform ? DefineOrdinaryMethod(methodDef.[[Key]], homeObject, methodDef.[[Closure]], _enumerable).
+
+ ClassElement : MethodDefinition
+ ClassElement : static MethodDefinition
+ 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
+ 2. Return empty.
+
+ MethodDefinition : ClassElementName (UniqueFormalParameters) { FunctionBody }
+ ...
+ 8. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, scope, privateScope, strict, prototype).
+ 9. Perform MakeMethod(closure, object).
+ 10. Return the Record{[[Key]]: propKey, [[Closure]]: closure}.
+
+---*/
+
+
+class C {
+ #method(a) {};
+
+ getPrivateMethod() {
+ return this.#method;
+ }
+
+}
+
+let c = new C();
+assert.sameValue(c.getPrivateMethod().length, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-not-writable.js b/js/src/tests/test262/language/statements/class/elements/private-method-not-writable.js
new file mode 100644
index 0000000000..99346ae098
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-not-writable.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws TypeError when attempting to overwrite a private method.
+esid: sec-privateset
+info: |
+ 7.3.30 PrivateSet ( P, O, value )
+ 1. Let entry be ! PrivateElementFind(P, O).
+ 2. If entry is empty, throw a TypeError exception.
+ 3. If entry.[[Kind]] is field, then
+ ...
+ 4. Else if entry.[[Kind]] is method, then
+ a. Throw a TypeError exception.
+ 5. ...
+
+features: [class, class-methods-private]
+---*/
+
+class C {
+ #m() {}
+
+ assign() {
+ this.#m = 0;
+ }
+}
+
+var obj = new C();
+
+assert.throws(TypeError, function() {
+ obj.assign();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-method-on-nested-class.js
new file mode 100644
index 0000000000..c378ce2ad1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-on-nested-class.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private method is available on inner classes (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'test262'; }
+
+ B = class {
+ method(o) {
+ return o.#m();
+ }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+assert.sameValue(innerB.method(c), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-referenced-from-static-method.js b/js/src/tests/test262/language/statements/class/elements/private-method-referenced-from-static-method.js
new file mode 100644
index 0000000000..d7e68cd59a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-referenced-from-static-method.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-referenced-from-static-method.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private method referenced from a static method (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ #f() { return 42; }
+ static g() {
+ return this.#f();
+ }
+
+}
+
+assert.sameValue(C.g.call(new C()), 42);
+assert.throws(TypeError, function() {
+ C.g();
+}, 'Accessed private method from an object which did not contain it');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-field-on-nested-class.js
new file mode 100644
index 0000000000..4e93572bfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-field-on-nested-class.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-shadowed-by-field-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private method can be shadowed on inner classes by a private field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'outer class'; }
+
+ method() { return this.#m(); }
+
+ B = class {
+ method(o) {
+ return o.#m;
+ }
+
+ #m = 'test262';
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+assert.sameValue(innerB.method(innerB), 'test262');
+assert.sameValue(c.method(), 'outer class');
+assert.throws(TypeError, function() {
+ innerB.method(c);
+}, 'accessed inner class field from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-getter-on-nested-class.js
new file mode 100644
index 0000000000..90f322a91c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-getter-on-nested-class.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-shadowed-by-getter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private method can be shadowed on inner classes by a private getter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'outer class'; }
+
+ method() { return this.#m(); }
+
+ B = class {
+ method(o) {
+ return o.#m;
+ }
+
+ get #m() { return 'test262'; }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+assert.sameValue(innerB.method(innerB), 'test262');
+assert.sameValue(c.method(), 'outer class');
+assert.throws(TypeError, function() {
+ innerB.method(c);
+}, 'accessed inner class getter from an object of outer class');
+assert.throws(TypeError, function() {
+ C.prototype.method.call(innerB);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-setter-on-nested-class.js
new file mode 100644
index 0000000000..80a379e3c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-by-setter-on-nested-class.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-shadowed-by-setter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private method can be shadowed on inner classes by a private setter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'outer class'; }
+
+ method() { return this.#m(); }
+
+ B = class {
+ method(o) {
+ return o.#m;
+ }
+
+ set #m(v) { this._v = v; }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+
+assert.throws(TypeError, function() {
+ innerB.method(innerB);
+}, '[[Get]] operation of an accessor without getter');
+
+assert.sameValue(c.method(), 'outer class');
+
+assert.throws(TypeError, function() {
+ innerB.method(c);
+}, 'access of inner class accessor from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-on-nested-class.js
new file mode 100644
index 0000000000..071ab0c649
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-shadowed-on-nested-class.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-shadowed-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private method can be shadowed by inner class private method (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { throw new Test262Error(); }
+
+ B = class {
+ method() {
+ return this.#m();
+ }
+
+ #m() { return 'test262'; }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+assert.sameValue(innerB.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-visible-to-direct-eval-on-initializer.js b/js/src/tests/test262/language/statements/class/elements/private-method-visible-to-direct-eval-on-initializer.js
new file mode 100644
index 0000000000..a67f1ead92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-visible-to-direct-eval-on-initializer.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private method is visible on initializer with direct eval
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+class C {
+ #m() { return "Test262"; };
+ v = eval("this.#m()");
+}
+
+let c = new C();
+assert.sameValue(c.v, "Test262");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-method-visible-to-direct-eval.js b/js/src/tests/test262/language/statements/class/elements/private-method-visible-to-direct-eval.js
new file mode 100644
index 0000000000..d1d0a18614
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-method-visible-to-direct-eval.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private method is visible to direct eval code
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-methods-private, class]
+---*/
+
+class C {
+ #m() { return "Test262"; };
+
+ getWithEval() {
+ return eval("this.#m()");
+ }
+}
+
+class D {
+ #m() { throw new Test262Error(); };
+}
+
+let c = new C();
+assert.sameValue(c.getWithEval(), "Test262");
+
+let d = new D();
+assert.throws(TypeError, function() {
+ c.getWithEval.call(d);
+}, "invalid access to a private method");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-methods/browser.js b/js/src/tests/test262/language/statements/class/elements/private-methods/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-methods/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-async-generator.js b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-async-generator.js
new file mode 100644
index 0000000000..c703df72d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-async-generator.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-async-generator.case
+// - src/class-elements/private-methods/cls-decl.template
+/*---
+description: Private Async Generator (private method definitions in a class declaration)
+esid: prod-MethodDefinition
+features: [async-iteration, class, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ GeneratorMethod
+ AsyncMethod
+ AsyncGeneratorMethod
+ get ClassElementName () { FunctionBody }
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){GeneratorBody}
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ ---
+
+ InitializeClassElements ( F, proto )
+
+ ...
+ 5. For each item element in order from elements,
+ a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name.
+ b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype",
+ i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto.
+ ii. Perform ? DefineClassElement(receiver, element).
+
+ InitializeInstanceElements ( O, constructor )
+
+ ...
+ 3. Let elements be the value of F's [[Elements]] internal slot.
+ 4. For each item element in order from elements,
+ a. If element.[[Placement]] is "own" and element.[[Kind]] is "method",
+ i. Perform ? DefineClassElement(O, element).
+
+ DefineClassElement (receiver, element)
+
+ ...
+ 6. If key is a Private Name,
+ a. Perform ? PrivateFieldDefine(receiver, key, descriptor).
+
+ PrivateFieldDefine (P, O, desc)
+
+ ...
+ 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]].
+
+---*/
+var ctorPromise;
+
+
+
+/*** template notes
+ * method should always be #m
+ * the template provides c.ref() for external reference
+ */
+
+function hasProp(obj, name, expected, msg) {
+ var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name);
+ assert.sameValue(hasOwnProperty, expected, msg);
+
+ var hasProperty = Reflect.has(obj, name);
+ assert.sameValue(hasProperty, expected, msg);
+}
+
+class C {
+ async * #m() { return 42; }
+
+
+ get ref() { return this.#m; }
+
+ constructor() {
+ hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties');
+ assert.sameValue(typeof this.#m, 'function');
+ assert.sameValue(this.ref, this.#m, 'returns the same value');
+ assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms');
+
+ var ctorIter = this.#m();
+ var p = ctorIter.next();
+ ctorPromise = p.then(({ value, done }) => {
+ assert.sameValue(value, 42, 'return from generator method, inside ctor');
+ assert.sameValue(done, true, 'iterator is done, inside ctor');
+ }, $DONE);
+ assert.sameValue(this.#m.name, '#m', 'function name inside constructor');
+
+ }
+}
+
+var c = new C();
+var other = new C();
+
+hasProp(C.prototype, '#m', false, 'method is not defined in the prototype');
+hasProp(C, '#m', false, 'method is not defined in the contructor');
+hasProp(c, '#m', false, 'method cannot be seen outside of the class');
+
+/***
+ * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ *
+ * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
+ * ...
+ */
+assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance');
+
+assert.sameValue(c.ref.name, '#m', 'function name is preserved external reference');
+ctorPromise.then(() => {
+ // gets the returned async iterator from #m
+ var iter = c.ref();
+ return iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42, 'return from generator method');
+ assert.sameValue(done, true, 'iterator is done');
+ });
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-async-method.js b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-async-method.js
new file mode 100644
index 0000000000..fa42763d30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-async-method.js
@@ -0,0 +1,129 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-async-method.case
+// - src/class-elements/private-methods/cls-decl.template
+/*---
+description: Private Async Method (private method definitions in a class declaration)
+esid: prod-MethodDefinition
+features: [async-functions, class, class-methods-private]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ GeneratorMethod
+ AsyncMethod
+ AsyncGeneratorMethod
+ get ClassElementName () { FunctionBody }
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){GeneratorBody}
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ ---
+
+ InitializeClassElements ( F, proto )
+
+ ...
+ 5. For each item element in order from elements,
+ a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name.
+ b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype",
+ i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto.
+ ii. Perform ? DefineClassElement(receiver, element).
+
+ InitializeInstanceElements ( O, constructor )
+
+ ...
+ 3. Let elements be the value of F's [[Elements]] internal slot.
+ 4. For each item element in order from elements,
+ a. If element.[[Placement]] is "own" and element.[[Kind]] is "method",
+ i. Perform ? DefineClassElement(O, element).
+
+ DefineClassElement (receiver, element)
+
+ ...
+ 6. If key is a Private Name,
+ a. Perform ? PrivateFieldDefine(receiver, key, descriptor).
+
+ PrivateFieldDefine (P, O, desc)
+
+ ...
+ 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]].
+
+---*/
+var ctorPromise;
+
+
+
+/*** template notes
+ * method should always be #m
+ * the template provides c.ref() for external reference
+ */
+
+function hasProp(obj, name, expected, msg) {
+ var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name);
+ assert.sameValue(hasOwnProperty, expected, msg);
+
+ var hasProperty = Reflect.has(obj, name);
+ assert.sameValue(hasProperty, expected, msg);
+}
+
+class C {
+ async #m() { return 42; }
+
+
+ get ref() { return this.#m; }
+
+ constructor() {
+ hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties');
+ assert.sameValue(typeof this.#m, 'function');
+ assert.sameValue(this.ref, this.#m, 'returns the same value');
+ assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms');
+
+ assert.sameValue(this.#m.name, '#m', 'function name inside constructor');
+ ctorPromise = this.#m().then(value => {
+ assert.sameValue(value, 42, 'already defined in the ctor');
+ }, $DONE);
+
+ }
+}
+
+var c = new C();
+var other = new C();
+
+hasProp(C.prototype, '#m', false, 'method is not defined in the prototype');
+hasProp(C, '#m', false, 'method is not defined in the contructor');
+hasProp(c, '#m', false, 'method cannot be seen outside of the class');
+
+/***
+ * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ *
+ * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
+ * ...
+ */
+assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance');
+
+assert.sameValue(c.ref.name, '#m', 'function name is preserved external reference');
+ctorPromise.then(() => {
+ // gets the returned promise from #m
+ return c.ref().then(value => {
+ assert.sameValue(value, 42, 'function return');
+ });
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-generator.js b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-generator.js
new file mode 100644
index 0000000000..4cd79a852d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-generator.js
@@ -0,0 +1,126 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-generator.case
+// - src/class-elements/private-methods/cls-decl.template
+/*---
+description: Private Generator (private method definitions in a class declaration)
+esid: prod-MethodDefinition
+features: [generators, class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ GeneratorMethod
+ AsyncMethod
+ AsyncGeneratorMethod
+ get ClassElementName () { FunctionBody }
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){GeneratorBody}
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ ---
+
+ InitializeClassElements ( F, proto )
+
+ ...
+ 5. For each item element in order from elements,
+ a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name.
+ b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype",
+ i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto.
+ ii. Perform ? DefineClassElement(receiver, element).
+
+ InitializeInstanceElements ( O, constructor )
+
+ ...
+ 3. Let elements be the value of F's [[Elements]] internal slot.
+ 4. For each item element in order from elements,
+ a. If element.[[Placement]] is "own" and element.[[Kind]] is "method",
+ i. Perform ? DefineClassElement(O, element).
+
+ DefineClassElement (receiver, element)
+
+ ...
+ 6. If key is a Private Name,
+ a. Perform ? PrivateFieldDefine(receiver, key, descriptor).
+
+ PrivateFieldDefine (P, O, desc)
+
+ ...
+ 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]].
+
+---*/
+
+
+/*** template notes
+ * method should always be #m
+ * the template provides c.ref() for external reference
+ */
+
+function hasProp(obj, name, expected, msg) {
+ var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name);
+ assert.sameValue(hasOwnProperty, expected, msg);
+
+ var hasProperty = Reflect.has(obj, name);
+ assert.sameValue(hasProperty, expected, msg);
+}
+
+class C {
+ * #m() { return 42; }
+
+
+ get ref() { return this.#m; }
+
+ constructor() {
+ hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties');
+ assert.sameValue(typeof this.#m, 'function');
+ assert.sameValue(this.ref, this.#m, 'returns the same value');
+ assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms');
+
+ var res = this.#m().next();
+ assert.sameValue(res.value, 42, 'return from generator method, inside ctor');
+ assert.sameValue(res.done, true, 'iterator is done, inside ctor');
+ assert.sameValue(this.#m.name, '#m', 'function name inside constructor');
+
+ }
+}
+
+var c = new C();
+var other = new C();
+
+hasProp(C.prototype, '#m', false, 'method is not defined in the prototype');
+hasProp(C, '#m', false, 'method is not defined in the contructor');
+hasProp(c, '#m', false, 'method cannot be seen outside of the class');
+
+/***
+ * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ *
+ * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
+ * ...
+ */
+assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance');
+
+// gets the returned iterator from #m
+var res = c.ref().next();
+assert.sameValue(res.value, 42, 'return from generator method');
+assert.sameValue(res.done, true, 'iterator is done');
+assert.sameValue(c.ref.name, '#m', 'function name is preserved external reference');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-method-initialize-order.js b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-method-initialize-order.js
new file mode 100644
index 0000000000..a44bf73cd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-method-initialize-order.js
@@ -0,0 +1,141 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-method-initialize-order.case
+// - src/class-elements/private-methods/cls-decl.template
+/*---
+description: Private methods are added before any field initializer is run, even if they appear textually later (private method definitions in a class declaration)
+esid: prod-MethodDefinition
+features: [class-methods-private, class-fields-private, class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ GeneratorMethod
+ AsyncMethod
+ AsyncGeneratorMethod
+ get ClassElementName () { FunctionBody }
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){GeneratorBody}
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ ---
+
+ InitializeClassElements ( F, proto )
+
+ ...
+ 5. For each item element in order from elements,
+ a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name.
+ b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype",
+ i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto.
+ ii. Perform ? DefineClassElement(receiver, element).
+
+ InitializeInstanceElements ( O, constructor )
+
+ ...
+ 3. Let elements be the value of F's [[Elements]] internal slot.
+ 4. For each item element in order from elements,
+ a. If element.[[Placement]] is "own" and element.[[Kind]] is "method",
+ i. Perform ? DefineClassElement(O, element).
+
+ DefineClassElement (receiver, element)
+
+ ...
+ 6. If key is a Private Name,
+ a. Perform ? PrivateFieldDefine(receiver, key, descriptor).
+
+ PrivateFieldDefine (P, O, desc)
+
+ ...
+ 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]].
+
+
+ InitializeInstanceElements ( O, constructor )
+ ...
+ 4. For each item element in order from elements,
+ a. If element.[[Placement]] is "own" and element.[[Kind]] is "method",
+ i. Perform ? DefineClassElement(O, element).
+ 5. For each item element in order from elements,
+ a. If element.[[Placement]] is "own" and element.[[Kind]] is "field",
+ i. Assert: element.[[Descriptor]] does not have a [[Value]], [[Get]] or [[Set]] slot.
+ ii. Perform ? DefineClassElement(O, element).
+ 6. Return.
+
+ EDITOR'S NOTE:
+ Value properties are added before initializers so that private methods are visible from all initializers.
+
+---*/
+
+
+/*** template notes
+ * method should always be #m
+ * the template provides c.ref() for external reference
+ */
+
+function hasProp(obj, name, expected, msg) {
+ var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name);
+ assert.sameValue(hasOwnProperty, expected, msg);
+
+ var hasProperty = Reflect.has(obj, name);
+ assert.sameValue(hasProperty, expected, msg);
+}
+
+class C {
+ a = this.#m();
+
+ #m() { return 42; }
+ get bGetter() { return this.#b; }
+
+ #b = this.#m();
+
+
+ get ref() { return this.#m; }
+
+ constructor() {
+ hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties');
+ assert.sameValue(typeof this.#m, 'function');
+ assert.sameValue(this.ref, this.#m, 'returns the same value');
+ assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms');
+
+ assert.sameValue(this.a, 42);
+ assert.sameValue(this.#b, 42);
+
+ }
+}
+
+var c = new C();
+var other = new C();
+
+hasProp(C.prototype, '#m', false, 'method is not defined in the prototype');
+hasProp(C, '#m', false, 'method is not defined in the contructor');
+hasProp(c, '#m', false, 'method cannot be seen outside of the class');
+
+/***
+ * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ *
+ * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
+ * ...
+ */
+assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance');
+
+assert.sameValue(c.a, 42);
+assert.sameValue(c.bGetter, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-method.js b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-method.js
new file mode 100644
index 0000000000..77c16e2a58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-methods/prod-private-method.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-method.case
+// - src/class-elements/private-methods/cls-decl.template
+/*---
+description: Private Method (private method definitions in a class declaration)
+esid: prod-MethodDefinition
+features: [class, class-methods-private]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ GeneratorMethod
+ AsyncMethod
+ AsyncGeneratorMethod
+ get ClassElementName () { FunctionBody }
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){GeneratorBody}
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here]* ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ ---
+
+ InitializeClassElements ( F, proto )
+
+ ...
+ 5. For each item element in order from elements,
+ a. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name.
+ b. If element.[[Kind]] is "method" and element.[[Placement]] is "static" or "prototype",
+ i. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto.
+ ii. Perform ? DefineClassElement(receiver, element).
+
+ InitializeInstanceElements ( O, constructor )
+
+ ...
+ 3. Let elements be the value of F's [[Elements]] internal slot.
+ 4. For each item element in order from elements,
+ a. If element.[[Placement]] is "own" and element.[[Kind]] is "method",
+ i. Perform ? DefineClassElement(O, element).
+
+ DefineClassElement (receiver, element)
+
+ ...
+ 6. If key is a Private Name,
+ a. Perform ? PrivateFieldDefine(receiver, key, descriptor).
+
+ PrivateFieldDefine (P, O, desc)
+
+ ...
+ 6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]].
+
+---*/
+
+
+/*** template notes
+ * method should always be #m
+ * the template provides c.ref() for external reference
+ */
+
+function hasProp(obj, name, expected, msg) {
+ var hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, name);
+ assert.sameValue(hasOwnProperty, expected, msg);
+
+ var hasProperty = Reflect.has(obj, name);
+ assert.sameValue(hasProperty, expected, msg);
+}
+
+class C {
+ #m() { return 42; }
+
+
+ get ref() { return this.#m; }
+
+ constructor() {
+ hasProp(this, '#m', false, 'private methods are defined in an special internal slot and cannot be found as own properties');
+ assert.sameValue(typeof this.#m, 'function');
+ assert.sameValue(this.ref, this.#m, 'returns the same value');
+ assert.sameValue(this.#m, (() => this)().#m, 'memberexpression and call expression forms');
+
+ assert.sameValue(this.#m(), 42, 'already defined in the ctor');
+ assert.sameValue(this.#m.name, '#m', 'function name inside constructor');
+
+ }
+}
+
+var c = new C();
+var other = new C();
+
+hasProp(C.prototype, '#m', false, 'method is not defined in the prototype');
+hasProp(C, '#m', false, 'method is not defined in the contructor');
+hasProp(c, '#m', false, 'method cannot be seen outside of the class');
+
+/***
+ * MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ *
+ * 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
+ * ...
+ */
+assert.sameValue(c.ref, other.ref, 'The method is defined once, and reused on every new instance');
+
+// gets the returned value from #m
+assert.sameValue(c.ref(), 42, 'function return');
+assert.sameValue(c.ref.name, '#m', 'function name is preserved external reference');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-methods/shell.js b/js/src/tests/test262/language/statements/class/elements/private-methods/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-methods/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-access-on-inner-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/private-setter-access-on-inner-arrow-function.js
new file mode 100644
index 0000000000..beaec23a66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-access-on-inner-arrow-function.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-setter-access-on-inner-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private setter is visible on inner arrow function of class scope (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ set #m(v) { this._v = v; }
+
+ method() {
+ let arrowFunction = () => {
+ this.#m = 'Test262';
+ }
+
+ arrowFunction();
+ }
+}
+
+let c = new C();
+c.method();
+assert.sameValue(c._v, 'Test262');
+let o = {};
+assert.throws(TypeError, function() {
+ c.method.call(o);
+}, 'accessed private setter from an ordinary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-access-on-inner-function.js b/js/src/tests/test262/language/statements/class/elements/private-setter-access-on-inner-function.js
new file mode 100644
index 0000000000..13dcd93871
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-access-on-inner-function.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-setter-access-on-inner-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private setter is visible on inner function of class scope (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ set #m(v) { this._v = v; }
+
+ method() {
+ let self = this;
+ function innerFunction() {
+ self.#m = 'Test262';
+ }
+
+ innerFunction();
+ }
+}
+
+let c = new C();
+c.method();
+assert.sameValue(c._v, 'Test262');
+let o = {};
+assert.throws(TypeError, function() {
+ c.method.call(o);
+}, 'accessed private setter from an ordinary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-brand-check-multiple-evaluations-of-class.js b/js/src/tests/test262/language/statements/class/elements/private-setter-brand-check-multiple-evaluations-of-class.js
new file mode 100644
index 0000000000..d4c179fb0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-brand-check-multiple-evaluations-of-class.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Every new evaluation of a class creates a different brand (private setter)
+esid: sec-privatefieldget
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 11. Let proto be ObjectCreate(protoParent).
+ ...
+ 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor",
+ a. Set F.[[PrivateBrand]] to proto.
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+features: [class, class-methods-private]
+---*/
+
+let createAndInstantiateClass = function () {
+ class C {
+ set #m(v) { this._v = v; }
+
+ access(o, v) {
+ o.#m = v;
+ }
+ }
+
+ let c = new C();
+ return c;
+};
+
+let c1 = createAndInstantiateClass();
+let c2 = createAndInstantiateClass();
+
+c1.access(c1, 'test262');
+assert.sameValue(c1._v, 'test262');
+c2.access(c2, 'test262');
+assert.sameValue(c2._v, 'test262');
+
+assert.throws(TypeError, function() {
+ c1.access(c2, 'foo');
+}, 'invalid access of c1 private method');
+
+assert.throws(TypeError, function() {
+ c2.access(c1, 'foo');
+}, 'invalid access of c2 private method');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-brand-check-super-class.js b/js/src/tests/test262/language/statements/class/elements/private-setter-brand-check-super-class.js
new file mode 100644
index 0000000000..87963f8f92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-brand-check-super-class.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Subclass can access private methods of a superclass (private setter)
+esid: sec-privatefieldget
+info: |
+ SuperCall : super Arguments
+ ...
+ 10. Perform ? InitializeInstanceElements(result, F).
+ ...
+
+ InitializeInstanceFieldsElements ( O, constructor )
+ 1. Assert: Type ( O ) is Object.
+ 2. Assert: Assert constructor is an ECMAScript function object.
+ 3. If constructor.[[PrivateBrand]] is not undefined,
+ a. Perform ? PrivateBrandAdd(O, constructor.[[PrivateBrand]]).
+ 4. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
+ 5. For each item fieldRecord in order from fieldRecords,
+ a. Perform ? DefineField(O, fieldRecord).
+ 6. Return.
+features: [class, class-methods-private]
+---*/
+
+class S {
+ set #m(v) { this._v = v }
+
+ superAccess(v) { this.#m = v; }
+}
+
+class C extends S {
+ set #m(v) { this._u = v; }
+
+ access(v) {
+ return this.#m = v;
+ }
+}
+
+let c = new C();
+
+c.access('test262');
+assert.sameValue(c._u, 'test262');
+
+c.superAccess('super class');
+assert.sameValue(c._v, 'super class');
+
+let s = new S();
+s.superAccess('super class')
+assert.sameValue(s._v, 'super class');
+
+assert.throws(TypeError, function() {
+ c.access.call(s, 'foo');
+}, 'invalid access of C private method');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-brand-check.js b/js/src/tests/test262/language/statements/class/elements/private-setter-brand-check.js
new file mode 100644
index 0000000000..ba3e5ca66d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-brand-check.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateBrandCheck fails when the object O doesn't have P.[[Brand]] (private setter)
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+features: [class, class-methods-private]
+---*/
+
+class C {
+ set #m(v) { this._v = v; }
+
+ access(o, v) {
+ return o.#m = v;
+ }
+}
+
+let c = new C();
+c.access(c, 'test262');
+assert.sameValue(c._v, 'test262');
+
+let o = {};
+assert.throws(TypeError, function() {
+ c.access(o, 'foo');
+}, 'invalid access a private setter');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-is-not-a-own-property.js b/js/src/tests/test262/language/statements/class/elements/private-setter-is-not-a-own-property.js
new file mode 100644
index 0000000000..8deba4fe5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-is-not-a-own-property.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-setter-is-not-a-own-property.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private setter is not stored as an own property of objects (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+---*/
+
+
+class C {
+ set #m(v) { this._v = v; }
+
+ checkPrivateSetter() {
+ assert.sameValue(this.hasOwnProperty("#m"), false);
+ assert.sameValue("#m" in this, false);
+
+ assert.sameValue(this.__lookupSetter__("#m"), undefined);
+
+ this.#m = "Test262";
+ assert.sameValue(this._v, "Test262");
+
+ return 0;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.checkPrivateSetter(), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-is-not-clobbered-by-computed-property.js b/js/src/tests/test262/language/statements/class/elements/private-setter-is-not-clobbered-by-computed-property.js
new file mode 100644
index 0000000000..50943ffbcb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-is-not-clobbered-by-computed-property.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private setter is not clobbered by computed property
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+class C {
+ set #m(v) { this._v = v; }
+ ["#m"] = 0;
+
+ checkPrivateSetter() {
+ assert.sameValue(this.hasOwnProperty("#m"), true);
+ assert.sameValue("#m" in this, true);
+
+ assert.sameValue(this["#m"], 0);
+
+ this.#m = "Test262";
+ assert.sameValue(this._v, "Test262");
+
+ return 0;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.checkPrivateSetter(), 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-setter-on-nested-class.js
new file mode 100644
index 0000000000..c320048fc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-on-nested-class.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-setter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private setter is available on inner classes (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ set #m(v) { this._v = v; }
+
+ B = class {
+ method(o, v) {
+ o.#m = v;
+ }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+innerB.method(c, 'test262');
+assert.sameValue(c._v, 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-field-on-nested-class.js
new file mode 100644
index 0000000000..ac88ecdd4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-field-on-nested-class.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-setter-shadowed-by-field-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private setter can be shadowed on inner classes by a private field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ set #m(v) { this._v = v; }
+
+ method(v) { this.#m = v; }
+
+ B = class {
+ method(o, v) {
+ o.#m = v;
+ }
+
+ get m() { return this.#m; }
+
+ #m;
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+
+innerB.method(innerB, 'test262');
+assert.sameValue(innerB.m, 'test262');
+
+c.method('outer class');
+assert.sameValue(c._v, 'outer class');
+
+assert.throws(TypeError, function() {
+ innerB.method(c, 'foo');
+}, 'accessed inner class field from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-getter-on-nested-class.js
new file mode 100644
index 0000000000..b3cfc60c75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-getter-on-nested-class.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-setter-shadowed-by-getter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private setter can be shadowed on inner classes by a private getter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ set #m(v) { this._v = v; }
+
+ method(v) { this.#m = v; }
+
+ B = class {
+ method(o, v) {
+ o.#m = v;
+ }
+
+ get #m() { return 'test262'; }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+
+assert.throws(TypeError, function() {
+ innerB.method(innerB);
+}, 'invalid [[Set]] of an acessor without setter');
+
+c.method('outer class');
+assert.sameValue(c._v, 'outer class');
+
+assert.throws(TypeError, function() {
+ innerB.method(c);
+}, 'invalid access of inner class getter from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-method-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-method-on-nested-class.js
new file mode 100644
index 0000000000..89d45ebf96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-method-on-nested-class.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-setter-shadowed-by-method-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private setter can be shadowed on inner class by a private method (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ set #m(v) { this._v = v; }
+
+ method(v) { this.#m = v; }
+
+ B = class {
+ method(o, v) {
+ o.#m = v;
+ }
+
+ #m() { return 'test262'; }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+
+assert.throws(TypeError, function() {
+ innerB.method(innerB, 'foo');
+}, 'invalid [[Set]] operation in a private method');
+
+c.method('outer class');
+assert.sameValue(c._v, 'outer class');
+
+assert.throws(TypeError, function() {
+ innerB.method(c);
+}, 'invalid access of inner class method from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-setter-on-nested-class.js
new file mode 100644
index 0000000000..45c1e77b82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-shadowed-by-setter-on-nested-class.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-setter-shadowed-by-setter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private setter can be shadowed on inner classes by a private setter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ set #m(v) { this._v = v; }
+
+ method(v) { this.#m = v; }
+
+ B = class {
+ method(o, v) {
+ o.#m = v;
+ }
+
+ set #m(v) { this._v = v; }
+ }
+}
+
+let c = new C();
+let innerB = new c.B();
+
+innerB.method(innerB, 'test262');
+assert.sameValue(innerB._v, 'test262');
+
+c.method('outer class');
+assert.sameValue(c._v, 'outer class');
+
+assert.throws(TypeError, function() {
+ innerB.method(c, 'foo');
+}, 'access of inner class accessor from an object of outer class');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-visible-to-direct-eval-on-initializer.js b/js/src/tests/test262/language/statements/class/elements/private-setter-visible-to-direct-eval-on-initializer.js
new file mode 100644
index 0000000000..76eaad950f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-visible-to-direct-eval-on-initializer.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private setter is visible on initializer with direct eval
+esid: sec-privatefieldset
+info: |
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Set entry.[[PrivateFieldValue]] to value.
+ d. Return.
+ 4. If P.[[Kind]] is "method", throw a TypeError exception.
+ 5. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If O.[[PrivateFieldBrands]] does not contain P.[[Brand]], throw a TypeError exception.
+ c. If P does not have a [[Set]] field, throw a TypeError exception.
+ d. Let setter be P.[[Set]].
+ e. Perform ? Call(setter, O, value).
+ f. Return.
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-fields-public, class-methods-private, class]
+---*/
+
+class C {
+ set #m(v) { this._v = v; };
+ v = (eval("this.#m = 53"), this._v);
+}
+
+let c = new C();
+assert.sameValue(c.v, 53);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-setter-visible-to-direct-eval.js b/js/src/tests/test262/language/statements/class/elements/private-setter-visible-to-direct-eval.js
new file mode 100644
index 0000000000..5a0a24d0e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-setter-visible-to-direct-eval.js
@@ -0,0 +1,63 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private setter is visible to direct eval code
+esid: sec-privatefieldset
+info: |
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Set entry.[[PrivateFieldValue]] to value.
+ d. Return.
+ 4. If P.[[Kind]] is "method", throw a TypeError exception.
+ 5. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If O.[[PrivateFieldBrands]] does not contain P.[[Brand]], throw a TypeError exception.
+ c. If P does not have a [[Set]] field, throw a TypeError exception.
+ d. Let setter be P.[[Set]].
+ e. Perform ? Call(setter, O, value).
+ f. Return.
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-methods-private, class]
+---*/
+
+class C {
+ set #m(v) { this._v = v; };
+
+ setWithEval(v) {
+ eval("this.#m = v");
+ }
+}
+
+class D {
+ set #m(v) { throw new Test262Error(); };
+}
+
+let c = new C();
+c.setWithEval("Test262");
+assert.sameValue(c._v, "Test262");
+
+let d = new D();
+assert.throws(TypeError, function() {
+ c.setWithEval.call(d);
+}, "invalid access to a private setter");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-async-generator-method-name.js b/js/src/tests/test262/language/statements/class/elements/private-static-async-generator-method-name.js
new file mode 100644
index 0000000000..3e5e056e36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-async-generator-method-name.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-async-generator-method-name.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private static async generator methods have name property properly configured (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement : MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
+
+ ClassElement : static MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static".
+
+ AsyncMethod : async [no LineTerminator here] * ClassElementName (UniqueFormalParameters) { AsyncFunctionBody }
+ ...
+ 12. Perform ? DefineOrdinaryMethod(key, homeObject, closure, _enumerable).
+
+ ClassElement : MethodDefinition
+ ClassElement : static MethodDefinition
+ 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
+ 2. Return empty.
+
+ ClassElementName : PrivateIdentifier
+ 1. Let bindingName be StringValue of PrivateIdentifier.
+ ...
+ 5. If scopeEnvRec's binding for bindingName is uninitialized,
+ a. Let field be NewPrivateName(bindingName).
+ b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
+ 6. Otherwise,
+ a. Let field be scopeEnvRec.GetBindingValue(bindingName).
+ 7. Assert: field.[[Description]] is bindingName.
+ 8. Return field.
+
+ DefineOrdinaryMethod(key, homeObject, closure, enumerable)
+ 1. Perform SetFunctionName(closure, key).
+ 2. If key is a Private Name,
+ a. Assert: key does not have a [[Kind]] field.
+ b. Set key.[[Kind]] to "method".
+ c. Set key.[[Value]] to closure.
+ d. Set key.[[Brand]] to homeObject.
+ 3. Else,
+ a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
+
+---*/
+
+
+class C {
+ static async * #method() {};
+
+ static getPrivateMethod() {
+ return this.#method;
+ }
+}
+
+assert.sameValue(C.getPrivateMethod().name, "#method");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-async-method-name.js b/js/src/tests/test262/language/statements/class/elements/private-static-async-method-name.js
new file mode 100644
index 0000000000..de5464c427
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-async-method-name.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-async-method-name.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private static async methods have name property properly configured (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement : MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
+
+ ClassElement : static MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static".
+
+ AsyncMethod : async [no LineTerminator here] ClassElementName (UniqueFormalParameters) { AsyncFunctionBody }
+ ...
+ 10. Perform ? DefineOrdinaryMethod(key, homeObject, closure, _enumerable).
+
+ ClassElement : MethodDefinition
+ ClassElement : static MethodDefinition
+ 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
+ 2. Return empty.
+
+ ClassElementName : PrivateIdentifier
+ 1. Let bindingName be StringValue of PrivateIdentifier.
+ ...
+ 5. If scopeEnvRec's binding for bindingName is uninitialized,
+ a. Let field be NewPrivateName(bindingName).
+ b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
+ 6. Otherwise,
+ a. Let field be scopeEnvRec.GetBindingValue(bindingName).
+ 7. Assert: field.[[Description]] is bindingName.
+ 8. Return field.
+
+ DefineOrdinaryMethod(key, homeObject, closure, enumerable)
+ 1. Perform SetFunctionName(closure, key).
+ 2. If key is a Private Name,
+ a. Assert: key does not have a [[Kind]] field.
+ b. Set key.[[Kind]] to "method".
+ c. Set key.[[Value]] to closure.
+ d. Set key.[[Brand]] to homeObject.
+ 3. Else,
+ a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
+
+---*/
+
+
+class C {
+ static async #method() {};
+
+ static getPrivateMethod() {
+ return this.#method;
+ }
+}
+
+assert.sameValue(C.getPrivateMethod().name, "#method");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-field-on-nested-class.js
new file mode 100644
index 0000000000..fe7060c92e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-field-on-nested-class.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-field-shadowed-by-field-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static field can be shadowed on inner classes by a private field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class-static-fields-public, class-fields-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m = 'outer class';
+
+ static fieldAccess() {
+ return this.#m;
+ }
+
+ static B = class {
+ #m = 'inner class';
+ static fieldAccess(o) {
+ return o.#m;
+ }
+ }
+}
+
+assert.sameValue(C.fieldAccess(), 'outer class');
+
+let b = new C.B();
+
+assert.sameValue(C.B.fieldAccess(b), 'inner class');
+
+assert.throws(TypeError, function() {
+ C.B.fieldAccess(C);
+}, 'accessed private field from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-getter-on-nested-class.js
new file mode 100644
index 0000000000..7e62f99a8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-getter-on-nested-class.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-field-shadowed-by-getter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static field can be shadowed on inner classes by a private getter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class-static-fields-public, class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m = 'outer class';
+
+ static fieldAccess() {
+ return this.#m;
+ }
+
+ static B = class {
+ get #m() { return 'inner class'; }
+
+ static access(o) {
+ return o.#m;
+ }
+ }
+}
+
+assert.sameValue(C.fieldAccess(), 'outer class');
+
+let b = new C.B();
+
+assert.sameValue(C.B.access(b), 'inner class');
+
+assert.throws(TypeError, function() {
+ C.B.access(C);
+}, 'accessed private getter from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-method-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-method-on-nested-class.js
new file mode 100644
index 0000000000..a78214d76e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-method-on-nested-class.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-field-shadowed-by-method-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static field can be shadowed on inner classes by a private method (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class-static-fields-public, class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m = () => 'outer class';
+
+ static fieldAccess() {
+ return this.#m();
+ }
+
+ static B = class {
+ #m() { return 'inner class'; }
+
+ static access(o) {
+ return o.#m();
+ }
+ }
+}
+
+assert.sameValue(C.fieldAccess(), 'outer class');
+
+let b = new C.B();
+
+assert.sameValue(C.B.access(b), 'inner class');
+
+assert.throws(TypeError, function() {
+ C.B.access(C);
+}, 'accessed private method from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-setter-on-nested-class.js
new file mode 100644
index 0000000000..f72c5b519e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-field-shadowed-by-setter-on-nested-class.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-field-shadowed-by-setter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static field can be shadowed on inner classes by a private setter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class-static-fields-public, class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m = 'outer class';
+
+ static fieldAccess() {
+ return this.#m;
+ }
+
+ static B = class {
+ set #m(v) { this._v = v; }
+
+ static access(o) {
+ o.#m = 'inner class';
+ }
+ }
+}
+
+assert.sameValue(C.fieldAccess(), 'outer class');
+
+let b = new C.B();
+
+C.B.access(b);
+assert.sameValue(b._v, 'inner class');
+
+assert.throws(TypeError, function() {
+ C.B.access(C);
+}, 'accessed private setter from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-field-usage-inside-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-field-usage-inside-nested-class.js
new file mode 100644
index 0000000000..181a88af67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-field-usage-inside-nested-class.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-field-usage-inside-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static field is available inside inner classes (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class-static-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m = 'outer class';
+
+ static B = class {
+ static fieldAccess(o) {
+ return o.#m;
+ }
+ }
+}
+
+assert.sameValue(C.B.fieldAccess(C), 'outer class');
+assert.throws(TypeError, function() {
+ C.B.methodAccess(C.B);
+}, 'accessed static private field from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-field-visible-to-direct-eval.js b/js/src/tests/test262/language/statements/class/elements/private-static-field-visible-to-direct-eval.js
new file mode 100644
index 0000000000..68a0debf28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-field-visible-to-direct-eval.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private static field is visible to direct eval code
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-static-fields-private, class]
+---*/
+
+class C {
+ static #m = 44;
+
+ static getWithEval() {
+ return eval("this.#m");
+ }
+}
+
+class D {
+ static #m = 44;
+}
+
+assert.sameValue(C.getWithEval(), 44);
+
+assert.throws(TypeError, function() {
+ C.getWithEval.call(D);
+}, "invalid access to a private field");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-generator-method-name.js b/js/src/tests/test262/language/statements/class/elements/private-static-generator-method-name.js
new file mode 100644
index 0000000000..8fd8d86c02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-generator-method-name.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-generator-method-name.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private static generator methods have name property properly configured (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement : MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
+
+ ClassElement : static MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static".
+
+ GeneratorMethod : * ClassElementName (UniqueFormalParameters) { GeneratorBody }
+ ...
+ 12. Perform ? DefineOrdinaryMethod(key, homeObject, closure, _enumerable).
+
+ ClassElement : MethodDefinition
+ ClassElement : static MethodDefinition
+ 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
+ 2. Return empty.
+
+ ClassElementName : PrivateIdentifier
+ 1. Let bindingName be StringValue of PrivateIdentifier.
+ ...
+ 5. If scopeEnvRec's binding for bindingName is uninitialized,
+ a. Let field be NewPrivateName(bindingName).
+ b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
+ 6. Otherwise,
+ a. Let field be scopeEnvRec.GetBindingValue(bindingName).
+ 7. Assert: field.[[Description]] is bindingName.
+ 8. Return field.
+
+ DefineOrdinaryMethod(key, homeObject, closure, enumerable)
+ 1. Perform SetFunctionName(closure, key).
+ 2. If key is a Private Name,
+ a. Assert: key does not have a [[Kind]] field.
+ b. Set key.[[Kind]] to "method".
+ c. Set key.[[Value]] to closure.
+ d. Set key.[[Brand]] to homeObject.
+ 3. Else,
+ a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
+
+---*/
+
+
+class C {
+ static * #method() {};
+
+ static getPrivateMethod() {
+ return this.#method;
+ }
+}
+
+assert.sameValue(C.getPrivateMethod().name, "#method");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-getter-abrupt-completition.js b/js/src/tests/test262/language/statements/class/elements/private-static-getter-abrupt-completition.js
new file mode 100644
index 0000000000..fc0b9f42dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-getter-abrupt-completition.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateFieldGet should return an abrupt completion
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+features: [class-methods-private, class]
+---*/
+
+class C {
+ get #m() {
+ throw new Test262Error();
+ }
+
+ access() {
+ this.#m;
+ }
+}
+
+let c = new C();
+assert.throws(Test262Error, function() {
+ c.access();
+}, 'private getter should have abrupt completion');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-getter-visible-to-direct-eval.js b/js/src/tests/test262/language/statements/class/elements/private-static-getter-visible-to-direct-eval.js
new file mode 100644
index 0000000000..180d624623
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-getter-visible-to-direct-eval.js
@@ -0,0 +1,63 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private static getter is visible to direct eval code
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-static-methods-private, class]
+---*/
+
+class C {
+ static get #m() {
+ return 'Test262';
+ }
+
+ static getWithEval() {
+ return eval('this.#m');
+ }
+}
+
+class D {
+ static get #m() {
+ throw new Test262Error('should never be executed');
+ }
+}
+
+assert.sameValue(C.getWithEval(), 'Test262');
+
+assert.throws(TypeError, function() {
+ C.getWithEval.call(D);
+}, 'invalid access to a static private getter');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-method-length.js b/js/src/tests/test262/language/statements/class/elements/private-static-method-length.js
new file mode 100644
index 0000000000..b18f48e6ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-method-length.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-method-length.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private static methods have length property properly configured (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement : MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
+
+ ClassElement : static MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static".
+
+ MethodDefinition : ClassElementName( UniqueFormalParameters ) { FunctionBody }
+ 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
+ 2. ReturnIfAbrupt(methodDef).
+ 3. Perform ? DefineOrdinaryMethod(methodDef.[[Key]], homeObject, methodDef.[[Closure]], _enumerable).
+
+ ClassElement : MethodDefinition
+ ClassElement : static MethodDefinition
+ 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
+ 2. Return empty.
+
+ MethodDefinition : ClassElementName (UniqueFormalParameters) { FunctionBody }
+ ...
+ 8. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, scope, privateScope, strict, prototype).
+ 9. Perform MakeMethod(closure, object).
+ 10. Return the Record{[[Key]]: propKey, [[Closure]]: closure}.
+
+---*/
+
+
+class C {
+ static #method(a, b, c) {};
+
+ static getPrivateMethod() {
+ return this.#method;
+ }
+
+}
+
+assert.sameValue(C.getPrivateMethod().length, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-method-name.js b/js/src/tests/test262/language/statements/class/elements/private-static-method-name.js
new file mode 100644
index 0000000000..cafb88ff0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-method-name.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-method-name.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private static methods have name property properly configured (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement : MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
+
+ ClassElement : static MethodDefinition
+ 1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static".
+
+ MethodDefinition : ClassElementName( UniqueFormalParameters ) { FunctionBody }
+ 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
+ 2. ReturnIfAbrupt(methodDef).
+ 3. Perform ? DefineOrdinaryMethod(methodDef.[[Key]], homeObject, methodDef.[[Closure]], _enumerable).
+
+ ClassElement : MethodDefinition
+ ClassElement : static MethodDefinition
+ 1. Perform ? PropertyDefinitionEvaluation with parameters object and enumerable.
+ 2. Return empty.
+
+ MethodDefinition : ClassElementName (UniqueFormalParameters) { FunctionBody }
+ 1. Let propKey be the result of evaluating ClassElementName.
+ ...
+ 8. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, scope, privateScope, strict, prototype).
+ 9. Perform MakeMethod(closure, object).
+ 10. Return the Record{[[Key]]: propKey, [[Closure]]: closure}.
+
+ ClassElementName : PrivateIdentifier
+ 1. Let bindingName be StringValue of PrivateIdentifier.
+ ...
+ 5. If scopeEnvRec's binding for bindingName is uninitialized,
+ a. Let field be NewPrivateName(bindingName).
+ b. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
+ 6. Otherwise,
+ a. Let field be scopeEnvRec.GetBindingValue(bindingName).
+ 7. Assert: field.[[Description]] is bindingName.
+ 8. Return field.
+
+ DefineOrdinaryMethod(key, homeObject, closure, enumerable)
+ 1. Perform SetFunctionName(closure, key).
+ 2. If key is a Private Name,
+ a. Assert: key does not have a [[Kind]] field.
+ b. Set key.[[Kind]] to "method".
+ c. Set key.[[Value]] to closure.
+ d. Set key.[[Brand]] to homeObject.
+ 3. Else,
+ a. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
+
+---*/
+
+
+class C {
+ static #method() {
+ return 'Test262';
+ };
+
+ static getPrivateMethod() {
+ return this.#method;
+ }
+
+}
+
+assert.sameValue(C.getPrivateMethod().name, "#method");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-method-not-writable.js b/js/src/tests/test262/language/statements/class/elements/private-static-method-not-writable.js
new file mode 100644
index 0000000000..ce0d1f9cd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-method-not-writable.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Throws TypeError when attempting to overwrite a private static method.
+esid: sec-privateset
+info: |
+ 7.3.30 PrivateSet ( P, O, value )
+ 1. Let entry be ! PrivateElementFind(P, O).
+ 2. If entry is empty, throw a TypeError exception.
+ 3. If entry.[[Kind]] is field, then
+ ...
+ 4. Else if entry.[[Kind]] is method, then
+ a. Throw a TypeError exception.
+ 5. ...
+
+features: [class, class-static-methods-private]
+---*/
+
+class C {
+ static #m() {}
+
+ static assign() {
+ this.#m = 0;
+ }
+}
+
+assert.throws(TypeError, function() {
+ C.assign();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-field-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-field-on-nested-class.js
new file mode 100644
index 0000000000..53efd583e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-field-on-nested-class.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-method-shadowed-by-field-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static method can be shadowed on inner classes by a private field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-public, class-fields-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m() { return 'outer class'; }
+
+ static methodAccess() {
+ return this.#m();
+ }
+
+ static B = class {
+ #m = 'inner class';
+ static fieldAccess(o) {
+ return o.#m;
+ }
+ }
+}
+
+assert.sameValue(C.methodAccess(), 'outer class');
+
+let b = new C.B();
+
+assert.sameValue(C.B.fieldAccess(b), 'inner class');
+
+assert.throws(TypeError, function() {
+ C.B.fieldAccess(C);
+}, 'accessed private field from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-getter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-getter-on-nested-class.js
new file mode 100644
index 0000000000..f7ad4de011
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-getter-on-nested-class.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-method-shadowed-by-getter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static method can be shadowed on inner classes by a private getter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-public, class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m() { return 'outer class'; }
+
+ static methodAccess() {
+ return this.#m();
+ }
+
+ static B = class {
+ get #m() { return 'inner class'; }
+
+ static access(o) {
+ return o.#m;
+ }
+ }
+}
+
+assert.sameValue(C.methodAccess(), 'outer class');
+
+let b = new C.B();
+
+assert.sameValue(C.B.access(b), 'inner class');
+
+assert.throws(TypeError, function() {
+ C.B.access(C);
+}, 'accessed private getter from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-method-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-method-on-nested-class.js
new file mode 100644
index 0000000000..6f48d6514e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-method-on-nested-class.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-method-shadowed-by-method-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static method can be shadowed on inner classes by a private method (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-public, class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m() { return 'outer class'; }
+
+ static methodAccess() {
+ return this.#m();
+ }
+
+ static B = class {
+ #m() { return 'inner class'; }
+
+ static access(o) {
+ return o.#m();
+ }
+ }
+}
+
+assert.sameValue(C.methodAccess(), 'outer class');
+
+let b = new C.B();
+
+assert.sameValue(C.B.access(b), 'inner class');
+
+assert.throws(TypeError, function() {
+ C.B.access(C);
+}, 'accessed private method from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-setter-on-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-setter-on-nested-class.js
new file mode 100644
index 0000000000..47497485d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-method-shadowed-by-setter-on-nested-class.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-method-shadowed-by-setter-on-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static method can be shadowed on inner classes by a private setter (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-public, class-methods-private, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m() { return 'outer class'; }
+
+ static methodAccess() {
+ return this.#m();
+ }
+
+ static B = class {
+ set #m(v) { this._v = v; }
+
+ static access(o) {
+ o.#m = 'inner class';
+ }
+ }
+}
+
+assert.sameValue(C.methodAccess(), 'outer class');
+
+let b = new C.B();
+
+C.B.access(b);
+assert.sameValue(b._v, 'inner class');
+
+assert.throws(TypeError, function() {
+ C.B.access(C);
+}, 'accessed private setter from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-method-usage-inside-nested-class.js b/js/src/tests/test262/language/statements/class/elements/private-static-method-usage-inside-nested-class.js
new file mode 100644
index 0000000000..3bbf3d5462
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-method-usage-inside-nested-class.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-static-method-usage-inside-nested-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: PrivateName of private static method is available inside inner classes (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateIdentifier
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ ...
+ 15. Set the running execution context's LexicalEnvironment to classScope.
+ 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment.
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ FieldDefinition : ClassElementName Initializer_opt
+ 1. Let name be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(name).
+ 3. If Initializer_opt is present,
+ a. Let lex be the Lexical Environment of the running execution context.
+ b. Let formalParameterList be an instance of the production FormalParameters : [empty].
+ c. Let privateScope be the PrivateEnvironment of the running execution context.
+ d. Let initializer be FunctionCreate(Method, formalParameterList, Initializer, lex, true, privateScope).
+ e. Perform MakeMethod(initializer, homeObject).
+ f. Let isAnonymousFunctionDefinition be IsAnonymousFunctionDefinition(Initializer).
+ 4. Else,
+ a. Let initializer be empty.
+ b. Let isAnonymousFunctionDeclaration be false.
+ 5. Return a Record { [[Name]]: name, [[Initializer]]: initializer, [[IsAnonymousFunctionDefinition]]: isAnonymousFunctionDefinition }.
+
+ MemberExpression : MemberExpression.PrivateIdentifier
+ 1. Let baseReference be the result of evaluating MemberExpression.
+ 2. Let baseValue be ? GetValue(baseReference).
+ 3. Let bv be ? RequireObjectCoercible(baseValue).
+ 4. Let fieldNameString be the StringValue of PrivateIdentifier.
+ 5. Return MakePrivateReference(bv, fieldNameString).
+
+ MakePrivateReference(baseValue, privateIdentifier)
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+
+---*/
+
+
+class C {
+ static #m() {
+ return 'outer class';
+ }
+
+ static B = class {
+ static methodAccess(o) {
+ return o.#m();
+ }
+ }
+}
+
+assert.sameValue(C.B.methodAccess(C), 'outer class');
+assert.throws(TypeError, function() {
+ C.B.methodAccess(C.B);
+}, 'accessed static private method from an arbritary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-method-visible-to-direct-eval.js b/js/src/tests/test262/language/statements/class/elements/private-static-method-visible-to-direct-eval.js
new file mode 100644
index 0000000000..01d010c80f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-method-visible-to-direct-eval.js
@@ -0,0 +1,63 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private static method is visible to direct eval code
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-static-methods-private, class]
+---*/
+
+class C {
+ static #m() {
+ return "Test262";
+ }
+
+ static accessWithEval() {
+ return eval("this.#m()");
+ }
+}
+
+class D {
+ static #m() {
+ throw new Test262Error();
+ }
+}
+
+assert.sameValue(C.accessWithEval(), "Test262");
+
+assert.throws(TypeError, function() {
+ C.accessWithEval.call(D);
+}, "invalid access to a private field");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-setter-abrupt-completition.js b/js/src/tests/test262/language/statements/class/elements/private-static-setter-abrupt-completition.js
new file mode 100644
index 0000000000..14afc2640f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-setter-abrupt-completition.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateFieldSet should return an abrupt completion
+esid: sec-privatefieldset
+info: |
+ PrivateFieldSet (P, O, value)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Set entry.[[PrivateFieldValue]] to value.
+ d. Return.
+ 4. If P.[[Kind]] is "method", throw a TypeError exception.
+ 5. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If O.[[PrivateFieldBrands]] does not contain P.[[Brand]], throw a TypeError exception.
+ c. If P does not have a [[Set]] field, throw a TypeError exception.
+ d. Let setter be P.[[Set]].
+ e. Perform ? Call(setter, O, value).
+ f. Return.
+features: [class-methods-private, class]
+---*/
+
+class C {
+ set #m(_) {
+ throw new Test262Error();
+ }
+
+ access() {
+ this.#m = 'Test262';
+ }
+}
+
+let c = new C();
+assert.throws(Test262Error, function() {
+ c.access();
+}, 'private setter should have abrupt completion');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-static-setter-visible-to-direct-eval.js b/js/src/tests/test262/language/statements/class/elements/private-static-setter-visible-to-direct-eval.js
new file mode 100644
index 0000000000..e4205b729d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-static-setter-visible-to-direct-eval.js
@@ -0,0 +1,64 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private static setter is visible to direct eval code
+esid: sec-privatefieldget
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Return entry.[[PrivateFieldValue]].
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ ClassElementName : PrivateIdentifier
+ 1. Let privateIdentifier be StringValue of PrivateIdentifier.
+ 2. Let privateName be NewPrivateName(privateIdentifier).
+ 3. Let scope be the running execution context's PrivateEnvironment.
+ 4. Let scopeEnvRec be scope's EnvironmentRecord.
+ 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName).
+ 6. Return privateName.
+
+ MakePrivateReference ( baseValue, privateIdentifier )
+ 1. Let env be the running execution context's PrivateEnvironment.
+ 2. Let privateNameBinding be ? ResolveBinding(privateIdentifier, env).
+ 3. Let privateName be GetValue(privateNameBinding).
+ 4. Assert: privateName is a Private Name.
+ 5. Return a value of type Reference whose base value is baseValue, whose referenced name is privateName, whose strict reference flag is true.
+features: [class-static-methods-private, class]
+---*/
+
+class C {
+ static set #m(v) {
+ this._v = v;
+ }
+
+ static setWithEval() {
+ eval('this.#m = "Test262"');
+ }
+}
+
+class D {
+ static set #m(v) {
+ throw new Test262Error('should never be called');
+ }
+}
+
+C.setWithEval();
+assert.sameValue(C._v, 'Test262');
+
+assert.throws(TypeError, function() {
+ C.getWithEval.call(D);
+}, 'invalid access to a static private getter');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/private-ternary-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/private-ternary-init-err-contains-arguments.js
new file mode 100644
index 0000000000..3d409fceb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-ternary-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-ternary.template
+/*---
+description: Syntax error if `arguments` used in class field (private field, ternary expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = false ? {} : arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/private-ternary-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/private-ternary-init-err-contains-super.js
new file mode 100644
index 0000000000..4f82a572ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-ternary-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-ternary.template
+/*---
+description: Syntax error if `super()` used in class field (private field, ternary expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = false ? {} : super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/private-typeof-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/private-typeof-init-err-contains-arguments.js
new file mode 100644
index 0000000000..b2a0a1fe0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-typeof-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-typeof.template
+/*---
+description: Syntax error if `arguments` used in class field (private field, typeof expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = typeof arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/private-typeof-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/private-typeof-init-err-contains-super.js
new file mode 100644
index 0000000000..d3ab2de187
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/private-typeof-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-private-typeof.template
+/*---
+description: Syntax error if `super()` used in class field (private field, typeof expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = typeof super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefield-on-proxy.js b/js/src/tests/test262/language/statements/class/elements/privatefield-on-proxy.js
new file mode 100644
index 0000000000..0fa28efac7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefield-on-proxy.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2019 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Sucessyfully get private reference without using [[Get]]
+esid: sec-getvalue
+info: |
+ GetValue(V)
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+ c. Return ? base.[[Get]](GetReferencedName(V), GetThisValue(V)).
+ PrivateFieldGet(P, O)
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+ 5. Return entry.[[PrivateFieldValue]].
+includes: [compareArray.js]
+features: [class, class-fields-private, Proxy]
+---*/
+
+let arr = [];
+
+class ProxyBase {
+ constructor() {
+ return new Proxy(this, {
+ get: function (obj, prop) {
+ arr.push(prop);
+ return obj[prop];
+ }
+ });
+ }
+}
+
+class Test extends ProxyBase {
+ #f = 3;
+ method() {
+ return this.#f;
+ }
+}
+
+let t = new Test();
+let r = t.method();
+assert.sameValue(r, 3);
+
+assert.compareArray(arr, ['method']);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldadd-typeerror.js b/js/src/tests/test262/language/statements/class/elements/privatefieldadd-typeerror.js
new file mode 100644
index 0000000000..6bd7feb092
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldadd-typeerror.js
@@ -0,0 +1,63 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Class construction should error if attempting to add private field twice
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+info: |
+ [[Construct]] ( argumentsList, newTarget)
+ ...
+ 8. If kind is "base", then
+ a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ c. If result is an abrupt completion, then
+ i. Remove calleeContext from execution context stack and restore callerContext as the running execution context.
+ ii. Return Completion(result).
+
+ InitializeInstanceFields ( O, constructor )
+ 1. Assert: Type ( O ) is Object.
+ 2. Assert: Assert constructor is an ECMAScript function object.
+ 3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
+ 4. For each item fieldRecord in order from fieldRecords,
+ a. Perform ? DefineField(O, fieldRecord).
+ 5. Return.
+
+ DefineField(receiver, fieldRecord)
+ ...
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+
+ PrivateFieldAdd (P, O, value)
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is not empty, throw a TypeError exception.
+ ...
+
+features: [class, class-fields-private]
+---*/
+
+
+class A {
+ constructor(arg) {
+ return arg;
+ }
+}
+
+class C extends A {
+ #x;
+
+ constructor(arg) {
+ super(arg);
+ }
+}
+
+var containsprivatex = new C();
+
+assert.throws(TypeError, function() {
+ // After the super call in C's constructor, the `this` value in C will
+ // already have "#x" in it's [[PrivateFieldValues]]
+ new C(containsprivatex);
+})
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-primitive-receiver.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-primitive-receiver.js
new file mode 100644
index 0000000000..2b56307e8c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-primitive-receiver.js
@@ -0,0 +1,78 @@
+// Copyright (C) 2020 Caio Lima (Igalia S.L). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateField calls ToObject when receiver is a primitive
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ a. If HasPrimitiveBase(V), then
+ i. Assert: In this case, base will never be null or undefined.
+ ii. Let base be ToObject(base).
+ b. If IsPrivateReference(V), then
+ i. Return ? PrivateFieldGet(field, base).
+ ...
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+ 5. Return entry.[[PrivateFieldValue]].
+
+features: [class, class-fields-private, BigInt]
+---*/
+
+let count = 0;
+
+class C {
+ #p = 1;
+
+ method() {
+ count++;
+ try {
+ count++;
+ this.#p;
+ } catch (e) {
+ count++;
+ if (e instanceof TypeError) {
+ throw new Test262Error();
+ }
+ }
+ }
+}
+
+assert.throws(Test262Error, () => {
+ new C().method.call(15);
+});
+assert.sameValue(count, 3);
+
+assert.throws(Test262Error, () => {
+ new C().method.call('Test262');
+});
+assert.sameValue(count, 6);
+
+assert.throws(Test262Error, () => {
+ new C().method.call(Symbol('Test262'));
+});
+assert.sameValue(count, 9);
+
+assert.throws(Test262Error, () => {
+ new C().method.call(15n);
+});
+assert.sameValue(count, 12);
+
+assert.throws(Test262Error, () => {
+ new C().method.call(null);
+});
+assert.sameValue(count, 15);
+
+assert.throws(Test262Error, () => {
+ new C().method.call(undefined);
+});
+assert.sameValue(count, 18);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-1.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-1.js
new file mode 100644
index 0000000000..c53b93740c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-1.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Successfully access private field
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+ 5. Return entry.[[PrivateFieldValue]].
+
+features: [class, class-fields-private]
+---*/
+
+class Outer {
+ #x = 42;
+
+ innerclass() {
+ var self = this;
+
+ return class extends Outer {
+ f() {
+ return self.#x;
+ }
+ }
+ }
+}
+
+var Inner = new Outer().innerclass();
+var i = new Inner();
+var value = i.f();
+
+assert.sameValue(value, 42)
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-2.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-2.js
new file mode 100644
index 0000000000..e839d3594e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-2.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Successfully access private field
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+ 5. Return entry.[[PrivateFieldValue]].
+
+features: [class, class-fields-private]
+---*/
+
+
+class A {
+ #x = 'Avalue';
+ x() {
+ return this.#x;
+ }
+}
+class B extends A {
+ #x = 'Bvalue';
+ x() {
+ return this.#x;
+ }
+}
+
+var b = new B();
+
+assert.sameValue(b.x(), 'Bvalue')
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-3.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-3.js
new file mode 100644
index 0000000000..73bcffa0cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-3.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Successfully access private field
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+ 5. Return entry.[[PrivateFieldValue]].
+
+features: [class, class-fields-private]
+---*/
+
+
+class A {
+ #x = 'Avalue';
+ x() {
+ return this.#x;
+ }
+}
+class B extends A {
+ #x = 'Bvalue';
+}
+
+var b = new B();
+
+assert.sameValue(b.x(), 'Avalue')
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-4.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-4.js
new file mode 100644
index 0000000000..9ba095942e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-4.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Successfully access private field
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+ 5. Return entry.[[PrivateFieldValue]].
+
+features: [class, class-fields-private]
+---*/
+
+
+class A {
+ #x = 'Avalue';
+ x() {
+ return this.#x;
+ }
+}
+class B extends A {
+}
+
+var b = new B();
+
+assert.sameValue(b.x(), 'Avalue')
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-5.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-5.js
new file mode 100644
index 0000000000..3863cefd40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-success-5.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Successfully access private field
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+ 5. Return entry.[[PrivateFieldValue]].
+
+features: [class, class-fields-private]
+---*/
+
+
+class C {
+ #x = 42;
+ f() {
+ return this.#x;
+ }
+}
+
+var c1 = new C();
+var c2 = new C();
+var value = c2.f.call(c1);
+
+assert.sameValue(value, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-1.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-1.js
new file mode 100644
index 0000000000..69f6e48525
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-1.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Cannot access private field before the entry was added to [[PrivateFieldValues]]
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private, class-fields-public]
+---*/
+
+class C {
+ y = this.#x;
+ #x;
+}
+
+assert.throws(TypeError, function() { new C(); })
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-2.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-2.js
new file mode 100644
index 0000000000..1a36416cfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-2.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: TypeError when referenced private field cannot be found in `this`'s [[PrivateFieldValues]]
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class Outer {
+ #x = 42;
+
+ innerclass() {
+
+ // create class within in Outerclass -- the PrivateNameEnvironment binding for
+ // private field `#x` is resolvable.
+ return class {
+ f() {
+ return this.#x;
+ }
+ }
+ }
+}
+
+var Inner = new Outer().innerclass();
+var i = new Inner();
+
+assert.throws(TypeError, function() {
+ // when f() is called, the private field will not be found in Inner's `this`
+ i.f();
+})
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-3.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-3.js
new file mode 100644
index 0000000000..979a4c263a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-3.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Referenced lexically scoped private field found in `this`'s [[PrivateFieldValues]]
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class Outer {
+ #x = 42;
+
+ innerclass() {
+
+ // create class within in Outerclass -- the PrivateNameEnvironment binding for
+ // private field `#x` is resolvable.
+ return class extends Outer {
+ f() {
+ return this.#x;
+ }
+ }
+ }
+}
+
+var Inner = new Outer().innerclass();
+var i = new Inner();
+
+assert.sameValue(i.f(), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-4.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-4.js
new file mode 100644
index 0000000000..878296ac4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-4.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: TypeError when referenced private field cannot be found in `this`'s [[PrivateFieldValues]]
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+function classfactory() {
+ return class {
+ #x;
+ f() {
+ this.#x;
+ }
+ }
+}
+
+var C1 = classfactory();
+var C2 = classfactory();
+
+var c1 = new C1();
+var c2 = new C2();
+
+assert.throws(TypeError, function() {
+ // when f() is called in class C1, the Private Name binding for #x in C1 will
+ // not found in C2's [[PrivateNameValues]]
+ c1.f.call(c2);
+})
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-5.js b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-5.js
new file mode 100644
index 0000000000..11eb32250d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldget-typeerror-5.js
@@ -0,0 +1,60 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: TypeError when referenced private field cannot be found in `this`'s [[PrivateFieldValues]]
+esid: sec-getvalue
+info: |
+ GetValue ( V )
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+
+ PrivateFieldGet (P, O )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class Outer {
+ #x = 42;
+
+ innerclass() {
+ var self = this;
+
+ return class extends Outer {
+ #x = 'not42';
+ f() {
+ return self.#x;
+ }
+ }
+ }
+}
+
+var Inner = new Outer().innerclass();
+var i = new Inner();
+
+assert.throws(TypeError, function() {
+ // when f() is called, the entry in the PrivateNameEnironment's environment
+ // record for '#x' will contain the Inner class's Private Name for '#x'.
+ // When this Private Name is used for lookup on the `self` object, it
+ // will not be found (as the `self` object has the Outer's Private Name for #x)
+ i.f();
+})
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldput-primitive-receiver.js b/js/src/tests/test262/language/statements/class/elements/privatefieldput-primitive-receiver.js
new file mode 100644
index 0000000000..13f25a19b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldput-primitive-receiver.js
@@ -0,0 +1,78 @@
+// Copyright (C) 2020 Caio Lima (Igalia S.L). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: PrivateField calls ToObject when receiver is a primitive
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. If IsPropertyReference(V), then
+ a. If HasPrimitiveBase(V), then
+ i. Assert: In this case, base will never be null or undefined.
+ ii. Let base be ToObject(base).
+ b. If IsPrivateReference(V), then
+ i. Return ? PrivateFieldSet(field, base, W).
+ ...
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name.
+ 2. Assert: Type(O) is Object.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+ 5. Set entry.[[PrivateFieldValue]] to value.
+
+features: [class, class-fields-private, BigInt]
+---*/
+
+let count = 0;
+
+class C {
+ #p = 1;
+
+ method(v) {
+ count++;
+ try {
+ count++;
+ this.#p = v;
+ } catch (e) {
+ count++;
+ if (e instanceof TypeError) {
+ throw new Test262Error();
+ }
+ }
+ }
+}
+
+assert.throws(Test262Error, () => {
+ new C().method.call(15, 0);
+});
+assert.sameValue(count, 3);
+
+assert.throws(Test262Error, () => {
+ new C().method.call('Test262', 0);
+});
+assert.sameValue(count, 6);
+
+assert.throws(Test262Error, () => {
+ new C().method.call(Symbol('Test262'), 0);
+});
+assert.sameValue(count, 9);
+
+assert.throws(Test262Error, () => {
+ new C().method.call(15n, 0);
+});
+assert.sameValue(count, 12);
+
+assert.throws(Test262Error, () => {
+ new C().method.call(null, 0);
+});
+assert.sameValue(count, 15);
+
+assert.throws(Test262Error, () => {
+ new C().method.call(undefined, 0);
+});
+assert.sameValue(count, 18);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-1.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-1.js
new file mode 100644
index 0000000000..b9d1a0944f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-1.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluation order when resolving private fields.
+esid: sec-runtime-semantics-keyeddestructuringassignmentevaluation
+info: |
+ 13.15.5.6 Runtime Semantics: KeyedDestructuringAssignmentEvaluation
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+ 2. ...
+
+ 9.1.1.3.4 GetThisBinding ( )
+ 1. Assert: envRec.[[ThisBindingStatus]] is not lexical.
+ 2. If envRec.[[ThisBindingStatus]] is uninitialized, throw a ReferenceError exception.
+ 3. ...
+
+features: [class, class-fields-private]
+---*/
+
+class C extends class {} {
+ #field;
+
+ constructor() {
+ var init = () => super();
+
+ var object = {
+ get a() {
+ init();
+ }
+ };
+
+ // Accessing |this| should throw a ReferenceError before there's an attempt
+ // to invoke the getter.
+ ({a: this.#field} = object);
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-2.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-2.js
new file mode 100644
index 0000000000..adacf20da5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-2.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluation order when resolving private fields.
+esid: sec-runtime-semantics-keyeddestructuringassignmentevaluation
+info: |
+ 13.15.5.6 Runtime Semantics: KeyedDestructuringAssignmentEvaluation
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+ 2. Let v be ? GetV(value, propertyName).
+ 3. ...
+
+features: [class, class-fields-private]
+---*/
+
+class C {
+ #field;
+
+ m() {
+ var object = {
+ get a() {
+ throw new Test262Error();
+ }
+ };
+
+ // The getter is executed before the check if the private field is present.
+ ({a: this.#field} = object);
+ }
+}
+
+assert.throws(Test262Error, function() {
+ C.prototype.m.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-3.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-3.js
new file mode 100644
index 0000000000..8a56632f36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-evaluation-order-3.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluation order when resolving private fields.
+esid: sec-runtime-semantics-keyeddestructuringassignmentevaluation
+info: |
+ 13.15.5.6 Runtime Semantics: KeyedDestructuringAssignmentEvaluation
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+ 2. Let v be ? GetV(value, propertyName).
+ 3. ...
+
+features: [class, class-fields-private]
+---*/
+
+class Base {
+ constructor(o) {
+ return o;
+ }
+}
+
+class C extends Base {
+ #field;
+
+ m() {
+ var init = () => new C(this);
+
+ var object = {
+ get a() {
+ init();
+
+ return "pass";
+ }
+ };
+
+ ({a: this.#field} = object);
+
+ assert.sameValue(this.#field, "pass");
+ }
+}
+
+C.prototype.m.call({});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-1.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-1.js
new file mode 100644
index 0000000000..1bcbb433ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-1.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: TypeError when setting private field before the entry was added to [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private, class-fields-public]
+---*/
+
+class C {
+ y = this.#x = 1;
+ #x;
+}
+
+assert.throws(TypeError, function() { new C(); })
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-10.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-10.js
new file mode 100644
index 0000000000..4057039735
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-10.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ TypeError when setting private field not in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class C {
+ #field;
+
+ m() {
+ [...this.#field] = [];
+ }
+}
+
+assert.throws(TypeError, function() {
+ C.prototype.m.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-11.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-11.js
new file mode 100644
index 0000000000..2ce9e2b796
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-11.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ TypeError when setting private field not in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class C {
+ #field;
+
+ m() {
+ ({...this.#field} = {});
+ }
+}
+
+assert.throws(TypeError, function() {
+ C.prototype.m.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-2.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-2.js
new file mode 100644
index 0000000000..f1e389ef3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-2.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: TypeError when setting private field not in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class Outer {
+ #x = 42;
+
+ innerclass() {
+
+ // create class within in Outerclass -- the PrivateNameEnvironment binding for
+ // private field `#x` is resolvable.
+ return class {
+ f() {
+ this.#x = 1;
+ }
+ }
+ }
+}
+
+var Inner = new Outer().innerclass();
+var i = new Inner();
+
+assert.throws(TypeError, function() {
+ // when f() is called, the private field will not be found in Inner's `this`
+ i.f();
+})
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-3.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-3.js
new file mode 100644
index 0000000000..600c76567e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-3.js
@@ -0,0 +1,66 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Referenced lexically scoped private field found in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class Outer {
+ #x = 42;
+
+ innerclass() {
+
+ // create class within in Outerclass -- the PrivateNameEnvironment binding for
+ // private field `#x` is resolvable.
+ return class extends Outer {
+ f() {
+ this.#x = 1;
+ }
+ }
+ }
+
+ value() {
+ return this.#x;
+ }
+}
+
+var outer = new Outer();
+var Inner = outer.innerclass();
+var i = new Inner();
+
+assert.sameValue(outer.value(), 42);
+assert.sameValue(i.value(), 42);
+
+i.f();
+
+assert.sameValue(outer.value(), 42, "value is set on inner class instance only");
+assert.sameValue(i.value(), 1, "value is set from inner class instance");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-4.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-4.js
new file mode 100644
index 0000000000..5041bf15df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-4.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: TypeError when setting private field not in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+function classfactory() {
+ return class {
+ #x;
+ f() {
+ this.#x = 1;
+ }
+ }
+}
+
+var C1 = classfactory();
+var C2 = classfactory();
+
+var c1 = new C1();
+var c2 = new C2();
+
+assert.throws(TypeError, function() {
+ // when f() is called in class C1, the Private Name binding for #x in C1 will
+ // not found in C2's [[PrivateNameValues]]
+ c1.f.call(c2);
+})
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-5.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-5.js
new file mode 100644
index 0000000000..17d27ecbf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-5.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: TypeError when setting private field not in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+
+class Outer {
+ #x = 42;
+
+ innerclass() {
+ var self = this;
+
+ return class extends Outer {
+ #x = 'not42';
+ f() {
+ self.#x = 1;
+ }
+ }
+ }
+}
+
+var Inner = new Outer().innerclass();
+var i = new Inner();
+
+assert.throws(TypeError, function() {
+ // when f() is called, the entry in the PrivateNameEnironment's environment
+ // record for '#x' will contain the Inner class's Private Name for '#x'.
+ // When this Private Name is used for lookup on the `self` object, it
+ // will not be found (as the `self` object has the Outer's Private Name for #x)
+ i.f();
+})
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-6.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-6.js
new file mode 100644
index 0000000000..49d531ee7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-6.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ TypeError when setting private field not in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class C {
+ #field;
+
+ m() {
+ for (this.#field of [1]) ;
+ }
+}
+
+assert.throws(TypeError, function() {
+ C.prototype.m.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-7.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-7.js
new file mode 100644
index 0000000000..e2c0921bb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-7.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ TypeError when setting private field not in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class C {
+ #field;
+
+ m() {
+ for (this.#field in {a: 0}) ;
+ }
+}
+
+assert.throws(TypeError, function() {
+ C.prototype.m.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-8.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-8.js
new file mode 100644
index 0000000000..309e31663d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-8.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ TypeError when setting private field not in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class C {
+ #field;
+
+ m() {
+ [this.#field] = [1];
+ }
+}
+
+assert.throws(TypeError, function() {
+ C.prototype.m.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-9.js b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-9.js
new file mode 100644
index 0000000000..b39c3fc6a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatefieldset-typeerror-9.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ TypeError when setting private field not in `this`'s [[PrivateFieldValues]]
+esid: sec-putvalue
+info: |
+ PutValue ( V, W )
+ ...
+ 6. Else if IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Perform ? PrivateFieldSet(field, base, W).
+
+ PrivateFieldSet (P, O, value )
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+ PrivateFieldFind (P, O)
+ 1. Assert: P is a Private Name value.
+ 2. Assert: O is an object with a [[PrivateFieldValues]] internal slot.
+ 3. For each element entry in O.[[PrivateFieldValues]],
+ a. If entry.[[PrivateName]] is P, return entry.
+ 4. Return empty.
+
+features: [class, class-fields-private]
+---*/
+
+class C {
+ #field;
+
+ m() {
+ ({a: this.#field} = {a: 0});
+ }
+}
+
+assert.throws(TypeError, function() {
+ C.prototype.m.call({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privategetter-on-proxy.js b/js/src/tests/test262/language/statements/class/elements/privategetter-on-proxy.js
new file mode 100644
index 0000000000..4ea77939f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privategetter-on-proxy.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2019 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Successfully access private getter on Proxy objects without using [[Get]]
+esid: sec-getvalue
+info: |
+ GetValue(V)
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+ c. Return ? base.[[Get]](GetReferencedName(V), GetThisValue(V)).
+ PrivateFieldGet(P, O)
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ ...
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+includes: [compareArray.js]
+features: [class, class-methods-private, Proxy]
+---*/
+
+let arr = [];
+
+class ProxyBase {
+ constructor() {
+ return new Proxy(this, {
+ get: function (obj, prop) {
+ arr.push(prop);
+ return obj[prop];
+ }
+ });
+ }
+}
+
+class Test extends ProxyBase {
+ get #f() {
+ return 3;
+ }
+ method() {
+ return this.#f;
+ }
+}
+
+let t = new Test();
+let r = t.method();
+assert.sameValue(r, 3);
+
+assert.compareArray(arr, ['method']);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatemethods-on-proxy.js b/js/src/tests/test262/language/statements/class/elements/privatemethods-on-proxy.js
new file mode 100644
index 0000000000..d6aaabba64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatemethods-on-proxy.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2019 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Successfully access private method on Proxy objects without using [[Get]]
+esid: sec-getvalue
+info: |
+ GetValue(V)
+ ...
+ 5. If IsPropertyReference(V), then
+ ...
+ b. If IsPrivateReference(V), then
+ i. Let env be the running execution context's PrivateNameEnvironment.
+ ii. Let field be ? ResolveBinding(GetReferencedName(V), env).
+ iii. Assert: field is a Private Name.
+ iv. Return ? PrivateFieldGet(field, base).
+ c. Return ? base.[[Get]](GetReferencedName(V), GetThisValue(V)).
+ PrivateFieldGet(P, O)
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+includes: [compareArray.js]
+features: [class, class-methods-private, Proxy]
+---*/
+
+let arr = [];
+
+class ProxyBase {
+ constructor() {
+ return new Proxy(this, {
+ get: function (obj, prop) {
+ arr.push(prop);
+ return obj[prop];
+ }
+ });
+ }
+}
+
+class Test extends ProxyBase {
+ #f() {
+ return 3;
+ }
+ method() {
+ return this.#f();
+ }
+}
+
+let t = new Test();
+let r = t.method();
+assert.sameValue(r, 3);
+
+assert.compareArray(arr, ['method']);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-1.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-1.js
new file mode 100644
index 0000000000..9e13a856da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-1.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename in constructor without being declared in class fields
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ constructor() {
+ this.#x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-2.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-2.js
new file mode 100644
index 0000000000..415cd95d52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-2.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename in function in class without declaring in field
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ f() {
+ this.#x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-3.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-3.js
new file mode 100644
index 0000000000..4eef9588c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-3.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename that has not been declared in class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private, class-fields-public]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ y = this.#x;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-4.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-4.js
new file mode 100644
index 0000000000..6057d7051a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-4.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename that has not been declared in class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ f() {
+ this.#x;
+ class D extends C {
+ #x;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-5.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-5.js
new file mode 100644
index 0000000000..2c0120fc1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-5.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename outside of class
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+}
+
+new C().#x;
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-6.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-6.js
new file mode 100644
index 0000000000..833606797f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-6.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename outside of class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {}
+
+new C().#x;
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-7.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-7.js
new file mode 100644
index 0000000000..3b9aededd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-7.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename on object, outside of class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+obj = {};
+
+obj.#x;
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-8.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-8.js
new file mode 100644
index 0000000000..8b76cafa0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-earlyerr-script-8.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename on object, outside of class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ this.#x;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-1.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-1.js
new file mode 100644
index 0000000000..64623554fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-1.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename in constructor without being declared in class fields
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+---*/
+
+var executed = false;
+
+class C {
+ constructor() {
+ eval("executed = true; this.#x;");
+ }
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-2.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-2.js
new file mode 100644
index 0000000000..b3502625b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-2.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename in function in class without declaring in field
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+---*/
+
+var executed = false;
+
+class C {
+ f() {
+ eval("executed = true; this.#x;");
+ }
+}
+
+assert.throws(SyntaxError, function() {
+ new C().f();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-3.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-3.js
new file mode 100644
index 0000000000..1275505b59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-3.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename that has not been declared in class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private, class-fields-public]
+---*/
+
+var executed = false;
+
+class C {
+ y = eval("executed = true; this.#x;")
+}
+
+assert.throws(SyntaxError, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-4.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-4.js
new file mode 100644
index 0000000000..af441ae724
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-4.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename that has not been declared in class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+---*/
+
+var executed = false;
+
+class C {
+ f() {
+ eval("executed = true; this.#x;");
+ class D extends C {
+ #x;
+ }
+ }
+}
+
+assert.throws(SyntaxError, function() {
+ new C().f();
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-5.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-5.js
new file mode 100644
index 0000000000..ed05abfd60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-5.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename outside of class
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+---*/
+
+var executed = false;
+
+class C {
+ #x;
+}
+
+assert.throws(SyntaxError, function() {
+ eval("executed = true; new C().#x");
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-6.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-6.js
new file mode 100644
index 0000000000..54fa2cdc03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-6.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename outside of class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class, class-fields-private]
+---*/
+
+var executed = false;
+class C {}
+
+assert.throws(SyntaxError, function() {
+ eval("executed = true; new C().#x");
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-7.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-7.js
new file mode 100644
index 0000000000..879bcf646f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-7.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename on object, outside of class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class-fields-private]
+---*/
+
+var executed = false;
+var obj = {};
+
+assert.throws(SyntaxError, function() {
+ eval("executed = true; obj.#x;");
+});
+
+assert.sameValue(executed, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-8.js b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-8.js
new file mode 100644
index 0000000000..bb89e9ea39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-not-valid-eval-earlyerr-8.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-scripts-static-semantics-early-errors
+description: Early error when referencing privatename on object, outside of class.
+info: |
+ Static Semantics: Early Errors
+ ScriptBody : StatementList
+
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+features: [class-fields-private]
+---*/
+
+var executed = false;
+
+function f() {
+ eval("executed = true; this.#x;");
+}
+
+assert.throws(SyntaxError, function() {
+ f();
+});
+
+assert.sameValue(executed, false);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/privatename-valid-no-earlyerr.js b/js/src/tests/test262/language/statements/class/elements/privatename-valid-no-earlyerr.js
new file mode 100644
index 0000000000..4a63961a6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/privatename-valid-no-earlyerr.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-all-private-names-valid
+description: Referencing privatename in class within class does not error.
+info: |
+ Static Semantics: AllPrivateNamesValid
+
+ AllPrivateNamesValid is an abstract operation which takes names as an argument.
+
+ MemberExpression : MemberExpression . PrivateName
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements, passing in the names of the caller. If all pieces return true, then return true. If any returns false, return false.
+
+features: [class, class-fields-private]
+---*/
+
+class outer {
+ #x = 42;
+
+ f() {
+ var self = this;
+ return class inner {
+ g() {
+ return self.#x;
+ }
+ }
+ }
+}
+
+var innerclass = new outer().f();
+var test = new innerclass().g();
+
+assert.sameValue(test, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/prod-private-getter-before-super-return-in-constructor.js b/js/src/tests/test262/language/statements/class/elements/prod-private-getter-before-super-return-in-constructor.js
new file mode 100644
index 0000000000..00e7377707
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/prod-private-getter-before-super-return-in-constructor.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-getter-before-super-return-in-constructor.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private getters are installed "when super returns" and no earlier (call in constructor) (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ SuperCall: super Arguments
+ 1. Let newTarget be GetNewTarget().
+ 2. If newTarget is undefined, throw a ReferenceError exception.
+ 3. Let func be ? GetSuperConstructor().
+ 4. Let argList be ArgumentListEvaluation of Arguments.
+ 5. ReturnIfAbrupt(argList).
+ 6. Let result be ? Construct(func, argList, newTarget).
+ 7. Let thisER be GetThisEnvironment( ).
+ 8. Let F be thisER.[[FunctionObject]].
+ 9. Assert: F is an ECMAScript function object.
+ 10. Perform ? InitializeInstanceElements(result, F).
+
+ EDITOR'S NOTE:
+ Private fields are added to the object one by one, interspersed with
+ evaluation of the initializers, following the construction of the
+ receiver. These semantics allow for a later initializer to refer to
+ a previous private field.
+
+---*/
+
+
+class C {
+ constructor() {
+ this.f();
+ }
+
+}
+
+class D extends C {
+ f() { this.#m; }
+ get #m() { return 42; }
+}
+
+assert(D.prototype.hasOwnProperty('f'));
+assert.throws(TypeError, function() {
+ var d = new D();
+}, 'private getters are not installed before super returns');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/prod-private-getter-before-super-return-in-field-initializer.js b/js/src/tests/test262/language/statements/class/elements/prod-private-getter-before-super-return-in-field-initializer.js
new file mode 100644
index 0000000000..65725972ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/prod-private-getter-before-super-return-in-field-initializer.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-getter-before-super-return-in-field-initializer.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private getters are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ SuperCall: super Arguments
+ 1. Let newTarget be GetNewTarget().
+ 2. If newTarget is undefined, throw a ReferenceError exception.
+ 3. Let func be ? GetSuperConstructor().
+ 4. Let argList be ArgumentListEvaluation of Arguments.
+ 5. ReturnIfAbrupt(argList).
+ 6. Let result be ? Construct(func, argList, newTarget).
+ 7. Let thisER be GetThisEnvironment( ).
+ 8. Let F be thisER.[[FunctionObject]].
+ 9. Assert: F is an ECMAScript function object.
+ 10. Perform ? InitializeInstanceElements(result, F).
+
+ EDITOR'S NOTE:
+ Private fields are added to the object one by one, interspersed with
+ evaluation of the initializers, following the construction of the
+ receiver. These semantics allow for a later initializer to refer to
+ a previous private field.
+
+---*/
+
+
+class C {
+ f = this.g();
+
+}
+
+class D extends C {
+ g() { this.#m; }
+ get #m() { return 42; }
+}
+
+assert(D.prototype.hasOwnProperty('g'));
+assert.throws(TypeError, function() {
+ var d = new D();
+}, 'private getters are not installed before super returns');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/prod-private-method-before-super-return-in-constructor.js b/js/src/tests/test262/language/statements/class/elements/prod-private-method-before-super-return-in-constructor.js
new file mode 100644
index 0000000000..b3d9c28436
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/prod-private-method-before-super-return-in-constructor.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-method-before-super-return-in-constructor.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private methods are installed "when super returns" and no earlier (call in constructor) (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ SuperCall: super Arguments
+ 1. Let newTarget be GetNewTarget().
+ 2. If newTarget is undefined, throw a ReferenceError exception.
+ 3. Let func be ? GetSuperConstructor().
+ 4. Let argList be ArgumentListEvaluation of Arguments.
+ 5. ReturnIfAbrupt(argList).
+ 6. Let result be ? Construct(func, argList, newTarget).
+ 7. Let thisER be GetThisEnvironment( ).
+ 8. Let F be thisER.[[FunctionObject]].
+ 9. Assert: F is an ECMAScript function object.
+ 10. Perform ? InitializeInstanceElements(result, F).
+
+ EDITOR'S NOTE:
+ Private fields are added to the object one by one, interspersed with
+ evaluation of the initializers, following the construction of the
+ receiver. These semantics allow for a later initializer to refer to
+ a previous private field.
+
+---*/
+
+
+class C {
+ constructor() {
+ this.f();
+ }
+
+}
+
+class D extends C {
+ f() { this.#m(); }
+ #m() { return 42; }
+}
+
+assert(D.prototype.hasOwnProperty('f'));
+assert.throws(TypeError, function() {
+ var d = new D();
+}, 'private methods are not installed before super returns');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/prod-private-method-before-super-return-in-field-initializer.js b/js/src/tests/test262/language/statements/class/elements/prod-private-method-before-super-return-in-field-initializer.js
new file mode 100644
index 0000000000..18bd4f8a82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/prod-private-method-before-super-return-in-field-initializer.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-method-before-super-return-in-field-initializer.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private methods are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ SuperCall: super Arguments
+ 1. Let newTarget be GetNewTarget().
+ 2. If newTarget is undefined, throw a ReferenceError exception.
+ 3. Let func be ? GetSuperConstructor().
+ 4. Let argList be ArgumentListEvaluation of Arguments.
+ 5. ReturnIfAbrupt(argList).
+ 6. Let result be ? Construct(func, argList, newTarget).
+ 7. Let thisER be GetThisEnvironment( ).
+ 8. Let F be thisER.[[FunctionObject]].
+ 9. Assert: F is an ECMAScript function object.
+ 10. Perform ? InitializeInstanceElements(result, F).
+
+ EDITOR'S NOTE:
+ Private fields are added to the object one by one, interspersed with
+ evaluation of the initializers, following the construction of the
+ receiver. These semantics allow for a later initializer to refer to
+ a previous private field.
+
+---*/
+
+
+class C {
+ f = this.g();
+
+}
+
+class D extends C {
+ g() { this.#m(); }
+ #m() { return 42; }
+}
+
+assert(D.prototype.hasOwnProperty('g'));
+assert.throws(TypeError, function() {
+ var d = new D();
+}, 'private methods are not installed before super returns');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/prod-private-setter-before-super-return-in-constructor.js b/js/src/tests/test262/language/statements/class/elements/prod-private-setter-before-super-return-in-constructor.js
new file mode 100644
index 0000000000..9ff167a991
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/prod-private-setter-before-super-return-in-constructor.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-setter-before-super-return-in-constructor.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private setters are installed "when super returns" and no earlier (call in constructor) (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ SuperCall: super Arguments
+ 1. Let newTarget be GetNewTarget().
+ 2. If newTarget is undefined, throw a ReferenceError exception.
+ 3. Let func be ? GetSuperConstructor().
+ 4. Let argList be ArgumentListEvaluation of Arguments.
+ 5. ReturnIfAbrupt(argList).
+ 6. Let result be ? Construct(func, argList, newTarget).
+ 7. Let thisER be GetThisEnvironment( ).
+ 8. Let F be thisER.[[FunctionObject]].
+ 9. Assert: F is an ECMAScript function object.
+ 10. Perform ? InitializeInstanceElements(result, F).
+
+ EDITOR'S NOTE:
+ Private fields are added to the object one by one, interspersed with
+ evaluation of the initializers, following the construction of the
+ receiver. These semantics allow for a later initializer to refer to
+ a previous private field.
+
+---*/
+
+
+class C {
+ constructor() {
+ this.f();
+ }
+
+}
+
+class D extends C {
+ f() { this.#m = 42; }
+ set #m(val) {}
+}
+
+assert(D.prototype.hasOwnProperty('f'));
+assert.throws(TypeError, function() {
+ var d = new D();
+}, 'private setters are not installed before super returns');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/prod-private-setter-before-super-return-in-field-initializer.js b/js/src/tests/test262/language/statements/class/elements/prod-private-setter-before-super-return-in-field-initializer.js
new file mode 100644
index 0000000000..514e777881
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/prod-private-setter-before-super-return-in-field-initializer.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/prod-private-setter-before-super-return-in-field-initializer.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Private settters are installed "when super returns" and no earlier (call in field initializer) (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-public, class]
+flags: [generated]
+info: |
+ SuperCall: super Arguments
+ 1. Let newTarget be GetNewTarget().
+ 2. If newTarget is undefined, throw a ReferenceError exception.
+ 3. Let func be ? GetSuperConstructor().
+ 4. Let argList be ArgumentListEvaluation of Arguments.
+ 5. ReturnIfAbrupt(argList).
+ 6. Let result be ? Construct(func, argList, newTarget).
+ 7. Let thisER be GetThisEnvironment( ).
+ 8. Let F be thisER.[[FunctionObject]].
+ 9. Assert: F is an ECMAScript function object.
+ 10. Perform ? InitializeInstanceElements(result, F).
+
+ EDITOR'S NOTE:
+ Private fields are added to the object one by one, interspersed with
+ evaluation of the initializers, following the construction of the
+ receiver. These semantics allow for a later initializer to refer to
+ a previous private field.
+
+---*/
+
+
+class C {
+ f = this.g();
+
+}
+
+class D extends C {
+ g() { this.#m = 42; }
+ set #m(val) {}
+}
+
+assert(D.prototype.hasOwnProperty('g'));
+assert.throws(TypeError, function() {
+ var d = new D();
+}, 'private setters are not installed before super returns');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/public-class-field-initialization-is-visible-to-proxy.js b/js/src/tests/test262/language/statements/class/elements/public-class-field-initialization-is-visible-to-proxy.js
new file mode 100644
index 0000000000..47d1459d11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/public-class-field-initialization-is-visible-to-proxy.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2019 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Public class field initialization calls [[DefineOwnProperty]] and can be observed by Proxies
+esid: sec-define-field
+info: |
+ DefineField(receiver, fieldRecord)
+ ...
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+features: [class, class-fields-public]
+---*/
+
+function ProxyBase() {
+ return new Proxy(this, {
+ defineProperty: function (target, key, descriptor) {
+ throw new Test262Error();
+ }
+ });
+}
+
+class Base extends ProxyBase {
+ f = "Test262";
+}
+
+assert.throws(Test262Error, () => { new Base(); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/public-class-field-initialization-on-super-class-with-setter.js b/js/src/tests/test262/language/statements/class/elements/public-class-field-initialization-on-super-class-with-setter.js
new file mode 100644
index 0000000000..ead5887638
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/public-class-field-initialization-on-super-class-with-setter.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2019 Caio Lima. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Public class field initialization calls [[DefineOwnProperty]] and don't execute super's getter
+esid: sec-define-field
+info: |
+ DefineField(receiver, fieldRecord)
+ ...
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+includes: [propertyHelper.js]
+features: [class, class-fields-public]
+---*/
+
+class Super {
+ set f(v) {
+ throw new Test262Error();
+ }
+}
+
+class Base extends Super {
+ f = "Test262";
+}
+
+let o = new Base();
+
+verifyProperty(o, "f", {
+ value: "Test262",
+ enumerable: true,
+ writable: true,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/redeclaration-symbol.js b/js/src/tests/test262/language/statements/class/elements/redeclaration-symbol.js
new file mode 100644
index 0000000000..84fcf66da1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/redeclaration-symbol.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/redeclaration-symbol.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Redeclaration of public fields with the same name (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js, compareArray.js]
+info: |
+ 2.13.2 Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 30. Set the value of F's [[Fields]] internal slot to fieldRecords.
+ ...
+
+ 2.14 [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 8. If kind is "base", then
+ ...
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ ...
+
+ 2.9 InitializeInstanceFields ( O, constructor )
+
+ 3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
+ 4. For each item fieldRecord in order from fieldRecords,
+ a. If fieldRecord.[[static]] is false, then
+ i. Perform ? DefineField(O, fieldRecord).
+
+---*/
+var x = [];
+var y = Symbol();
+
+
+class C {
+ [y] = (x.push("a"), "old_value");
+ [y] = (x.push("b"), "same_value");
+ [y] = (x.push("c"), "same_value");
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "y does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "y does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: "same_value",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.compareArray(x, ["a", "b", "c"]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/redeclaration.js b/js/src/tests/test262/language/statements/class/elements/redeclaration.js
new file mode 100644
index 0000000000..adefc1b2ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/redeclaration.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/redeclaration.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Redeclaration of public fields with the same name (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js, compareArray.js]
+info: |
+ 2.13.2 Runtime Semantics: ClassDefinitionEvaluation
+
+ ...
+ 30. Set the value of F's [[Fields]] internal slot to fieldRecords.
+ ...
+
+ 2.14 [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 8. If kind is "base", then
+ ...
+ b. Let result be InitializeInstanceFields(thisArgument, F).
+ ...
+
+ 2.9 InitializeInstanceFields ( O, constructor )
+
+ 3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
+ 4. For each item fieldRecord in order from fieldRecords,
+ a. If fieldRecord.[[static]] is false, then
+ i. Perform ? DefineField(O, fieldRecord).
+
+---*/
+var x = [];
+
+
+class C {
+ y = (x.push("a"), "old_value");
+ ["y"] = (x.push("b"), "another_value");
+ "y" = (x.push("c"), "same_value");
+ y = (x.push("d"), "same_value");
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "y", {
+ value: "same_value",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.compareArray(x, ["a", "b", "c", "d"]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-computed-names.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-computed-names.js
new file mode 100644
index 0000000000..804d5547d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-computed-names.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Computed property names (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ [x] = 42; [10] = "meep"; ["not initialized"]
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-computed-symbol-names.js
new file mode 100644
index 0000000000..4c92e0626f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-computed-symbol-names.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Computed property symbol names (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ [x]; [y] = 42
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..80fa60ad31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: PrivateName Static Semantics, StringValue (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-literal-names-asi.js
new file mode 100644
index 0000000000..c3e40e0527
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-literal-names-asi.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Literal property names with ASI (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ a
+ b = 42;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-literal-names.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-literal-names.js
new file mode 100644
index 0000000000..26d73e8e17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-literal-names.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Literal property names (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ a; b = 42;
+ c = fn
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-field-usage.js
new file mode 100644
index 0000000000..d8383f1c25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-field-usage.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: PrivateName CallExpression usage (private field) (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = 'test262';
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-method-getter-usage.js
new file mode 100644
index 0000000000..e193a0f685
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-method-getter-usage.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'test262'; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-method-usage.js
new file mode 100644
index 0000000000..414c3f0fbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-method-usage.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: PrivateName CallExpression usage (private method) (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'test262'; }
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-names.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-names.js
new file mode 100644
index 0000000000..e0033fde71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-private-names.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: private names (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ #x; #y
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..90d7c9c884
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-field-identifier-initializer.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid FieldDefinition (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-field-identifier.js
new file mode 100644
index 0000000000..9c1eeb88c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-field-identifier.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid FieldDefinition (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J
+
+}
+
+var c = new C();
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-getter-alt.js
new file mode 100644
index 0000000000..7a74aa71d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-getter-alt.js
@@ -0,0 +1,114 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName as private getter (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-getter.js
new file mode 100644
index 0000000000..64370e9bea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-getter.js
@@ -0,0 +1,114 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName as private getter (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-method-alt.js
new file mode 100644
index 0000000000..ca1d7342d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-method-alt.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName as private method (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-method.js
new file mode 100644
index 0000000000..9ab249e21a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-method.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName as private method (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-setter-alt.js
new file mode 100644
index 0000000000..84e201cc46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-setter-alt.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName as private setter (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-setter.js
new file mode 100644
index 0000000000..9a5ccb9b66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-private-setter.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName as private setter (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..ded06a1333
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-alt.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..217f88f14d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..14e266a2f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier-initializer.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier.js
new file mode 100644
index 0000000000..4dfebd2c24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-privatename-identifier.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..77d38c6e02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,120 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..7950268e1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..2f28b5eafe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,120 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static AsyncMethod PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..509ef00256
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static AsyncMethod PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..2aa0d02e57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..001428d143
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,111 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..ea4e64890b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static Method PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..9af7fea9a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-method-privatename-identifier.js
@@ -0,0 +1,108 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static Method PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..0635aee73e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..954d8585db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..1d89459791
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..eaa4c940db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..f735e6dfc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..d75bea949f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,90 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..92e2e032a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-rs-static-privatename-identifier.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: Valid Static PrivateName (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-fields.js
new file mode 100644
index 0000000000..acb79ba75a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-fields.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: static private fields (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #x; static #y
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..f09d69a8e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-methods-with-fields.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: static private methods with fields (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #xVal; static #yVal
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-methods.js
new file mode 100644
index 0000000000..a3a431ebad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-static-private-methods.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: static private methods (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/regular-definitions-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/regular-definitions-string-literal-names.js
new file mode 100644
index 0000000000..225e14ff86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/regular-definitions-string-literal-names.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-regular-definitions.template
+/*---
+description: String literal names (regular fields defintion)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ 'a'; "b"; 'c' = 39;
+ "d" = 42
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-computed-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-computed-names.js
new file mode 100644
index 0000000000..972f1370c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-computed-names.js
@@ -0,0 +1,120 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Computed property names (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ async *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+ );
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-computed-symbol-names.js
new file mode 100644
index 0000000000..9c37193020
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-computed-symbol-names.js
@@ -0,0 +1,118 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Computed property symbol names (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ async *m() { return 42; } [x]; [y] = 42;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+ );
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+ );
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..bf90ea927e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.o(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-literal-names-asi.js
new file mode 100644
index 0000000000..25edbf3dce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-literal-names-asi.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Literal property names with ASI (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ async *m() { return 42; } a
+ b = 42;;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-literal-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-literal-names.js
new file mode 100644
index 0000000000..8ed11bb12f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-literal-names.js
@@ -0,0 +1,109 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Literal property names (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ async *m() { return 42; } a; b = 42;
+ c = fn;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-field-usage.js
new file mode 100644
index 0000000000..636bfeba55
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-field-usage.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #m = 'test262';;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-method-getter-usage.js
new file mode 100644
index 0000000000..664a70addb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-method-getter-usage.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ async *m() { return 42; } get #m() { return 'test262'; };
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-method-usage.js
new file mode 100644
index 0000000000..5195b40603
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-method-usage.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #m() { return 'test262'; };
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-names.js
new file mode 100644
index 0000000000..5ad4376496
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-private-names.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: private names (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #x; #y;
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private fields do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(c.x(), 42, "test 7");
+ assert.sameValue(c.y(), 43, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..e25f83ab69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-field-identifier-initializer.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid FieldDefinition (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$, 1);
+ assert.sameValue(c._, 1);
+ assert.sameValue(c.\u{6F}, 1);
+ assert.sameValue(c.\u2118, 1);
+ assert.sameValue(c.ZW_\u200C_NJ, 1);
+ assert.sameValue(c.ZW_\u200D_J, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-field-identifier.js
new file mode 100644
index 0000000000..a82d9db938
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-field-identifier.js
@@ -0,0 +1,107 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid FieldDefinition (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ c.$ = 1;
+ c._ = 1;
+ c.\u{6F} = 1;
+ c.\u2118 = 1;
+ c.ZW_\u200C_NJ = 1;
+ c.ZW_\u200D_J = 1;
+
+ assert.sameValue(c.$, 1);
+ assert.sameValue(c._, 1);
+ assert.sameValue(c.\u{6F}, 1);
+ assert.sameValue(c.\u2118, 1);
+ assert.sameValue(c.ZW_\u200C_NJ, 1);
+ assert.sameValue(c.ZW_\u200D_J, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-getter-alt.js
new file mode 100644
index 0000000000..e4fe4a9217
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-getter-alt.js
@@ -0,0 +1,141 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName as private getter (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-getter.js
new file mode 100644
index 0000000000..cbd190d896
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-getter.js
@@ -0,0 +1,141 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName as private getter (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-method-alt.js
new file mode 100644
index 0000000000..c167ec0e40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-method-alt.js
@@ -0,0 +1,140 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName as private method (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-method.js
new file mode 100644
index 0000000000..01c26b751d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-method.js
@@ -0,0 +1,140 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName as private method (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-setter-alt.js
new file mode 100644
index 0000000000..f74c1c7df2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-setter-alt.js
@@ -0,0 +1,140 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName as private setter (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-setter.js
new file mode 100644
index 0000000000..a8f4b7a0ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-private-setter.js
@@ -0,0 +1,140 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName as private setter (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..e85d80c565
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-alt.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..297996f81f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,116 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(), 1);
+ assert.sameValue(c._(), 1);
+ assert.sameValue(c.\u{6F}(), 1);
+ assert.sameValue(c.℘(), 1);
+ assert.sameValue(c.ZW_‌_NJ(), 1);
+ assert.sameValue(c.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..c7bb2db17b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier-initializer.js
@@ -0,0 +1,116 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(), 1);
+ assert.sameValue(c._(), 1);
+ assert.sameValue(c.\u{6F}(), 1);
+ assert.sameValue(c.\u2118(), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(), 1);
+ assert.sameValue(c.ZW_\u200D_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier.js
new file mode 100644
index 0000000000..25e094aa92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-privatename-identifier.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..4f39dd59e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,148 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ ]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+ }).then($DONE, $DONE);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..71476df72b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,149 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+ ]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+ }).then($DONE, $DONE);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..9a7993365e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,148 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ ]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+ }).then($DONE, $DONE);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..ab1f021ca8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,149 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+ ]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+ }).then($DONE, $DONE);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..3d3f000cdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,137 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$([1]).next().value, 1);
+ assert.sameValue(C._([1]).next().value, 1);
+ assert.sameValue(C.o([1]).next().value, 1);
+ assert.sameValue(C.℘([1]).next().value, 1);
+ assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+ assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..0bf793f536
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,138 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$([1]).next().value, 1);
+ assert.sameValue(C._([1]).next().value, 1);
+ assert.sameValue(C.\u{6F}([1]).next().value, 1);
+ assert.sameValue(C.\u2118([1]).next().value, 1);
+ assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+ assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..57fa08c44f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static Method PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..403e3b857b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static Method PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..16eb36e6fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,123 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..1e9a245c1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,123 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..e9351775f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,123 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..9b954de62d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,117 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.℘(), 1);
+ assert.sameValue(C.ZW_‌_NJ(), 1);
+ assert.sameValue(C.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..ef223e30dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,117 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.℘(), 1);
+ assert.sameValue(C.ZW_‌_NJ(), 1);
+ assert.sameValue(C.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..89b39924ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,117 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.\u2118(), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(), 1);
+ assert.sameValue(C.ZW_\u200D_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..cc7eb655b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-rs-static-privatename-identifier.js
@@ -0,0 +1,123 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: Valid Static PrivateName (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-fields.js
new file mode 100644
index 0000000000..534bf0f6aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-fields.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: static private fields (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #x; static #y;
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private fields do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 7");
+ assert.sameValue(C.y(), 43, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..508876ee08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-methods-with-fields.js
@@ -0,0 +1,101 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: static private methods with fields (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ async *m() { return 42; } static #xVal; static #yVal;
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private methods do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 13");
+ assert.sameValue(C.y(), 43, "test 14");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+ assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-methods.js
new file mode 100644
index 0000000000..9b6f577fca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-static-private-methods.js
@@ -0,0 +1,88 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: static private methods (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ async *m() { return 42; } ;
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private methods do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 7");
+ assert.sameValue(C.y(), 86, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-string-literal-names.js
new file mode 100644
index 0000000000..911faa1d9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-gen-string-literal-names.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-gen.template
+/*---
+description: String literal names (field definitions after an async generator in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ async *m() { return 42; } 'a'; "b"; 'c' = 39;
+ "d" = 42;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().next().then(function(v) {
+ assert.sameValue(v.value, 42);
+ assert.sameValue(v.done, true);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-computed-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-computed-names.js
new file mode 100644
index 0000000000..9bb608a2f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-computed-names.js
@@ -0,0 +1,119 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Computed property names (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ async m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+ );
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-computed-symbol-names.js
new file mode 100644
index 0000000000..395584354c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-computed-symbol-names.js
@@ -0,0 +1,117 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Computed property symbol names (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ async m() { return 42; } [x]; [y] = 42;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+ );
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+ );
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..b474834e14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ async m() { return 42; } #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.o(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-literal-names-asi.js
new file mode 100644
index 0000000000..ace9109e4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-literal-names-asi.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Literal property names with ASI (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ async m() { return 42; } a
+ b = 42;;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-literal-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-literal-names.js
new file mode 100644
index 0000000000..3bafafbc0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-literal-names.js
@@ -0,0 +1,108 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Literal property names (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ async m() { return 42; } a; b = 42;
+ c = fn;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-field-usage.js
new file mode 100644
index 0000000000..66469c293d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-field-usage.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ async m() { return 42; } #m = 'test262';;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-method-getter-usage.js
new file mode 100644
index 0000000000..f71ee44739
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-method-getter-usage.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ async m() { return 42; } get #m() { return 'test262'; };
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-method-usage.js
new file mode 100644
index 0000000000..f5b90f8685
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-method-usage.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ async m() { return 42; } #m() { return 'test262'; };
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.method(), 'test262');
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-names.js
new file mode 100644
index 0000000000..7dde827b1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-private-names.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: private names (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ async m() { return 42; } #x; #y;
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private fields do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(c.x(), 42, "test 7");
+ assert.sameValue(c.y(), 43, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..ea1128fafb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-field-identifier-initializer.js
@@ -0,0 +1,99 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid FieldDefinition (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$, 1);
+ assert.sameValue(c._, 1);
+ assert.sameValue(c.\u{6F}, 1);
+ assert.sameValue(c.\u2118, 1);
+ assert.sameValue(c.ZW_\u200C_NJ, 1);
+ assert.sameValue(c.ZW_\u200D_J, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-field-identifier.js
new file mode 100644
index 0000000000..5846d564c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-field-identifier.js
@@ -0,0 +1,106 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid FieldDefinition (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ c.$ = 1;
+ c._ = 1;
+ c.\u{6F} = 1;
+ c.\u2118 = 1;
+ c.ZW_\u200C_NJ = 1;
+ c.ZW_\u200D_J = 1;
+
+ assert.sameValue(c.$, 1);
+ assert.sameValue(c._, 1);
+ assert.sameValue(c.\u{6F}, 1);
+ assert.sameValue(c.\u2118, 1);
+ assert.sameValue(c.ZW_\u200C_NJ, 1);
+ assert.sameValue(c.ZW_\u200D_J, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-getter-alt.js
new file mode 100644
index 0000000000..4054d76491
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-getter-alt.js
@@ -0,0 +1,140 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-getter.js
new file mode 100644
index 0000000000..993a5984e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-getter.js
@@ -0,0 +1,140 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-method-alt.js
new file mode 100644
index 0000000000..dc90a7d4a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-method-alt.js
@@ -0,0 +1,139 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName as private method (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-method.js
new file mode 100644
index 0000000000..c385f47f7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-method.js
@@ -0,0 +1,139 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName as private method (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-setter-alt.js
new file mode 100644
index 0000000000..a832fc5cd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-setter-alt.js
@@ -0,0 +1,139 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-setter.js
new file mode 100644
index 0000000000..d6915b0c31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-private-setter.js
@@ -0,0 +1,139 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..598efcb28a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-alt.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.℘(1), 1);
+ assert.sameValue(c.ZW_‌_NJ(1), 1);
+ assert.sameValue(c.ZW_‍_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..31760905fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,115 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(), 1);
+ assert.sameValue(c._(), 1);
+ assert.sameValue(c.\u{6F}(), 1);
+ assert.sameValue(c.℘(), 1);
+ assert.sameValue(c.ZW_‌_NJ(), 1);
+ assert.sameValue(c.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..3de36353e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier-initializer.js
@@ -0,0 +1,115 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(), 1);
+ assert.sameValue(c._(), 1);
+ assert.sameValue(c.\u{6F}(), 1);
+ assert.sameValue(c.\u2118(), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(), 1);
+ assert.sameValue(c.ZW_\u200D_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier.js
new file mode 100644
index 0000000000..f76b713628
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-privatename-identifier.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(c.$(1), 1);
+ assert.sameValue(c._(1), 1);
+ assert.sameValue(c.\u{6F}(1), 1);
+ assert.sameValue(c.\u2118(1), 1);
+ assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..27f480eabb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,147 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ ]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+ }).then($DONE, $DONE);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..1c319cbca0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,148 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+ ]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+ }).then($DONE, $DONE);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..b7b7784982
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,147 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ ]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+ }).then($DONE, $DONE);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..e960409e25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,148 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+ ]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+ }).then($DONE, $DONE);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..cf980b1e01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,136 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$([1]).next().value, 1);
+ assert.sameValue(C._([1]).next().value, 1);
+ assert.sameValue(C.o([1]).next().value, 1);
+ assert.sameValue(C.℘([1]).next().value, 1);
+ assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+ assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..1ec439eb20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,137 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$([1]).next().value, 1);
+ assert.sameValue(C._([1]).next().value, 1);
+ assert.sameValue(C.\u{6F}([1]).next().value, 1);
+ assert.sameValue(C.\u2118([1]).next().value, 1);
+ assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+ assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..a170bf16ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..fa4edb8610
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..dc5ef17df1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..a1b13ded29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.o(1), 1);
+ assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+ assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..82513e2be7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..046f6161b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,116 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.℘(), 1);
+ assert.sameValue(C.ZW_‌_NJ(), 1);
+ assert.sameValue(C.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..741d42cf4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,116 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.℘(), 1);
+ assert.sameValue(C.ZW_‌_NJ(), 1);
+ assert.sameValue(C.ZW_‍_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..661d3c7f3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,116 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(), 1);
+ assert.sameValue(C._(), 1);
+ assert.sameValue(C.\u{6F}(), 1);
+ assert.sameValue(C.\u2118(), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(), 1);
+ assert.sameValue(C.ZW_\u200D_J(), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..8e4d1e4cb4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-rs-static-privatename-identifier.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: Valid Static PrivateName (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert.sameValue(C.$(1), 1);
+ assert.sameValue(C._(1), 1);
+ assert.sameValue(C.\u{6F}(1), 1);
+ assert.sameValue(C.\u2118(1), 1);
+ assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+ assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-fields.js
new file mode 100644
index 0000000000..6ae1baeb9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-fields.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: static private fields (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #x; static #y;
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private fields do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 7");
+ assert.sameValue(C.y(), 43, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..91bd3fbf19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-methods-with-fields.js
@@ -0,0 +1,100 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: static private methods with fields (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ async m() { return 42; } static #xVal; static #yVal;
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private methods do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 13");
+ assert.sameValue(C.y(), 43, "test 14");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+ assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-methods.js
new file mode 100644
index 0000000000..942d52a517
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-static-private-methods.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: static private methods (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ async m() { return 42; } ;
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ // Test the private methods do not appear as properties before set to value
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+ assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+ assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+ // Test if private fields can be sucessfully accessed and set to value
+ assert.sameValue(C.x(), 42, "test 7");
+ assert.sameValue(C.y(), 86, "test 8");
+
+ // Test the private fields do not appear as properties before after set to value
+ assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+ assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-async-method-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-string-literal-names.js
new file mode 100644
index 0000000000..102f81d4b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-async-method-string-literal-names.js
@@ -0,0 +1,121 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-after-same-line-async-method.template
+/*---
+description: String literal names (field definitions after an async method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, async-functions]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ async m() { return 42; } 'a'; "b"; 'c' = 39;
+ "d" = 42;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+}, {restore: true});
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+
+ function assertions() {
+ // Cover $DONE handler for async cases.
+ function $DONE(error) {
+ if (error) {
+ throw new Test262Error('Test262:AsyncTestFailure')
+ }
+ }
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+ );
+ assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+ );
+
+ verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ }
+
+ return Promise.resolve(assertions());
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-computed-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-computed-names.js
new file mode 100644
index 0000000000..c6756902a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-computed-names.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Computed property names (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ [x] = 42; [10] = "meep"; ["not initialized"]; *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-computed-symbol-names.js
new file mode 100644
index 0000000000..fd3271ada5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-computed-symbol-names.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Computed property symbol names (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ [x]; [y] = 42; *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..765b14e562
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;; *m() { return 42; }
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-literal-names-asi.js
new file mode 100644
index 0000000000..1b44e6acd0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-literal-names-asi.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Literal property names with ASI (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ a
+ b = 42;; *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-literal-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-literal-names.js
new file mode 100644
index 0000000000..690e9b4775
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-literal-names.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Literal property names (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ a; b = 42;
+ c = fn; *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-field-usage.js
new file mode 100644
index 0000000000..e9c9b07277
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-field-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = 'test262';; *m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-method-getter-usage.js
new file mode 100644
index 0000000000..b4d9b582f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-method-getter-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'test262'; }; *m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-method-usage.js
new file mode 100644
index 0000000000..29ff1bffb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-method-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'test262'; }; *m() { return 42; }
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-names.js
new file mode 100644
index 0000000000..012a9b8507
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-private-names.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: private names (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ #x; #y; *m() { return 42; }
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..73314ca1ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-field-identifier-initializer.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-field-identifier.js
new file mode 100644
index 0000000000..e718d9e508
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-field-identifier.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-getter-alt.js
new file mode 100644
index 0000000000..55096fe306
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-getter-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+; *m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-getter.js
new file mode 100644
index 0000000000..80244ca087
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-getter.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+; *m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-method-alt.js
new file mode 100644
index 0000000000..8f4d65d8d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-method-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+; *m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-method.js
new file mode 100644
index 0000000000..d81c4e3383
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-method.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+; *m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-setter-alt.js
new file mode 100644
index 0000000000..a2b835d6ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-setter-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+; *m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-setter.js
new file mode 100644
index 0000000000..f0a4e46f00
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-private-setter.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+; *m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..ca087b0399
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-alt.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; *m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..f21f1a2e71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; *m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..2ccadb6eae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier-initializer.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; *m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier.js
new file mode 100644
index 0000000000..485a9bd34d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-privatename-identifier.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; *m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..a6a8c640d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ }; *m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..fe03ce23f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ }; *m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..22b486db39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ }; *m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..3ef061db5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ }; *m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..37181ecc10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,124 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ }; *m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..3630e7b33c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ }; *m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..b6f7007c88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ }; *m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..ce032fa68c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-method-privatename-identifier.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ }; *m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..836a203e5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; *m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..dd7f2c74ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; *m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..f99a1b1503
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; *m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..43ade49028
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; *m() { return 42; }
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..473ea08121
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; *m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..734395af36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; *m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..3903cb11b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-rs-static-privatename-identifier.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; *m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-fields.js
new file mode 100644
index 0000000000..8c27b417ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-fields.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: static private fields (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #x; static #y; *m() { return 42; }
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..fa0c3345e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-methods-with-fields.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: static private methods with fields (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #xVal; static #yVal; *m() { return 42; }
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-methods.js
new file mode 100644
index 0000000000..9a54e8a48f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-static-private-methods.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: static private methods (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ ; *m() { return 42; }
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-gen-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-gen-string-literal-names.js
new file mode 100644
index 0000000000..6735a3a627
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-gen-string-literal-names.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-same-line-generator.template
+/*---
+description: String literal names (field definitions followed by a generator method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class, generators]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ 'a'; "b"; 'c' = 39;
+ "d" = 42; *m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-computed-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-computed-names.js
new file mode 100644
index 0000000000..d2e624c169
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-computed-names.js
@@ -0,0 +1,107 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Computed property names (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ [x] = 42; [10] = "meep"; ["not initialized"]; m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-computed-symbol-names.js
new file mode 100644
index 0000000000..60f11abfc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-computed-symbol-names.js
@@ -0,0 +1,105 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Computed property symbol names (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ [x]; [y] = 42; m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..4a6e3dc26a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: PrivateName Static Semantics, StringValue (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;; m() { return 42; }
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-literal-names-asi.js
new file mode 100644
index 0000000000..86b5cabe86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-literal-names-asi.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Literal property names with ASI (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ a
+ b = 42;; m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-literal-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-literal-names.js
new file mode 100644
index 0000000000..ffad35e421
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-literal-names.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Literal property names (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ a; b = 42;
+ c = fn; m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-private-field-usage.js
new file mode 100644
index 0000000000..e41e34de6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-private-field-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: PrivateName CallExpression usage (private field) (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m = 'test262';; m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-private-method-getter-usage.js
new file mode 100644
index 0000000000..fcc4466573
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-private-method-getter-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ get #m() { return 'test262'; }; m() { return 42; }
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-private-method-usage.js
new file mode 100644
index 0000000000..03ec6f24e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-private-method-usage.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: PrivateName CallExpression usage (private method) (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ #m() { return 'test262'; }; m() { return 42; }
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-private-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-private-names.js
new file mode 100644
index 0000000000..0977dfbdd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-private-names.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: private names (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ #x; #y; m() { return 42; }
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..4a14ab6d0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-field-identifier-initializer.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1; m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-field-identifier.js
new file mode 100644
index 0000000000..2261cbc387
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-field-identifier.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid FieldDefinition (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J; m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-getter-alt.js
new file mode 100644
index 0000000000..5d5831486a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-getter-alt.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+; m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-getter.js
new file mode 100644
index 0000000000..8698f33905
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-getter.js
@@ -0,0 +1,128 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName as private getter (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+; m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-method-alt.js
new file mode 100644
index 0000000000..18d7aa16d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-method-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+; m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-method.js
new file mode 100644
index 0000000000..85cff2317b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-method.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName as private method (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+; m() { return 42; }
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-setter-alt.js
new file mode 100644
index 0000000000..c6d74ba3f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-setter-alt.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+; m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-setter.js
new file mode 100644
index 0000000000..b626dbbe6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-private-setter.js
@@ -0,0 +1,127 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName as private setter (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+; m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..305a538f48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-alt.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J; m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..a560f28089
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1; m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..370cd34157
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier-initializer.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1; m() { return 42; }
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier.js
new file mode 100644
index 0000000000..026bb6e756
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-privatename-identifier.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; m() { return 42; }
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..d001e108f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ }; m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..5da3af0260
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ }; m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..3d0f4dffea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,134 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ }; m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..ab5ea4157e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,135 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static AsyncMethod PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ }; m() { return 42; }
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..b2fb9a471b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,124 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ }; m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..610ae1f044
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,125 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ }; m() { return 42; }
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..c37597597d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ }; m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..f169846a04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-method-privatename-identifier.js
@@ -0,0 +1,122 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static Method PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ }; m() { return 42; }
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..b0ddf9a34e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..2cc1ad9a75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J; m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..5c113a6763
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; m() { return 42; }
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..b99b7b6fb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; m() { return 42; }
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..726b917af6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1; m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..dc6cc0adc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1; m() { return 42; }
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..eeedf66852
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-rs-static-privatename-identifier.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: Valid Static PrivateName (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J; m() { return 42; }
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-fields.js
new file mode 100644
index 0000000000..b829baa278
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-fields.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: static private fields (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #x; static #y; m() { return 42; }
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..122e89c869
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-methods-with-fields.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: static private methods with fields (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ static #xVal; static #yVal; m() { return 42; }
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-methods.js
new file mode 100644
index 0000000000..23d279092e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-static-private-methods.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: static private methods (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ ; m() { return 42; }
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/same-line-method-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/same-line-method-string-literal-names.js
new file mode 100644
index 0000000000..bc189fe759
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/same-line-method-string-literal-names.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-same-line-method.template
+/*---
+description: String literal names (field definitions followed by a method in the same line)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ 'a'; "b"; 'c' = 39;
+ "d" = 42; m() { return 42; }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "m"),
+ "m doesn't appear as an own property on the C instance"
+);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/set-access-of-missing-private-setter.js b/js/src/tests/test262/language/statements/class/elements/set-access-of-missing-private-setter.js
new file mode 100644
index 0000000000..0548a1b526
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/set-access-of-missing-private-setter.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Trying to set a private member without setter throws TypeError
+esid: sec-privatefieldset
+info: |
+ PrivateFieldSet ( P, O, value )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Set entry.[[PrivateFieldValue]] to value.
+ d. Return.
+ 4. If P.[[Kind]] is "method", throw a TypeError exception.
+ 5. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If O.[[PrivateFieldBrands]] does not contain P.[[Brand]], throw a TypeError exception.
+ c. If P does not have a [[Set]] field, throw a TypeError exception.
+ d. Let setter be P.[[Set]].
+ e. Perform ? Call(setter, O, value).
+ f. Return.
+features: [class-methods-private, class]
+---*/
+
+class C {
+ get #f() {
+ throw new Test262Error();
+ }
+
+ setAccess() {
+ this.#f = 'Test262';
+ }
+}
+
+let c = new C();
+assert.throws(TypeError, function() {
+ c.setAccess();
+}, 'set operation on private accessor without setter should throw TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/set-access-of-missing-private-static-setter.js b/js/src/tests/test262/language/statements/class/elements/set-access-of-missing-private-static-setter.js
new file mode 100644
index 0000000000..cba6b87287
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/set-access-of-missing-private-static-setter.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Trying to set a private member without setter throws TypeError
+esid: sec-privatefieldset
+info: |
+ PrivateFieldSet ( P, O, value )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Set entry.[[PrivateFieldValue]] to value.
+ d. Return.
+ 4. If P.[[Kind]] is "method", throw a TypeError exception.
+ 5. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If O.[[PrivateFieldBrands]] does not contain P.[[Brand]], throw a TypeError exception.
+ c. If P does not have a [[Set]] field, throw a TypeError exception.
+ d. Let setter be P.[[Set]].
+ e. Perform ? Call(setter, O, value).
+ f. Return.
+features: [class-static-methods-private, class]
+---*/
+
+class C {
+ static get #f() {
+ throw new Test262Error();
+ }
+
+ static setAccess() {
+ this.#f = 'Test262';
+ }
+}
+
+assert.throws(TypeError, function() {
+ C.setAccess();
+}, 'set operation on private accessor without setter should throw TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/set-access-of-missing-shadowed-private-setter.js b/js/src/tests/test262/language/statements/class/elements/set-access-of-missing-shadowed-private-setter.js
new file mode 100644
index 0000000000..9f2657cec9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/set-access-of-missing-shadowed-private-setter.js
@@ -0,0 +1,92 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Trying to set in PrivateName without setter throws TypeError
+esid: sec-privatefieldset
+info: |
+ PrivateFieldSet ( P, O, value )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Set entry.[[PrivateFieldValue]] to value.
+ d. Return.
+ 4. If P.[[Kind]] is "method", throw a TypeError exception.
+ 5. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If O.[[PrivateFieldBrands]] does not contain P.[[Brand]], throw a TypeError exception.
+ c. If P does not have a [[Set]] field, throw a TypeError exception.
+ d. Let setter be P.[[Set]].
+ e. Perform ? Call(setter, O, value).
+ f. Return.
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+class A {
+ set #f(v) {
+ throw new Test262Error();
+ }
+}
+
+class B extends A {
+ get #f() {
+ throw new Test262Error();
+ }
+
+ setAccess() {
+ this.#f = 'Test262';
+ }
+}
+
+let b = new B();
+assert.throws(TypeError, function() {
+ b.setAccess();
+}, 'subclass private accessor should shadow super class private accessor');
+
+class C {
+ set #f(v) {
+ throw new Test262Error();
+ }
+
+ Inner = class {
+ get #f() {
+ throw new Test262Error();
+ }
+
+ setAccess() {
+ this.#f = 'Test262';
+ }
+ }
+}
+
+let c = new C();
+let innerC = new c.Inner();
+assert.throws(TypeError, function() {
+ innerC.setAccess();
+}, 'inner class private accessor should shadow outer class private accessor');
+
+class D {
+ get #f() {
+ throw new Test262Error();
+ }
+
+ Inner = class {
+ set #f(v) {
+ throw new Test262Error();
+ }
+ }
+
+ setAccess() {
+ this.#f = 'Test262';
+ }
+}
+
+let d = new D();
+assert.throws(TypeError, function() {
+ d.setAccess();
+}, 'inner class private accessor should not be visible to outer class private accessor');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/set-access-of-private-method.js b/js/src/tests/test262/language/statements/class/elements/set-access-of-private-method.js
new file mode 100644
index 0000000000..13b493274e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/set-access-of-private-method.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Trying to set a private method throws TypeError
+esid: sec-privatefieldset
+info: |
+ PrivateFieldSet ( P, O, value )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Set entry.[[PrivateFieldValue]] to value.
+ d. Return.
+ 4. If P.[[Kind]] is "method", throw a TypeError exception.
+ 5. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If O.[[PrivateFieldBrands]] does not contain P.[[Brand]], throw a TypeError exception.
+ c. If P does not have a [[Set]] field, throw a TypeError exception.
+ d. Let setter be P.[[Set]].
+ e. Perform ? Call(setter, O, value).
+ f. Return.
+features: [class-methods-private, class]
+---*/
+
+class C {
+ #f() {
+ throw new Test262Error();
+ }
+
+ setAccess() {
+ this.#f = 'Test262';
+ }
+}
+
+let c = new C();
+assert.throws(TypeError, function() {
+ c.setAccess();
+}, 'set operation on private method should throw TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/set-access-of-shadowed-private-method.js b/js/src/tests/test262/language/statements/class/elements/set-access-of-shadowed-private-method.js
new file mode 100644
index 0000000000..4a15f281a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/set-access-of-shadowed-private-method.js
@@ -0,0 +1,92 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Trying to set private method throws TypeError
+esid: sec-privatefieldset
+info: |
+ PrivateFieldSet ( P, O, value )
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ a. Let entry be PrivateFieldFind(P, O).
+ b. If entry is empty, throw a TypeError exception.
+ c. Set entry.[[PrivateFieldValue]] to value.
+ d. Return.
+ 4. If P.[[Kind]] is "method", throw a TypeError exception.
+ 5. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If O.[[PrivateFieldBrands]] does not contain P.[[Brand]], throw a TypeError exception.
+ c. If P does not have a [[Set]] field, throw a TypeError exception.
+ d. Let setter be P.[[Set]].
+ e. Perform ? Call(setter, O, value).
+ f. Return.
+features: [class-methods-private, class-fields-public, class]
+---*/
+
+class A {
+ set #f(v) {
+ throw new Test262Error();
+ }
+}
+
+class B extends A {
+ #f() {
+ throw new Test262Error();
+ }
+
+ setAccess() {
+ this.#f = 'Test262';
+ }
+}
+
+let b = new B();
+assert.throws(TypeError, function() {
+ b.setAccess();
+}, 'subclass private method should shadow super class private accessor');
+
+class C {
+ set #f(v) {
+ throw new Test262Error();
+ }
+
+ Inner = class {
+ #f() {
+ throw new Test262Error();
+ }
+
+ setAccess() {
+ this.#f = 'Test262';
+ }
+ }
+}
+
+let c = new C();
+let innerC = new c.Inner();
+assert.throws(TypeError, function() {
+ innerC.setAccess();
+}, 'inner class private method should shadow outer class private accessor');
+
+class D {
+ #f() {
+ throw new Test262Error();
+ }
+
+ Inner = class {
+ set #f(v) {
+ throw new Test262Error();
+ }
+ }
+
+ setAccess() {
+ this.#f = 'Test262';
+ }
+}
+
+let d = new D();
+assert.throws(TypeError, function() {
+ d.setAccess();
+}, 'inner class private accessor should not be visible to outer class');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/shell.js b/js/src/tests/test262/language/statements/class/elements/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/static-as-valid-instance-field-assigned.js b/js/src/tests/test262/language/statements/class/elements/static-as-valid-instance-field-assigned.js
new file mode 100644
index 0000000000..7e6f093768
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-as-valid-instance-field-assigned.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-as-valid-instance-field-assigned.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static is a valid name of an instance field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static = "foo";
+}
+
+let c = new C();
+
+verifyProperty(c, "static", {
+ value: "foo",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-as-valid-instance-field.js b/js/src/tests/test262/language/statements/class/elements/static-as-valid-instance-field.js
new file mode 100644
index 0000000000..26bb5b7629
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-as-valid-instance-field.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-as-valid-instance-field.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static is a valid name of an instance field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ static;
+}
+
+let c = new C();
+
+verifyProperty(c, "static", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-as-valid-static-field-assigned.js b/js/src/tests/test262/language/statements/class/elements/static-as-valid-static-field-assigned.js
new file mode 100644
index 0000000000..1383f338c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-as-valid-static-field-assigned.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-as-valid-static-field-assigned.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static is a valid name of a static field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ static FieldDefinition ;
+
+---*/
+
+
+class C {
+ static static = "test262";
+}
+
+verifyProperty(C, "static", {
+ value: "test262",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-as-valid-static-field.js b/js/src/tests/test262/language/statements/class/elements/static-as-valid-static-field.js
new file mode 100644
index 0000000000..88f818f28c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-as-valid-static-field.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-as-valid-static-field.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static is a valid name of a static field (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ static FieldDefinition ;
+
+---*/
+
+
+class C {
+ static static;
+}
+
+verifyProperty(C, "static", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-comp-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/static-comp-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..eff2ee5b0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-comp-name-init-err-contains-arguments.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-comp-name.template
+/*---
+description: Syntax error if `arguments` used in class field (static computed ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public, computed-property-names]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+var x = "string";
+class C {
+ static [x] = arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/static-comp-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/static-comp-name-init-err-contains-super.js
new file mode 100644
index 0000000000..8ea327730f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-comp-name-init-err-contains-super.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-comp-name.template
+/*---
+description: Syntax error if `super()` used in class field (static computed ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public, computed-property-names]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+var x = "string";
+class C {
+ static [x] = super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/static-field-anonymous-function-length.js b/js/src/tests/test262/language/statements/class/elements/static-field-anonymous-function-length.js
new file mode 100644
index 0000000000..17c4b304b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-field-anonymous-function-length.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-field-anonymous-function-length.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Anonymous function in field initilizer have length properly set (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class-static-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassDefinitionEvaluation:
+ ...
+
+ 27. Let staticFields be a new empty List.
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ ...
+ b. Else,
+ i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false.
+ c. If field is an abrupt completion, then
+ ...
+ d. If field is not empty,
+ i. If IsStatic of e is false, append field to instanceFields.
+ ii. Otherwise, append field to staticFields.
+
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+ ...
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let name be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a. Let initValue be ? Call(initializer, receiver).
+ ...
+
+---*/
+
+
+class C {
+ static #field = (a, b) => undefined;
+ static field = function() {};
+
+ static accessPrivateField() {
+ return this.#field;
+ }
+
+}
+
+assert.sameValue(C.accessPrivateField().length, 2);
+assert.sameValue(C.field.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-field-anonymous-function-name.js b/js/src/tests/test262/language/statements/class/elements/static-field-anonymous-function-name.js
new file mode 100644
index 0000000000..9fe93ca156
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-field-anonymous-function-name.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-field-anonymous-function-name.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Anonymous function receives the name of static fields (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class-static-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassDefinitionEvaluation:
+ ...
+
+ 27. Let staticFields be a new empty List.
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ ...
+ b. Else,
+ i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false.
+ c. If field is an abrupt completion, then
+ ...
+ d. If field is not empty,
+ i. If IsStatic of e is false, append field to instanceFields.
+ ii. Otherwise, append field to staticFields.
+
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+ ...
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let name be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a. Let initValue be ? Call(initializer, receiver).
+ 6. Else, let initValue be undefined.
+ 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(initValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName).
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+
+---*/
+
+
+class C {
+ static #field = () => 'Test262';
+ static field = function() { return 42; };
+
+ static accessPrivateField() {
+ return this.#field;
+ }
+
+}
+
+assert.sameValue(C.accessPrivateField().name, "#field");
+assert.sameValue(C.field.name, "field");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-field-declaration.js b/js/src/tests/test262/language/statements/class/elements/static-field-declaration.js
new file mode 100644
index 0000000000..3bdd8ae3e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-field-declaration.js
@@ -0,0 +1,132 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-field-declaration.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Static fields are defined using DefineField (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Updated Productions
+
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+ StringLiteral
+ NumericLiteral
+
+ ClassDefinitionEvaluation:
+ ...
+
+ 27. Let staticFields be a new empty List.
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ ...
+ b. Else,
+ i. Let field be the result of performing PropertyDefinitionEvaluation for mClassElementEvaluation for e with arguments F and false.
+ c. If field is an abrupt completion, then
+ ...
+ d. If field is not empty,
+ i. If IsStatic of e is false, append field to instanceFields.
+ ii. Otherwise, append field to staticFields.
+
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+ ...
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let name be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a. Let initValue be ? Call(initializer, receiver).
+ 6. Else, let initValue be undefined.
+ 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(initValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName).
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+
+---*/
+var computed = 'h';
+
+
+class C {
+ static f = 'test262';
+ static 'g';
+ static 0 = 'bar';
+ static [computed];
+}
+
+let c = new C();
+
+assert.sameValue(c.f, undefined);
+assert.sameValue(c.g, undefined);
+assert.sameValue(c.h, undefined);
+assert.sameValue(c[0], undefined);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(c, 'f'),
+ "f does not appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, 'g'),
+ "g does not appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, 'h'),
+ "h does not appear as an own property on the C instance"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, 0),
+ "0 does not appear as an own property on the C instance"
+);
+
+verifyProperty(C, 'f', {
+ value: 'test262',
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+verifyProperty(C, 'g', {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+verifyProperty(C, 0, {
+ value: 'bar',
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+verifyProperty(C, 'h', {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-field-init-this-inside-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/static-field-init-this-inside-arrow-function.js
new file mode 100644
index 0000000000..e10becfcc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-field-init-this-inside-arrow-function.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-field-init-this-inside-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: this in static field initializers refers to class constructor (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassDefinitionEvaluation:
+ ...
+
+ 27. Let staticFields be a new empty List.
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ ...
+ b. Else,
+ i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false.
+ c. If field is an abrupt completion, then
+ ...
+ d. If field is not empty,
+ i. If IsStatic of e is false, append field to instanceFields.
+ ii. Otherwise, append field to staticFields.
+
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+ ...
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let name be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a. Let initValue be ? Call(initializer, receiver).
+ 6. Else, let initValue be undefined.
+ 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(initValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName).
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+
+---*/
+
+
+class C {
+ static f = () => this;
+}
+
+assert.sameValue(C.f(), C);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-field-init-with-this.js b/js/src/tests/test262/language/statements/class/elements/static-field-init-with-this.js
new file mode 100644
index 0000000000..17541878f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-field-init-with-this.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-field-init-with-this.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Static fields initializer has `this` biding (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassDefinitionEvaluation:
+ ...
+
+ 27. Let staticFields be a new empty List.
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ ...
+ b. Else,
+ i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false.
+ c. If field is an abrupt completion, then
+ ...
+ d. If field is not empty,
+ i. If IsStatic of e is false, append field to instanceFields.
+ ii. Otherwise, append field to staticFields.
+
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+ ...
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let name be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a. Let initValue be ? Call(initializer, receiver).
+ 6. Else, let initValue be undefined.
+ 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(initValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName).
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+
+---*/
+
+
+class C {
+ static f = 'test';
+ static g = this.f + '262';
+ static h = eval('this.g') + 'test';
+}
+
+assert.sameValue(C.f, 'test');
+assert.sameValue(C.g, 'test262');
+assert.sameValue(C.h, 'test262test');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-field-initializer-error.js b/js/src/tests/test262/language/statements/class/elements/static-field-initializer-error.js
new file mode 100644
index 0000000000..e15ee8a192
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-field-initializer-error.js
@@ -0,0 +1,60 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Class evaluation is incomplete when initializer resutls in an abrupt completition
+esid: sec-define-field
+info: |
+ ClassDefinitionEvaluation:
+ ...
+
+ 27. Let staticFields be a new empty List.
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ ...
+ b. Else,
+ i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false.
+ c. If field is an abrupt completion, then
+ ...
+ d. If field is not empty,
+ i. If IsStatic of e is false, append field to instanceFields.
+ ii. Otherwise, append field to staticFields.
+
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+ ...
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let name be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a. Let initValue be ? Call(initializer, receiver).
+ 6. Else, let initValue be undefined.
+ 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(initValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName).
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+features: [class-static-fields-public, class]
+---*/
+
+function initThrows() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ class C {
+ static f = initThrows();
+ static g;
+ };
+
+ assert(false, 'this should never execute');
+}, 'static field initializer should throw exception');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-field-redeclaration.js b/js/src/tests/test262/language/statements/class/elements/static-field-redeclaration.js
new file mode 100644
index 0000000000..8dc0da889a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-field-redeclaration.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-field-redeclaration.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Static fields can be redeclared (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-fields-public, class]
+flags: [generated]
+info: |
+ Updated Productions
+
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassDefinitionEvaluation:
+ ...
+
+ 27. Let staticFields be a new empty List.
+ 28. For each ClassElement e in order from elements,
+ a. If IsStatic of e is false, then
+ ...
+ b. Else,
+ i. Let field be the result of performing PropertyDefinitionEvaluation for m ClassElementEvaluation for e with arguments F and false.
+ c. If field is an abrupt completion, then
+ ...
+ d. If field is not empty,
+ i. If IsStatic of e is false, append field to instanceFields.
+ ii. Otherwise, append field to staticFields.
+
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+ ...
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let name be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a. Let initValue be ? Call(initializer, receiver).
+ 6. Else, let initValue be undefined.
+ 7. If fieldRecord.[[IsAnonymousFunctionDefinition]] is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(initValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(initValue, fieldName).
+ 8. If fieldName is a Private Name,
+ a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue).
+ 9. Else,
+ a. Assert: IsPropertyKey(fieldName) is true.
+ b. Perform ? CreateDataPropertyOrThrow(receiver, fieldName, initValue).
+ 10. Return.
+
+---*/
+
+
+class C {
+ static f = 'test';
+ static f = this.f + '262';
+ static g() {
+ return 45;
+ };
+ static g = this.g();
+}
+
+assert.sameValue(C.f, 'test262');
+assert.sameValue(C.g, 45);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-fielddefinition-initializer-abrupt-completion.js b/js/src/tests/test262/language/statements/class/elements/static-fielddefinition-initializer-abrupt-completion.js
new file mode 100644
index 0000000000..c5985614d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-fielddefinition-initializer-abrupt-completion.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Class construction should error if evaluation of static field initializer errors
+esid: runtime-semantics-class-definition-evaluation
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of e is false, then
+ i. Let fields be the result of performing ClassElementEvaluation
+ for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation
+ for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+
+features: [class-static-fields-public]
+---*/
+
+function f() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ class C {
+ static x = f();
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-literal-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/static-literal-init-err-contains-arguments.js
new file mode 100644
index 0000000000..5cd2212101
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-literal-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-literal-name.template
+/*---
+description: Syntax error if `arguments` used in class field (static literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static x = arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/static-literal-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/static-literal-init-err-contains-super.js
new file mode 100644
index 0000000000..562c076edc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-literal-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-literal-name.template
+/*---
+description: Syntax error if `super()` used in class field (static literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static x = super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-fields-proxy-default-handler-throws.js b/js/src/tests/test262/language/statements/class/elements/static-private-fields-proxy-default-handler-throws.js
new file mode 100644
index 0000000000..8752878264
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-fields-proxy-default-handler-throws.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-privatefieldget
+description: Static private fields not accessible via default Proxy handler
+info: |
+ 1. Assert: P is a Private Name value.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. Let entry be PrivateFieldFind(P, O).
+ 4. If entry is empty, throw a TypeError exception.
+
+features: [class, class-static-fields-private]
+---*/
+
+class C {
+ static #x = 1;
+ static x() {
+ return this.#x;
+ }
+}
+
+var P = new Proxy(C, {});
+
+assert.sameValue(C.x(), 1);
+assert.throws(TypeError, function() {
+ P.x();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-arrow-function.js
new file mode 100644
index 0000000000..d316074af0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-arrow-function.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-getter-access-on-inner-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static private getter access inside of an arrow function (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static get #f() {
+ return 'Test262';
+ }
+
+ static access() {
+ const arrowFunction = () => {
+ return this.#f;
+ };
+
+ return arrowFunction();
+ }
+}
+
+assert.sameValue(C.access(), 'Test262');
+assert.throws(TypeError, function() {
+ C.access.call({});
+}, 'Accessed static private getter from an object which did not contain it');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-class.js b/js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-class.js
new file mode 100644
index 0000000000..5242a5170e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-class.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-getter-access-on-inner-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static private getter access inside of an inner class (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-public, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static get #f() {
+ return 'Test262';
+ }
+
+ static Inner = class {
+ static access(o) {
+ return o.#f;
+ }
+ }
+}
+
+assert.sameValue(C.Inner.access(C), 'Test262');
+assert.throws(TypeError, function() {
+ C.Inner.access(C.Inner);
+}, 'Accessed static private getter from an object which did not contain it');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-function.js b/js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-function.js
new file mode 100644
index 0000000000..f1556f68b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-getter-access-on-inner-function.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-getter-access-on-inner-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static private getter access inside of a nested function (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static get #f() {
+ return 'Test262';
+ }
+
+ static access() {
+ const self = this;
+
+ function innerFunction() {
+ return self.#f;
+ }
+
+ return innerFunction();
+ }
+}
+
+assert.sameValue(C.access(), 'Test262');
+assert.throws(TypeError, function() {
+ C.access.call({});
+}, 'Accessed static private getter from an arbitrary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-getter.js b/js/src/tests/test262/language/statements/class/elements/static-private-getter.js
new file mode 100644
index 0000000000..cf40d3fd0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-getter.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-getter.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static private getter declaration and usage (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ MethodDefinition :
+ get ClassElementName () { FunctionBody }
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ ...
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static get #f() {
+ return 'Test262';
+ }
+
+ static access() {
+ return this.#f;
+ }
+}
+
+assert.sameValue(C.access(), 'Test262');
+assert.throws(TypeError, function() {
+ C.access.call({});
+}, 'Accessed static private getter from an arbitrary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/static-private-init-err-contains-arguments.js
new file mode 100644
index 0000000000..30ee50c855
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-private-name.template
+/*---
+description: Syntax error if `arguments` used in class field (static PrivateName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static #x = arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/static-private-init-err-contains-super.js
new file mode 100644
index 0000000000..114c6d7109
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-private-name.template
+/*---
+description: Syntax error if `super()` used in class field (static PrivateName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static #x = super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-method-access-on-inner-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/static-private-method-access-on-inner-arrow-function.js
new file mode 100644
index 0000000000..2145cefe5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-method-access-on-inner-arrow-function.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-method-access-on-inner-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Static private method access inside of an arrow function (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static #f() { return 42; }
+ static g() {
+ const arrowFunction = () => {
+ return this.#f();
+ };
+
+ return arrowFunction();
+ }
+
+}
+
+assert.sameValue(C.g(), 42);
+assert.throws(TypeError, function() {
+ C.g.call({});
+}, 'Accessed static private method from an object which did not contain it');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-method-access-on-inner-function.js b/js/src/tests/test262/language/statements/class/elements/static-private-method-access-on-inner-function.js
new file mode 100644
index 0000000000..7e4d1b3a4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-method-access-on-inner-function.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-method-access-on-inner-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Static private method access inside of a nested function (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static #f() { return 42; }
+ static g() {
+ const self = this;
+
+ function innerFunction() {
+ return self.#f();
+ }
+
+ return innerFunction();
+ }
+
+}
+
+assert.sameValue(C.g(), 42);
+assert.throws(TypeError, function() {
+ C.g.call({});
+}, 'Accessed static private method from an object which did not contain it');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-method-and-instance-method-brand-check.js b/js/src/tests/test262/language/statements/class/elements/static-private-method-and-instance-method-brand-check.js
new file mode 100644
index 0000000000..21a112a88c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-method-and-instance-method-brand-check.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-method-and-instance-method-brand-check.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Brand for static private names and instance private names are different (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-methods-private, class]
+flags: [generated]
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 32. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] field is proto,
+ a. Set F.[[PrivateBrand]] to proto.
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ ...
+
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static #f() {
+ return 'static';
+ }
+
+ static access() {
+ return this.#f();
+ }
+
+ #instanceMethod() {
+ return 'instance';
+ }
+
+ instanceAccess() {
+ return this.#instanceMethod();
+ }
+}
+
+let c = new C();
+assert.sameValue(C.access(), 'static');
+assert.sameValue(c.instanceAccess(), 'instance');
+
+assert.throws(TypeError, function() {
+ C.access.call(c);
+}, 'Accessed static private method from instance of C');
+
+assert.throws(TypeError, function() {
+ c.instanceAccess.call(C);
+}, 'Accessed instance private method from C');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-method-referenced-from-instance-method.js b/js/src/tests/test262/language/statements/class/elements/static-private-method-referenced-from-instance-method.js
new file mode 100644
index 0000000000..380b6409a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-method-referenced-from-instance-method.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-method-referenced-from-instance-method.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Static private method referenced from an instance method (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static #f() { return 42; }
+ g() {
+ return this.#f();
+ }
+
+}
+
+assert.sameValue(new C().g.call(C), 42);
+assert.throws(TypeError, function() {
+ new C().g();
+}, 'Accessed static private method from an object which did not contain it');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-method-subclass-receiver.js b/js/src/tests/test262/language/statements/class/elements/static-private-method-subclass-receiver.js
new file mode 100644
index 0000000000..cf7c904247
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-method-subclass-receiver.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-method-subclass-receiver.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: Static private methods on the super-class cannot be called with sub-class as the receiver (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static f() { return this.#g(); }
+ static #g() { return 42; }
+
+}
+
+class D extends C {}
+assert.sameValue(C.f(), 42);
+assert.throws(TypeError, function() {
+ D.f();
+}, 'D does not contain static private method #g');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-arrow-function.js b/js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-arrow-function.js
new file mode 100644
index 0000000000..224f85738b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-arrow-function.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-setter-access-on-inner-arrow-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static private setter access inside of an arrow function (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static set #f(v) {
+ this._v = v;
+ }
+
+ static access() {
+ const arrowFunction = () => {
+ this.#f = 'Test262';
+ };
+
+ arrowFunction();
+ }
+}
+
+C.access();
+assert.sameValue(C._v, 'Test262');
+assert.throws(TypeError, function() {
+ C.access.call({});
+}, 'Accessed static private setter from an object which did not contain it');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-class.js b/js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-class.js
new file mode 100644
index 0000000000..77fcb12d4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-class.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-setter-access-on-inner-class.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static private setter access inside of an inner class (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-public, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static set #f(v) {
+ return this._v = v;
+ }
+
+ static Inner = class {
+ static access(o) {
+ o.#f = 'Test262';
+ }
+ }
+
+}
+
+C.Inner.access(C)
+assert.sameValue(C._v, 'Test262');
+assert.throws(TypeError, function() {
+ C.Inner.access(C.Inner);
+}, 'Accessed static private setter from an object which did not contain it');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-function.js b/js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-function.js
new file mode 100644
index 0000000000..3781181dd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-setter-access-on-inner-function.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-setter-access-on-inner-function.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static private setter access inside of a nested function (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ a. Return P.[[Value]].
+ ...
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static set #f(v) {
+ this._v = v;
+ }
+
+ static access() {
+ const self = this;
+
+ function innerFunction() {
+ self.#f = 'Test262';
+ }
+
+ innerFunction();
+ }
+}
+
+C.access();
+assert.sameValue(C._v, 'Test262');
+assert.throws(TypeError, function() {
+ C.access.call({});
+}, 'Accessed static private setter from an arbitrary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-private-setter.js b/js/src/tests/test262/language/statements/class/elements/static-private-setter.js
new file mode 100644
index 0000000000..c39699206f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-private-setter.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-setter.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: static private setter declaration and usage (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ MethodDefinition :
+ get ClassElementName () { FunctionBody }
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 33. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that P's [[Kind]] field is either "method" or "accessor" and P's [[Brand]] is F,
+ a. PrivateBrandAdd(F, F).
+ 34. For each item fieldRecord in order from staticFields,
+ a. Perform ? DefineField(F, field).
+
+ PrivateFieldGet (P, O)
+ 1. Assert: P is a Private Name.
+ 2. If O is not an object, throw a TypeError exception.
+ 3. If P.[[Kind]] is "field",
+ ...
+ 4. Perform ? PrivateBrandCheck(O, P).
+ 5. If P.[[Kind]] is "method",
+ ...
+ 6. Else,
+ a. Assert: P.[[Kind]] is "accessor".
+ b. If P does not have a [[Get]] field, throw a TypeError exception.
+ c. Let getter be P.[[Get]].
+ d. Return ? Call(getter, O).
+
+ PrivateBrandCheck(O, P)
+ 1. If O.[[PrivateBrands]] does not contain an entry e such that SameValue(e, P.[[Brand]]) is true,
+ a. Throw a TypeError exception.
+
+---*/
+
+
+class C {
+ static set #f(v) {
+ this._v = v;
+ }
+
+ static access() {
+ this.#f = 'Test262';
+ }
+}
+
+C.access();
+assert.sameValue(C._v, 'Test262');
+assert.throws(TypeError, function() {
+ C.access.call({});
+}, 'Accessed static private setter from an arbitrary object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/static-string-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/static-string-literal-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..9be6b18025
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-string-literal-name-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-string-literal-name.template
+/*---
+description: Syntax error if `arguments` used in class field (static string literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static 'x' = arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/static-string-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/static-string-literal-name-init-err-contains-super.js
new file mode 100644
index 0000000000..6cbe221dcc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/static-string-literal-name-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-static-string-literal-name.template
+/*---
+description: Syntax error if `super()` used in class field (static string literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public, class-static-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static 'x' = super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/string-literal-name-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/string-literal-name-init-err-contains-arguments.js
new file mode 100644
index 0000000000..efdb64b913
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/string-literal-name-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-string-literal-name.template
+/*---
+description: Syntax error if `arguments` used in class field (string literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ 'x' = arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/string-literal-name-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/string-literal-name-init-err-contains-super.js
new file mode 100644
index 0000000000..d5bc2d2ddb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/string-literal-name-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-string-literal-name.template
+/*---
+description: Syntax error if `super()` used in class field (string literal ClassElementName)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ 'x' = super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/super-access-from-arrow-func-on-field.js b/js/src/tests/test262/language/statements/class/elements/super-access-from-arrow-func-on-field.js
new file mode 100644
index 0000000000..39b381e1ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/super-access-from-arrow-func-on-field.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/super-access-from-arrow-func-on-field.case
+// - src/class-elements/default/cls-decl.template
+/*---
+description: super inside arrow functions on field initializer resolves to class' super (field definitions in a class declaration)
+esid: prod-FieldDefinition
+features: [class-fields-public, class-static-fields-public, class]
+flags: [generated]
+info: |
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ SuperProperty:
+ super[Expression]
+ super.IdentifierName
+
+---*/
+
+
+class C {
+ func = () => {
+ super.prop = 'test262';
+ }
+
+ static staticFunc = () => {
+ super.staticProp = 'static test262';
+ }
+}
+
+let c = new C();
+c.func();
+assert.sameValue(c.prop, 'test262');
+
+C.staticFunc();
+assert.sameValue(C.staticProp, 'static test262');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js
new file mode 100644
index 0000000000..72cb666ec7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private getter contains proper HomeObject
+esid: sec-method-definitions-runtime-semantics-classelementevaluation
+info: |
+ MethodDefinition : get ClassElementName () { FunctionBody }
+ 1. Let key be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(key).
+ 3. If the function code for this MethodDefinition is strict mode code, let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let formalParameterList be an instance of the production FormalParameters:[empty] .
+ 6. Let closure be FunctionCreate(Method, formalParameterList, FunctionBody, scope, strict).
+ 7. Perform MakeMethod(closure, homeObject).
+ 8. Perform SetFunctionName(closure, key, "get").
+ 9. If key is a Private Name,
+ a. If key has a [[Kind]] field,
+ i. Assert: key.[[Kind]] is "accessor".
+ ii. Assert: key.[[Brand]] is homeObject.
+ iii. Assert: key does not have a [[Get]] field.
+ iv. Set key.[[Get]] to closure.
+ b. Otherwise,
+ i. Set key.[[Kind]] to "accessor".
+ ii. Set key.[[Brand]] to homeObject.
+ iii. Set key.[[Get]] to closure.
+ 10. Else,
+ a. Let desc be the PropertyDescriptor{[[Get]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
+features: [class-methods-private, class]
+---*/
+
+class A {
+ method() {
+ return "Test262";
+ }
+}
+
+class C extends A {
+ get #m() {
+ return super.method();
+ }
+
+ access() {
+ return this.#m;
+ }
+}
+
+let c = new C();
+assert.sameValue(c.access(), "Test262");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-method.js b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-method.js
new file mode 100644
index 0000000000..df4478828f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-method.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private method contains proper HomeObject
+esid: sec-method-definitions-runtime-semantics-classelementevaluation
+info: |
+ MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
+ 2. ReturnIfAbrupt(methodDef).
+ 3. Perform ? DefineOrdinaryMethod(methodDef.[[Key]], homeObject, methodDef.[[Closure]], _enumerable).
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. Let scope be the running execution context's LexicalEnvironment.
+ 4. If functionPrototype is present as a parameter, then
+ a. Let kind be Normal.
+ b. Let prototype be functionPrototype.
+ 5. Else,
+ a. Let kind be Method.
+ b. Let prototype be the intrinsic object %FunctionPrototype%.
+ 6. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, scope, prototype).
+ 7. Perform MakeMethod(closure, object).
+ 8. Set closure.[[SourceText]] to the source text matched by MethodDefinition.
+ 9. Return the Record { [[Key]]: propKey, [[Closure]]: closure }.
+features: [class-methods-private, class]
+---*/
+
+class A {
+ method() {
+ return "Test262";
+ }
+}
+
+class C extends A {
+ #m() {
+ return super.method();
+ }
+
+ access(o) {
+ return this.#m.call(o);
+ }
+}
+
+let c = new C();
+assert.sameValue(c.access(c), "Test262");
+
+let o = {};
+assert.sameValue(c.access(o), "Test262");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-setter.js b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-setter.js
new file mode 100644
index 0000000000..3a95d15c89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-setter.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Private setter contains proper HomeObject
+esid: sec-method-definitions-runtime-semantics-classelementevaluation
+info: |
+ MethodDefinition : set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+ 1. Let key be the result of evaluating ClassElementName.
+ 2. ReturnIfAbrupt(key).
+ 3. If the function code for this MethodDefinition is strict mode code, let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be FunctionCreate(Method, PropertySetParameterList, FunctionBody, scope, strict).
+ 6. Perform MakeMethod(closure, homeObject).
+ 7. Perform SetFunctionName(closure, key, "set").
+ 8. If key is a Private Name,
+ a. If key has a [[Kind]] field,
+ i. Assert: key.[[Kind]] is "accessor".
+ ii. Assert: key.[[Brand]] is homeObject.
+ iii. Assert: key does not have a [[Set]] field.
+ iv. Set key.[[Set]] to closure.
+ b. Otherwise,
+ i. Set key.[[Kind]] to "accessor".
+ ii. Set key.[[Brand]] to homeObject.
+ iii. Set key.[[Set]] to closure.
+ 9. Else,
+ a. Let desc be the PropertyDescriptor{[[Set]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ b. Perform ? DefinePropertyOrThrow(homeObject, key, desc).
+features: [class-methods-private, class]
+---*/
+
+class A {
+ method(v) {
+ return v;
+ }
+}
+
+class C extends A {
+ set #m(v) {
+ this._v = super.method(v);
+ }
+
+ access() {
+ return this.#m = "Test262";
+ }
+}
+
+let c = new C();
+c.access();
+assert.sameValue(c._v, "Test262");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/super-fielddefinition-initializer-abrupt-completion.js b/js/src/tests/test262/language/statements/class/elements/super-fielddefinition-initializer-abrupt-completion.js
new file mode 100644
index 0000000000..f19282782f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/super-fielddefinition-initializer-abrupt-completion.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Class construction should error if evaluation of field initializer in super errors
+esid: sec-super-keyword-runtime-semantics-evaluation
+info: |
+ Runtime Semantics: Evaluation
+ SuperCall : superArguments
+ 1. Let newTarget be GetNewTarget().
+ 2. If newTarget is undefined, throw a ReferenceError exception.
+ 3. Let func be ? GetSuperConstructor().
+ 4. Let argList be ArgumentListEvaluation of Arguments.
+ 5. ReturnIfAbrupt(argList).
+ 6. Let result be ? Construct(func, argList, newTarget).
+ 7. Let thisER be GetThisEnvironment( ).
+ 8. Let F be thisER.[[FunctionObject]].
+ 9. Assert: F is an ECMAScript function object.
+ 10. Perform ? InitializeInstanceFields(result, F).
+
+ InitializeInstanceFields ( O, constructor )
+ 1. Assert: Type ( O ) is Object.
+ 2. Assert: Assert constructor is an ECMAScript function object.
+ 3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
+ 4. For each item fieldRecord in order from fieldRecords,
+ a. If fieldRecord.[[static]] is false, then
+ i. Perform ? DefineField(O, fieldRecord).
+
+ DefineField(receiver, fieldRecord)
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation.
+ 3. Let fieldName be fieldRecord.[[Name]].
+ 4. Let initializer be fieldRecord.[[Initializer]].
+ 5. If initializer is not empty, then
+ a.Let initValue be ? Call(initializer, receiver).
+
+features: [class, class-fields-public]
+---*/
+
+function f() {
+ throw new Test262Error();
+}
+
+class A {
+ x = f();
+}
+
+class C extends A {
+ constructor() {
+ super();
+ }
+}
+
+assert.throws(Test262Error, function() {
+ new C();
+})
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/browser.js b/js/src/tests/test262/language/statements/class/elements/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/browser.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js
new file mode 100644
index 0000000000..725572fa81
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/class-heritage-array-literal-arrow-heritage.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if an array literal evaluated on ClassHeritage uses a private name. (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+
+ ClassHeritage :
+ extends LeftHandSideExpression
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends () => {} {
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js
new file mode 100644
index 0000000000..64b65965ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/class-heritage-array-literal-async-arrow-heritage.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if an array literal evaluated on ClassHeritage uses a private name. (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassTail : ClassHeritage { ClassBody }
+
+ ClassHeritage :
+ extends LeftHandSideExpression
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends async () => {} {
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/browser.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..048f87ae90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-get.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class-fields-public, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete (g().#m);
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..f1e82d4242
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-accessor-set.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-methods-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete (g().#m);
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..c01c57926d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async-gen.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete (g().#m);
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async.js
new file mode 100644
index 0000000000..b1680d7470
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-async.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete (g().#m);
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-gen.js
new file mode 100644
index 0000000000..8bc33c89ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method-gen.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete (g().#m);
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method.js
new file mode 100644
index 0000000000..792f66b899
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-method.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete (g().#m);
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-no-reference.js
new file mode 100644
index 0000000000..3a2f9fc0ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-private-no-reference.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete (g().#m);
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-privatename.js
new file mode 100644
index 0000000000..adcb626c91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-call-expression-privatename.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete (g().#x);
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..d95a5b6e45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-get.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete (this.#m
+);
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..76c28d6d14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-accessor-set.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete (this.#m
+);
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..6716eb230d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async-gen.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete (this.#m
+);
+ async *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async.js
new file mode 100644
index 0000000000..6e0de9f02e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-async.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete (this.#m
+);
+ async #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-gen.js
new file mode 100644
index 0000000000..34b4efadd9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method-gen.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete (this.#m
+);
+ *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method.js
new file mode 100644
index 0000000000..2cfddf0c62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-method.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete (this.#m
+);
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-no-reference.js
new file mode 100644
index 0000000000..0b939313b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-private-no-reference.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete (this.#m);
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-privatename.js
new file mode 100644
index 0000000000..c532a4fa2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-covered-err-delete-member-expression-privatename.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-field-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in field, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete (this.#x);
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..375e2833c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-get.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class-fields-public, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete g().#m;
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..b339bee24d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-accessor-set.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-methods-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete g().#m;
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..4d5768d06f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async-gen.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete g().#m;
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async.js
new file mode 100644
index 0000000000..65f6b800af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-async.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete g().#m;
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-gen.js
new file mode 100644
index 0000000000..e06dbede59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method-gen.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete g().#m;
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method.js
new file mode 100644
index 0000000000..8de8b86e6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-method.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete g().#m;
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-no-reference.js
new file mode 100644
index 0000000000..a4b681b2c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-private-no-reference.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete g().#m;
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-privatename.js
new file mode 100644
index 0000000000..23398a4b22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-call-expression-privatename.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete g().#x;
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..ff62273759
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-get.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete this.#m
+;
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..443d044fe8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-accessor-set.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete this.#m
+;
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..957c608694
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async-gen.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete this.#m
+;
+ async *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async.js
new file mode 100644
index 0000000000..9d3045d1fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-async.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete this.#m
+;
+ async #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-gen.js
new file mode 100644
index 0000000000..841b0e7a85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method-gen.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete this.#m
+;
+ *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method.js
new file mode 100644
index 0000000000..75017d0272
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-method.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete this.#m
+;
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-no-reference.js
new file mode 100644
index 0000000000..b36c9bfe9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-private-no-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete this.#m;
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-privatename.js
new file mode 100644
index 0000000000..f2abd8f4df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-err-delete-member-expression-privatename.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-field-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in field)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete this.#x;
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..b4cc315b32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class-fields-public, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete ((g().#m));
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..439cc8f1b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-methods-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete ((g().#m));
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..af61de31e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete ((g().#m));
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async.js
new file mode 100644
index 0000000000..793a100152
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-async.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete ((g().#m));
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-gen.js
new file mode 100644
index 0000000000..221b83ffa4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method-gen.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete ((g().#m));
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method.js
new file mode 100644
index 0000000000..52f0c2e2bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-method.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete ((g().#m));
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-no-reference.js
new file mode 100644
index 0000000000..4ef6ac94fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-private-no-reference.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete ((g().#m));
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-privatename.js
new file mode 100644
index 0000000000..5bcb6fb949
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-call-expression-privatename.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ g = this.f;
+ x = delete ((g().#x));
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..eaeb4e0774
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete ((this.#m
+));
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..4db71f1625
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete ((this.#m
+));
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..ef92e690b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete ((this.#m
+));
+
+ async *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async.js
new file mode 100644
index 0000000000..22ad4c627c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-async.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete ((this.#m
+));
+
+ async #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-gen.js
new file mode 100644
index 0000000000..f2fce899b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method-gen.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete ((this.#m
+));
+
+ *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method.js
new file mode 100644
index 0000000000..eaffab2464
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-method.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete ((this.#m
+));
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-no-reference.js
new file mode 100644
index 0000000000..a8c4055cb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-private-no-reference.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete ((this.#m));
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-privatename.js
new file mode 100644
index 0000000000..e8279b2f45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/field-delete-twice-covered-err-delete-member-expression-privatename.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-field-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in field, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x = delete ((this.#x));
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..2c5e260919
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-get.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class-fields-public, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete (g().#m);
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..851b778f9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-accessor-set.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-methods-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete (g().#m);
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..8c8f1c8757
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async-gen.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete (g().#m);
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async.js
new file mode 100644
index 0000000000..cb2f115354
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-async.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete (g().#m);
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-gen.js
new file mode 100644
index 0000000000..a43392bdfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method-gen.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete (g().#m);
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method.js
new file mode 100644
index 0000000000..e72c2385fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-method.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete (g().#m);
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-no-reference.js
new file mode 100644
index 0000000000..6d0fba7c35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-private-no-reference.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete (g().#m);
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-privatename.js
new file mode 100644
index 0000000000..be6e92d1f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-call-expression-privatename.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete (g().#x);
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..64dc052956
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-get.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete (this.#m
+);
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..d9459ce491
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-accessor-set.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete (this.#m
+);
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..21a539de83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async-gen.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete (this.#m
+);
+ }
+
+ async *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async.js
new file mode 100644
index 0000000000..a5094182f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-async.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete (this.#m
+);
+ }
+
+ async #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-gen.js
new file mode 100644
index 0000000000..9b60741fed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method-gen.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete (this.#m
+);
+ }
+
+ *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method.js
new file mode 100644
index 0000000000..dcb09ae291
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-method.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete (this.#m
+);
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-no-reference.js
new file mode 100644
index 0000000000..ef2bbcd031
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-private-no-reference.js
@@ -0,0 +1,47 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete (this.#m);
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-privatename.js
new file mode 100644
index 0000000000..07c1c079c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-covered-err-delete-member-expression-privatename.js
@@ -0,0 +1,47 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-method-delete-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in method, covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete (this.#x);
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..53d75c453b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-get.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class-fields-public, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete g().#m;
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..6f2aa7fd92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-accessor-set.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-methods-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete g().#m;
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..7e393a5f54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async-gen.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete g().#m;
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async.js
new file mode 100644
index 0000000000..d9e120e502
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-async.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete g().#m;
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-gen.js
new file mode 100644
index 0000000000..93c7464d97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method-gen.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete g().#m;
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method.js
new file mode 100644
index 0000000000..c42ec89007
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-method.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete g().#m;
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-no-reference.js
new file mode 100644
index 0000000000..195ace594a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-private-no-reference.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete g().#m;
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-privatename.js
new file mode 100644
index 0000000000..3b157abf71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-call-expression-privatename.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete g().#x;
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..145d32372d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-get.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete this.#m
+;
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..478d90b58e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-accessor-set.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete this.#m
+;
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..ed9a763511
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async-gen.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete this.#m
+;
+ }
+
+ async *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async.js
new file mode 100644
index 0000000000..235ef7cafe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-async.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete this.#m
+;
+ }
+
+ async #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-gen.js
new file mode 100644
index 0000000000..2fef15be78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method-gen.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete this.#m
+;
+ }
+
+ *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method.js
new file mode 100644
index 0000000000..baf9e90077
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-method.js
@@ -0,0 +1,42 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete this.#m
+;
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-no-reference.js
new file mode 100644
index 0000000000..eb8974ebbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-private-no-reference.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete this.#m;
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-privatename.js
new file mode 100644
index 0000000000..452281c26f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-err-delete-member-expression-privatename.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-method-delete.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in method)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete this.#x;
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..92d223ff91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-get.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor get method (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class-fields-public, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete ((g().#m));
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..8ff0ddbe26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-accessor-set.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName accessor set method (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private, class-methods-private, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete ((g().#m));
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..3416671362
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async-gen.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async generator (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete ((g().#m));
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async.js
new file mode 100644
index 0000000000..159cc68a91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-async.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName async method (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete ((g().#m));
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-gen.js
new file mode 100644
index 0000000000..7b67503b9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method-gen.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName generator (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete ((g().#m));
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method.js
new file mode 100644
index 0000000000..e42ca69e69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-method.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private ordinary method (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete ((g().#m));
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-no-reference.js
new file mode 100644
index 0000000000..894e6dec11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-private-no-reference.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName no referencing class element (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete ((g().#m));
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-privatename.js
new file mode 100644
index 0000000000..3369ed7036
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-call-expression-privatename.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-call-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to CallExpression.PrivateName private field (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+ var g = this.f;
+ delete ((g().#x));
+ }
+
+ f() {
+ return this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js
new file mode 100644
index 0000000000..f2d177b212
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-get.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-get.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor get method (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete ((this.#m
+));
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js
new file mode 100644
index 0000000000..5dc1a2ce6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-accessor-set.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-accessor-set.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName accessor set method (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete ((this.#m
+));
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js
new file mode 100644
index 0000000000..587b65efaa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async-gen.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async generator (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-iteration, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete ((this.#m
+));
+ }
+
+ async *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async.js
new file mode 100644
index 0000000000..f76f8015b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-async.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-async.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName async method (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, async-functions, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete ((this.#m
+));
+ }
+
+ async #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-gen.js
new file mode 100644
index 0000000000..573901042b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method-gen.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method-gen.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName generator (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, generators, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete ((this.#m
+));
+ }
+
+ *#m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method.js
new file mode 100644
index 0000000000..e5467a13e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-method.js
@@ -0,0 +1,48 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-method.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private ordinary method (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class-methods-private, class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete ((this.#m
+));
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-no-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-no-reference.js
new file mode 100644
index 0000000000..568d177eaf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-private-no-reference.js
@@ -0,0 +1,47 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-private-no-reference.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName no referencing class element (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete ((this.#m));
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-privatename.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-privatename.js
new file mode 100644
index 0000000000..60ba271d21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/method-delete-twice-covered-err-delete-member-expression-privatename.js
@@ -0,0 +1,47 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/err-delete-member-expression-privatename.case
+// - src/class-elements/delete-error/cls-decl-method-delete-twice-covered.template
+/*---
+description: It's a SyntaxError if delete operator is applied to MemberExpression.PrivateName private field (in method, recursively covered)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ This file must never use the onlyStrict flag as the strict mode should always
+ be observed inside class bodies.
+
+ Static Semantics: Early Errors
+
+ UnaryExpression : delete UnaryExpression
+
+ It is a Syntax Error if the UnaryExpression is contained in strict mode
+ code and the derived UnaryExpression is
+ PrimaryExpression : IdentifierReference ,
+ MemberExpression : MemberExpression.PrivateName , or
+ CallExpression : CallExpression.PrivateName .
+
+ It is a Syntax Error if the derived UnaryExpression is
+ PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList and
+ CoverParenthesizedExpressionAndArrowParameterList ultimately derives a
+ phrase that, if used in place of UnaryExpression, would produce a
+ Syntax Error according to these rules. This rule is recursively applied.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ x() {
+
+ delete ((this.#x));
+ }
+
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/shell.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/delete/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-class-body-ctor-duplicate.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-class-body-ctor-duplicate.js
new file mode 100644
index 0000000000..db30575dd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-class-body-ctor-duplicate.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-class-body-ctor-duplicate.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It is a SyntaxError if the class body has more than one constructor (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrototypePropertyNameList of ClassElementList contains more
+ than one occurrence of "constructor".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ constructor() {}
+ constructor() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js
new file mode 100644
index 0000000000..70fbce6ef2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-ctor-super-no-heritage.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-ctor-super-no-heritage.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It is a SyntaxError if class has no heritage and constructor has a direct super (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassTail : ClassHeritageopt { ClassBody }
+
+ It is a Syntax Error if ClassHeritage is not present and the following algorithm evaluates to true:
+ 1. Let constructor be ConstructorMethod of ClassBody.
+ 2. If constructor is empty, return false.
+ 3. Return HasDirectSuper of constructor.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ constructor() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-ues-error.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-ues-error.js
new file mode 100644
index 0000000000..8da16c9904
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-ues-error.js
@@ -0,0 +1,71 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-field-identifier-invalid-ues-error.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Invalid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+ StringLiteral
+ NumericLiteral
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart ::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart ::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue ::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ \u0000;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js
new file mode 100644
index 0000000000..6b445d097d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwj-error.js
@@ -0,0 +1,71 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-field-identifier-invalid-zwj-error.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Invalid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+ StringLiteral
+ NumericLiteral
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart ::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart ::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue ::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ \u200D_ZWJ;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js
new file mode 100644
index 0000000000..da49b2eddb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-field-identifier-invalid-zwnj-error.js
@@ -0,0 +1,71 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-field-identifier-invalid-zwnj-error.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Invalid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+ StringLiteral
+ NumericLiteral
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart ::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart ::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue ::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ \u200C_ZWNJ;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-fields-same-line-error.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-fields-same-line-error.js
new file mode 100644
index 0000000000..be7608def1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-fields-same-line-error.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-fields-same-line-error.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: SyntaxError (class declaration)
+esid: prod-ClassElement
+features: [class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x y
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-array-literal.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-array-literal.js
new file mode 100644
index 0000000000..de14f96cd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-array-literal.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-private-environment-on-class-heritage-array-literal.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if an array literal evaluated on ClassHeritage uses a private name. (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context.
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ 8. If ClassBodyopt is present, then
+ a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt,
+ i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
+ 9. If ClassHeritageopt is not present, then
+ a. Let protoParent be the intrinsic object %ObjectPrototype%.
+ b. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ 10. Else,
+ a. Set the running execution context's LexicalEnvironment to classScope.
+ b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage.
+ ...
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends (o) => [o.#foo]
+{
+ #foo;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage.js
new file mode 100644
index 0000000000..94986520f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-chained-usage.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-private-environment-on-class-heritage-chained-usage.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class expression evaluated on ClassHeritage uses an private name declared on subclass. (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context.
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ 8. If ClassBodyopt is present, then
+ a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt,
+ i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
+ 9. If ClassHeritageopt is not present, then
+ a. Let protoParent be the intrinsic object %ObjectPrototype%.
+ b. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ 10. Else,
+ a. Set the running execution context's LexicalEnvironment to classScope.
+ b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage.
+ ...
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends class extends class extends class { x = this.#foo; } { #foo; x = this.#bar; } { #bar; x = this.#fuz; }
+{
+ #fuz;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js
new file mode 100644
index 0000000000..2d65e00933
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-private-environment-on-class-heritage-function-expression.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a function expression evaluated on ClassHeritage uses a private name. (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context.
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ 8. If ClassBodyopt is present, then
+ a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt,
+ i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
+ 9. If ClassHeritageopt is not present, then
+ a. Let protoParent be the intrinsic object %ObjectPrototype%.
+ b. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ 10. Else,
+ a. Set the running execution context's LexicalEnvironment to classScope.
+ b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage.
+ ...
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends function() { x = this.#foo; }
+{
+ #foo;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-obj-literal.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-obj-literal.js
new file mode 100644
index 0000000000..014716a774
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-obj-literal.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-private-environment-on-class-heritage-obj-literal.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a object literal evaluated on ClassHeritage uses a private name. (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context.
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ 8. If ClassBodyopt is present, then
+ a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt,
+ i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
+ 9. If ClassHeritageopt is not present, then
+ a. Let protoParent be the intrinsic object %ObjectPrototype%.
+ b. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ 10. Else,
+ a. Set the running execution context's LexicalEnvironment to classScope.
+ b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage.
+ ...
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends (o) => {x: o.#foo}
+{
+ #foo;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive.js
new file mode 100644
index 0000000000..0b8435a1a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-recursive.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-private-environment-on-class-heritage-recursive.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class expression evaluated on ClassHeritage of a ClassHeritage uses an undeclared private name. (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context.
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ 8. If ClassBodyopt is present, then
+ a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt,
+ i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
+ 9. If ClassHeritageopt is not present, then
+ a. Let protoParent be the intrinsic object %ObjectPrototype%.
+ b. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ 10. Else,
+ a. Set the running execution context's LexicalEnvironment to classScope.
+ b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage.
+ ...
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends class extends class { x = this.#foo; } {}
+{
+ #foo;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage.js
new file mode 100644
index 0000000000..b981b75d32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-private-environment-on-class-heritage.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class expression evaluated on ClassHeritage uses an undeclared private name. (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage { ClassBody }
+ ...
+ 5. Let outerPrivateEnvironment be the PrivateEnvironment of the running execution context.
+ 6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
+ 7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
+ 8. If ClassBodyopt is present, then
+ a. For each element dn of the PrivateBoundIdentifiers of ClassBodyopt,
+ i. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
+ 9. If ClassHeritageopt is not present, then
+ a. Let protoParent be the intrinsic object %ObjectPrototype%.
+ b. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ 10. Else,
+ a. Set the running execution context's LexicalEnvironment to classScope.
+ b. NOTE: The running execution context's PrivateEnvironment is outerPrivateEnvironment when evaluating ClassHeritage.
+ ...
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends class { x = this.#foo; }
+{
+ #foo;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js
new file mode 100644
index 0000000000..8254217109
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-private-field-on-object-destructuring.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Acessing private field from object destructuring pattern is not a valid syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, destructuring-binding, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ObjectAssignmentPattern[Yield, Await]:
+ {}
+ {AssignmentRestProperty[?Yield, ?Await]}
+ {AssignmentPropertyList[?Yield, ?Await]}
+ {AssignmentPropertyList[?Yield, ?Await],AssignmentRestProperty[?Yield, ?Await]opt}
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x = 1;
+
+ destructureX() {
+ const { #x: x } = this;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-field-super-access.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-field-super-access.js
new file mode 100644
index 0000000000..e690edec34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-private-field-super-access.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-private-field-super-access.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Acessing private field from super is not a valid syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ MemberExpression[Yield]:
+ MemberExpression[?Yield].PrivateName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #m = function() { return 'test262'; };
+
+ Child = class extends C {
+ access() {
+ return super.#m;
+ }
+
+ method() {
+ return super.#m();
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async-gen.js
new file mode 100644
index 0000000000..2e03782e03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async-gen.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-async-gen.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private async generator and a private field with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class-fields-private, async-iteration, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #m;
+ async * #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async.js
new file mode 100644
index 0000000000..17162a0fa1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-async.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private async function and a private field with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class-fields-private, async-functions, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #m;
+ async #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-gen.js
new file mode 100644
index 0000000000..446d1695c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-gen.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-gen.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private generator and a private field with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class-fields-private, generators, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #m;
+ * #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js
new file mode 100644
index 0000000000..a8f957f57a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-get-field.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private getter and a private field with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #m;
+ get #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js
new file mode 100644
index 0000000000..e9267a0cb9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-get-get.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains multiple private getters with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ get #m() {}
+ get #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js
new file mode 100644
index 0000000000..063ae79cf2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-meth-field.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private method and a private field with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #m;
+ #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js
new file mode 100644
index 0000000000..e7ceedf914
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-meth-get.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private method and a private getter with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ get #m() {}
+ #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js
new file mode 100644
index 0000000000..9b67e895f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-meth-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains multiple private methods with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #m() {}
+ #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js
new file mode 100644
index 0000000000..732c8f0717
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-meth-set.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private method and a private setter with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ set #m(_) {}
+ #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js
new file mode 100644
index 0000000000..2a4f444bb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-meth-staticfield.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private method and a private static field with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class-static-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static #m;
+ #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js
new file mode 100644
index 0000000000..c505a7eac5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-meth-staticmeth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private method and a private static method with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static #m() {}
+ #m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js
new file mode 100644
index 0000000000..42710bd0d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-set-field.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains a private setter and a private field with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #m;
+ set #m(_) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js
new file mode 100644
index 0000000000..209cf3c7be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-set-set.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It's a SyntaxError if a class contains multiple private setters with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ set #m(_) {}
+ set #m(_) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-constructor.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-constructor.js
new file mode 100644
index 0000000000..2662c8dc9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-constructor.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-constructor.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Private Fields cannot be named constructor (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElementName : PrivateName ;
+ It is a Syntax Error if StringValue of PrivateName is "#constructor"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #constructor
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-error.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-error.js
new file mode 100644
index 0000000000..1dd4589a4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-error.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-error.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigial and IdentifierName (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ # x
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-ues.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-ues.js
new file mode 100644
index 0000000000..a30cc3819d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-ues.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-invalid-ues.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Valid PrivateName Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #\u0000;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js
new file mode 100644
index 0000000000..03d1346bc9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwj-error.js
@@ -0,0 +1,66 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-invalid-zwj-error.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Valid PrivateName Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #\u200D_ZWJ;
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js
new file mode 100644
index 0000000000..d08d92b990
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-identifier-invalid-zwnj-error.js
@@ -0,0 +1,66 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-invalid-zwnj-error.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Valid PrivateName Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #\u200C_ZWNJ;
+
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js
new file mode 100644
index 0000000000..ea4682b234
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-in-computed-property-missing.js
@@ -0,0 +1,53 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-in-computed-property-missing.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Use of undeclared PrivateName in ComputedProperty is a syntax error (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class-fields-public, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElementName:
+ PropertyName
+ PrivateIdentifier
+
+ PropertyName:
+ LiteralPropertyName
+ ComputedPropertyName
+
+ ComputedPropertyName:
+ [ AssignmentExpression ]
+
+ AssignmentExpression ... MemberExpression
+
+ MemberExpression:
+ MemberExpression . PrivateName
+
+ Static Semantics: AllPrivateIdentifiersValid
+ AllPrivateIdentifiersValid is an abstract operation which takes names as an argument.
+
+ MemberExpression : MemberExpression . PrivateIdentifier
+ 1. If StringValue of PrivateIdentifier is in names, return true.
+ 2. Return false.
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundIdentifiers of ClassBody.
+ 2. Return AllPrivateIdentifiersValid of ClassElementList with the argument newNames.
+
+ Static Semantics: Early Errors
+
+ ScriptBody : StatementList
+ It is a Syntax Error if AllPrivateIdentifiersValid of StatementList with an empty List as an argument is false unless the source code is eval code that is being processed by a direct eval.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ [this.#f] = 'Test262'
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-get-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-get-meth.js
new file mode 100644
index 0000000000..cff10054a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-get-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-accessor-get-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName () (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ get # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-set-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-set-meth.js
new file mode 100644
index 0000000000..0868afc3c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-accessor-set-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-accessor-set-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Accessor set Method) (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ set # m(_) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-gen-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-gen-meth.js
new file mode 100644
index 0000000000..0eb87b2265
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-gen-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-async-gen-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Async Generator Method) (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ async * # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-meth.js
new file mode 100644
index 0000000000..4faf4f22df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-async-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-async-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Async Method) (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ async # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-call-expr.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-call-expr.js
new file mode 100644
index 0000000000..a458dfd915
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-call-expr.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-call-expr.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (CallExpression) (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ MemberExpression :
+ MemberExpression . PrivateName
+
+ CallExpression :
+ CallExpression . PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+
+ f() {
+ return this;
+ }
+
+ m() {
+ this.f().# x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field-init.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field-init.js
new file mode 100644
index 0000000000..4dc6ea1095
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field-init.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-field-init.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Field with Initializer) (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ # x = 1;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field.js
new file mode 100644
index 0000000000..ca62d39397
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-field.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-field.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Field) (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ # x;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-gen-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-gen-meth.js
new file mode 100644
index 0000000000..d16e23ef6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-gen-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-gen-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Generator Method) (class declaration)
+esid: prod-ClassElement
+features: [generators, class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ * # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-member-expr.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-member-expr.js
new file mode 100644
index 0000000000..34dd6ab17d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-member-expr.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-member-expr.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (MemberExpression) (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ MemberExpression :
+ MemberExpression . PrivateName
+
+ CallExpression :
+ CallExpression . PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+ m() {
+ this.# x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-meth.case.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-meth.case.js
new file mode 100644
index 0000000000..b43126fdf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-meth.case.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-meth.case.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Method) (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-get-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-get-meth.js
new file mode 100644
index 0000000000..baf73f5c4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-get-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-static-accessor-get-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Static Accessor get Method) (class declaration)
+esid: prod-ClassElement
+features: [class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static get # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-set-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-set-meth.js
new file mode 100644
index 0000000000..1bdb780ff9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-accessor-set-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-static-accessor-set-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Static Accessor set Method) (class declaration)
+esid: prod-ClassElement
+features: [class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static set # m(_) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-gen-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-gen-meth.js
new file mode 100644
index 0000000000..dba900b549
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-gen-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-static-async-gen-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Static Async Generator Method) (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static async * # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-meth.js
new file mode 100644
index 0000000000..9f6173efa6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-async-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-static-async-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Async Method) (class declaration)
+esid: prod-ClassElement
+features: [class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static async # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field-init.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field-init.js
new file mode 100644
index 0000000000..0ad5d4d5ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field-init.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-static-field-init.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Static Field with Initializer) (class declaration)
+esid: prod-ClassElement
+features: [class-static-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static # x = 1;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field.js
new file mode 100644
index 0000000000..eb8f843799
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-field.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-static-field.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Static Field) (class declaration)
+esid: prod-ClassElement
+features: [class-static-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static # x;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-gen-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-gen-meth.js
new file mode 100644
index 0000000000..54b6ecabcc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-gen-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-static-gen-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Static Generator Method) (class declaration)
+esid: prod-ClassElement
+features: [generators, class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static * # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-meth.js
new file mode 100644
index 0000000000..36eeb8909e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatename-whitespace-error-static-meth.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-whitespace-error-static-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: No space allowed between sigil and IdentifierName (Static Method) (class declaration)
+esid: prod-ClassElement
+features: [class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Updated Productions
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static # m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatenames-same-line-error.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatenames-same-line-error.js
new file mode 100644
index 0000000000..c8864ba6d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-privatenames-same-line-error.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatenames-same-line-error.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: SyntaxError (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ #x #y
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async-gen.js
new file mode 100644
index 0000000000..aab8077de5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async-gen.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-async-gen.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Async Generator Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ async * method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async.js
new file mode 100644
index 0000000000..747a8d620c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-async.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-async.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Async Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ async method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-gen.js
new file mode 100644
index 0000000000..99f1e7063c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-gen.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-gen.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Generator Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [generators, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ * method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-get.js
new file mode 100644
index 0000000000..a048d184b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-get.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-get.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Accessor get Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ get method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-method.js
new file mode 100644
index 0000000000..0875eaebee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-method.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-method.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async-gen.js
new file mode 100644
index 0000000000..3e917f35d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async-gen.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-private-async-gen.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Private Async Generators Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ async * #method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async.js
new file mode 100644
index 0000000000..fc85b76c65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-async.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-private-async.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Private Async Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ async #method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-gen.js
new file mode 100644
index 0000000000..fedbf4f537
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-gen.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-private-gen.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Private Generators Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [generators, class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ * #method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-method.js
new file mode 100644
index 0000000000..225be8c596
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-private-method.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-private-method.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Private Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ #method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-set.js
new file mode 100644
index 0000000000..61e1a5822d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-contains-super-set.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-contains-super-set.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Accessor set Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ set method(_) {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js
new file mode 100644
index 0000000000..dd194f37ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-gen.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-ctor-async-gen.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Async Generator Methods cannot be named "constructor" (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ async * constructor() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js
new file mode 100644
index 0000000000..060b9ba43b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-async-meth.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-ctor-async-meth.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Async Methods cannot be named "constructor" (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ async constructor() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js
new file mode 100644
index 0000000000..450de53c77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-gen.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-ctor-gen.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Generator Methods cannot be named "constructor" (class declaration)
+esid: prod-ClassElement
+features: [generators, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ * constructor() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js
new file mode 100644
index 0000000000..00c65e6241
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-get.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-ctor-get.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Accessor get Methods cannot be named "constructor" (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ get constructor() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js
new file mode 100644
index 0000000000..8f256e51c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-special-meth-ctor-set.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-meth-ctor-set.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Accessor set Methods cannot be named "constructor" (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ set constructor(_) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js
new file mode 100644
index 0000000000..2441d89e52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-prototype.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-async-gen-meth-prototype.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Async Generator Methods cannot be named prototype (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static async * prototype() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-super.js
new file mode 100644
index 0000000000..25c654dfb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-gen-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-async-gen-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Async Generator Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static async * method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js
new file mode 100644
index 0000000000..dc9adf1f87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-prototype.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-async-meth-prototype.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Async Methods cannot be named prototype (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static async prototype() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-super.js
new file mode 100644
index 0000000000..04d2fce7c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-async-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-async-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Async Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static async method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js
new file mode 100644
index 0000000000..9b9c8652eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-prototype.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-gen-meth-prototype.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Generator Methods cannot be named prototype (class declaration)
+esid: prod-ClassElement
+features: [generators, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static * prototype() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-super.js
new file mode 100644
index 0000000000..d24645e094
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-gen-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-gen-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Generator Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [generators, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static * method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js
new file mode 100644
index 0000000000..bec83f9f53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-prototype.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-get-meth-prototype.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Accessor get Methods cannot be named prototype (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static get prototype() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-super.js
new file mode 100644
index 0000000000..9512bc196d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-get-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-get-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Accessor get Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static get method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-meth-prototype.js
new file mode 100644
index 0000000000..1266ed80d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-meth-prototype.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-meth-prototype.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Methods cannot be named prototype (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static prototype() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-meth-super.js
new file mode 100644
index 0000000000..8ae98066f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-constructor.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-constructor.js
new file mode 100644
index 0000000000..758ef67cb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-constructor.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-async-gen-meth-constructor.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Async Generator Private Methods cannot be named constructor (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElementName : PrivateName ;
+ It is a Syntax Error if StringValue of PrivateName is "#constructor"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static async * #constructor() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-super.js
new file mode 100644
index 0000000000..19b6d5b5d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-gen-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-async-gen-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Async Generator Private Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static async * #method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-meth-constructor.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-meth-constructor.js
new file mode 100644
index 0000000000..da9f303bc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-meth-constructor.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-async-meth-constructor.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Async Private Methods cannot be named constructor (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElementName : PrivateName ;
+ It is a Syntax Error if StringValue of PrivateName is "#constructor"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static async #constructor() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-meth-super.js
new file mode 100644
index 0000000000..cf74261edd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-async-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-async-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Async Private Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static async #method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-gen-meth-constructor.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-gen-meth-constructor.js
new file mode 100644
index 0000000000..4f5d06c598
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-gen-meth-constructor.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-gen-meth-constructor.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Generator Private Methods cannot be named constructor (class declaration)
+esid: prod-ClassElement
+features: [generators, class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElementName : PrivateName ;
+ It is a Syntax Error if StringValue of PrivateName is "#constructor"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static * #constructor() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-gen-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-gen-meth-super.js
new file mode 100644
index 0000000000..e325b10007
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-gen-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-gen-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Generator Private Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [generators, class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static * #method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-meth-constructor.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-meth-constructor.js
new file mode 100644
index 0000000000..e1631c7cf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-meth-constructor.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-meth-constructor.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Private Methods cannot be named constructor (class declaration)
+esid: prod-ClassElement
+features: [class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElementName : PrivateName ;
+ It is a Syntax Error if StringValue of PrivateName is "#constructor"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static #constructor() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-meth-super.js
new file mode 100644
index 0000000000..9518ab56ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-private-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Private Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [class-static-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static #method() {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-privatename-constructor.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-privatename-constructor.js
new file mode 100644
index 0000000000..5384df5dfe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-privatename-constructor.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-privatename-constructor.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Private Fields cannot be named constructor (class declaration)
+esid: prod-ClassElement
+features: [class-static-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElementName : PrivateName ;
+ It is a Syntax Error if StringValue of PrivateName is "#constructor"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static #constructor
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js
new file mode 100644
index 0000000000..24c099802d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-prototype.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-set-meth-prototype.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Accessor set Methods cannot be named prototype (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ static set prototype(_) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-super.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-super.js
new file mode 100644
index 0000000000..66475a758c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/grammar-static-set-meth-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-set-meth-super.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: Static Accessor set Methods cannot contain direct super (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends Function{
+ static set method(_) {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/browser.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js
new file mode 100644
index 0000000000..40c53ece98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-field-initializer.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ f = (() => {})().#x
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js
new file mode 100644
index 0000000000..68341532c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/cls-decl-field-initializer.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ f = (() => this)().#x
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js
new file mode 100644
index 0000000000..615c5a91d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-field-initializer-fn.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, function in class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ f = function() { (() => {})().#x }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js
new file mode 100644
index 0000000000..953d7c6f8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/cls-decl-field-initializer-fn.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, function in class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ f = function() { (() => this)().#x }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js
new file mode 100644
index 0000000000..060ba0152f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-field-initializer-fn.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, function in class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ f = function() { something.#x }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js
new file mode 100644
index 0000000000..c2852bb8a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/cls-decl-field-initializer-fn.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, function in class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ f = function() { this.#x }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js
new file mode 100644
index 0000000000..4db6d17b25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-field-initializer.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ f = something.#x
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js
new file mode 100644
index 0000000000..cec95a1460
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/cls-decl-field-initializer.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ f = this.#x
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js
new file mode 100644
index 0000000000..06d1a91584
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-bad-reference.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-field-initializer-heritage.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+
+$DONOTEVALUATE();
+
+class Parent {
+ #x = 42;
+}
+
+class C extends Parent {
+ f = (() => {})().#x
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js
new file mode 100644
index 0000000000..483a835d70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-call-expression-this.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/cls-decl-field-initializer-heritage.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+
+$DONOTEVALUATE();
+
+class Parent {
+ #x = 42;
+}
+
+class C extends Parent {
+ f = (() => this)().#x
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js
new file mode 100644
index 0000000000..dce5883462
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-bad-reference.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-field-initializer-heritage.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+
+$DONOTEVALUATE();
+
+class Parent {
+ #x = 42;
+}
+
+class C extends Parent {
+ f = something.#x
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js
new file mode 100644
index 0000000000..fb8dceaf2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/fields-init-heritage-member-expression-this.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/cls-decl-field-initializer-heritage.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, class field initializer in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+
+$DONOTEVALUATE();
+
+class Parent {
+ #x = 42;
+}
+
+class C extends Parent {
+ f = this.#x
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js
new file mode 100644
index 0000000000..a3b8d6b0f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-method.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() { (() => {})().#x }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js
new file mode 100644
index 0000000000..6596ef5dc0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/cls-decl-method.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() { (() => this)().#x }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js
new file mode 100644
index 0000000000..7296cac6a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js
@@ -0,0 +1,45 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-method-fn.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, inner function in method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() {
+ function fn() { (() => {})().#x }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js
new file mode 100644
index 0000000000..13559da5b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js
@@ -0,0 +1,45 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/cls-decl-method-fn.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, inner function in method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() {
+ function fn() { (() => this)().#x }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js
new file mode 100644
index 0000000000..023631b29a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js
@@ -0,0 +1,45 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-method-fn.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, inner function in method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() {
+ function fn() { something.#x }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js
new file mode 100644
index 0000000000..7ea61ba52a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js
@@ -0,0 +1,45 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/cls-decl-method-fn.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, inner function in method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() {
+ function fn() { this.#x }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js
new file mode 100644
index 0000000000..e43b5446e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-method-heritage.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class Parent {
+ #x = 42;
+}
+
+class C extends Parent {
+ m() {
+ (() => {})().#x
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js
new file mode 100644
index 0000000000..ce7669e83f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/cls-decl-method-heritage.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class Parent {
+ #x = 42;
+}
+
+class C extends Parent {
+ m() {
+ (() => this)().#x
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js
new file mode 100644
index 0000000000..0eeb130e09
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-method-heritage.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class Parent {
+ #x = 42;
+}
+
+class C extends Parent {
+ m() {
+ something.#x
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js
new file mode 100644
index 0000000000..dea9d1d473
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/cls-decl-method-heritage.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class Parent {
+ #x = 42;
+}
+
+class C extends Parent {
+ m() {
+ this.#x
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js
new file mode 100644
index 0000000000..bae36e873a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-method.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() { something.#x }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js
new file mode 100644
index 0000000000..baf7573389
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/cls-decl-method.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, method in class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() { this.#x }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js
new file mode 100644
index 0000000000..b66bdcf9fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-outter-method.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, method in outter class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() {
+ class Outter {
+ #x = 42;
+ }
+
+ this.#x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js
new file mode 100644
index 0000000000..7d989a3e74
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/cls-decl-outter-method.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, method in outter class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() {
+ class Outter {
+ #x = 42;
+ }
+
+ this.#x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js
new file mode 100644
index 0000000000..8c6ffeb17a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/cls-decl-outter-method.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, method in outter class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() {
+ class Outter {
+ #x = 42;
+ }
+
+ this.#x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js
new file mode 100644
index 0000000000..41926b597c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/cls-decl-outter-method.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, method in outter class declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+
+ ClassBody : ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2. Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements,
+ passing in the names of the caller. If all pieces return true, then return true.
+ If any returns false, return false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ m() {
+ class Outter {
+ #x = 42;
+ }
+
+ this.#x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/shell.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/invalid-names/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-async-generator-cannot-escape-token.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-async-generator-cannot-escape-token.js
new file mode 100644
index 0000000000..f152b5758b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-async-generator-cannot-escape-token.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-async-generator-cannot-escape-token.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: The pound signal in the private async generator cannot be escaped (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, async-iteration, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ PrivateName::
+ # IdentifierName
+
+ U+0023 is the escape sequence for #
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ async * \u0023m() { return 42; }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-async-method-cannot-escape-token.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-async-method-cannot-escape-token.js
new file mode 100644
index 0000000000..cd8caf5df0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-async-method-cannot-escape-token.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-async-method-cannot-escape-token.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: The pound signal in the private async method cannot be escaped (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, async-functions, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ PrivateName::
+ # IdentifierName
+
+ U+0023 is the escape sequence for #
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ async \u0023m() { return 42; }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-call-exp-cannot-escape-token.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-call-exp-cannot-escape-token.js
new file mode 100644
index 0000000000..b949e50764
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-call-exp-cannot-escape-token.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-call-exp-cannot-escape-token.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: The pound signal in the private reference cannot be escaped (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ PrivateName ::
+ # IdentifierName
+
+ MemberExpression :
+ MemberExpression . PrivateName
+
+ CallExpression :
+ CallExpression . PrivateName
+
+ U+0023 is the escape sequence for #
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ method() {
+ foo().\u0023field;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-field-cannot-escape-token.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-field-cannot-escape-token.js
new file mode 100644
index 0000000000..8be2cdca1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-field-cannot-escape-token.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-cannot-escape-token.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: The pound signal in the private field cannot be escaped (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ PrivateName::
+ # IdentifierName
+
+ U+0023 is the escape sequence for #
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ \u0023field;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-generator-cannot-escape-token.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-generator-cannot-escape-token.js
new file mode 100644
index 0000000000..facd9e48c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-generator-cannot-escape-token.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-generator-cannot-escape-token.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: The pound signal in the private generator cannot be escaped (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, generators, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ PrivateName::
+ # IdentifierName
+
+ U+0023 is the escape sequence for #
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ * \u0023m() { return 42; }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-member-exp-cannot-escape-token.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-member-exp-cannot-escape-token.js
new file mode 100644
index 0000000000..61d2b6282c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-member-exp-cannot-escape-token.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-member-exp-cannot-escape-token.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: The pound signal in the private reference cannot be escaped (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ PrivateName ::
+ # IdentifierName
+
+ MemberExpression :
+ MemberExpression . PrivateName
+
+ CallExpression :
+ CallExpression . PrivateName
+
+ U+0023 is the escape sequence for #
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ method() {
+ this.\u0023field;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-method-cannot-escape-token.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-method-cannot-escape-token.js
new file mode 100644
index 0000000000..8084f90cc1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/private-method-cannot-escape-token.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-cannot-escape-token.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: The pound signal in the private method cannot be escaped (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ PrivateName::
+ # IdentifierName
+
+ U+0023 is the escape sequence for #
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ \u0023m() { return 42; }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/shell.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/super-private-access-invalid.js b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/super-private-access-invalid.js
new file mode 100644
index 0000000000..dffad30511
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/early-errors/super-private-access-invalid.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/super-private-access-invalid.case
+// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
+/*---
+description: It is syntax error if PrivateName IdentifierName is accessed on SuperProperty (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ SuperProperty:
+ super[Expression]
+ super.IdentifierName
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C extends B
+{
+ #x() {}
+
+ method() {
+ super.#x();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/shell.js b/js/src/tests/test262/language/statements/class/elements/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/browser.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/browser.js
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js
new file mode 100644
index 0000000000..fdf55541d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-class-body-ctor-no-heritage.js
@@ -0,0 +1,24 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-class-body-ctor-no-heritage.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: A constructor is valid without a super call in the constructor and heritage (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+info: |
+ ClassTail : ClassHeritageopt { ClassBody }
+
+ It is a Syntax Error if ClassHeritage is not present and the following algorithm evaluates to true:
+ 1. Let constructor be ConstructorMethod of ClassBody.
+ 2. If constructor is empty, return false.
+ 3. Return HasDirectSuper of constructor.
+
+---*/
+
+
+class C {
+ constructor() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-accessor.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-accessor.js
new file mode 100644
index 0000000000..eafce8744d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-accessor.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- decorators is not supported
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-field-accessor.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Valid accessor FieldDefinition, ClassElementName, PropertyName Syntax (class declaration)
+esid: prod-ClassElement
+features: [decorators, class]
+flags: [generated]
+info: |
+ FieldDefinition[Yield, Await] :
+ ClassElementName[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt
+ accessor [no LineTerminator here] ClassElementName[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt
+
+---*/
+
+
+class C {
+ accessor $;
+ accessor _;
+ accessor \u{6F};
+ accessor \u2118;
+ accessor ZW_\u200C_NJ;
+ accessor ZW_\u200D_J;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js
new file mode 100644
index 0000000000..d0b8f03ba4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer-alt.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-field-classelementname-initializer-alt.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart ::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart ::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue ::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $ = 1;
+ _ = 2;
+ \u{6F} = 3;
+ ℘ = 4; // DO NOT CHANGE THE NAME OF THIS FIELD
+ ZW_‌_NJ = 5; // DO NOT CHANGE THE NAME OF THIS FIELD
+ ZW_‍_J = 6; // DO NOT CHANGE THE NAME OF THIS FIELD
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer.js
new file mode 100644
index 0000000000..143e21ced4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-classelementname-initializer.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-field-classelementname-initializer.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart ::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart ::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue ::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $ = 1;
+ _ = 2;
+ \u{6F} = 3;
+ \u2118 = 4;
+ ZW_\u200C_NJ = 5;
+ ZW_\u200D_J = 6;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier-alt.js
new file mode 100644
index 0000000000..37c11e23d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier-alt.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-field-identifier-alt.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+ StringLiteral
+ NumericLiteral
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart ::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart ::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue ::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $;
+ _;
+ \u{6F};
+ ℘; // DO NOT CHANGE THE NAME OF THIS FIELD
+ ZW_‌_NJ; // DO NOT CHANGE THE NAME OF THIS FIELD
+ ZW_‍_J; // DO NOT CHANGE THE NAME OF THIS FIELD
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier.js
new file mode 100644
index 0000000000..0151ed8286
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-field-identifier.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-field-identifier.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+ StringLiteral
+ NumericLiteral
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart ::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart ::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue ::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ $;
+ _;
+ \u{6F};
+ \u2118;
+ ZW_\u200C_NJ;
+ ZW_\u200D_J;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-fields-multi-line.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-fields-multi-line.js
new file mode 100644
index 0000000000..73bde20af2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-fields-multi-line.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-fields-multi-line.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Valid multi-line, multi-field (class declaration)
+esid: prod-ClassElement
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+---*/
+
+
+class C {
+ x
+ y
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js
new file mode 100644
index 0000000000..482b6920dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js
@@ -0,0 +1,23 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-get-set.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: It's valid if a class contains a private getter and a private setter with the same name (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+class C {
+ get #m() {}
+ set #m(_) {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js
new file mode 100644
index 0000000000..ef9ea621c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js
@@ -0,0 +1,28 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatemeth-duplicate-meth-nestedclassmeth.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: It's valid if a nested class shadows a private method (class declaration)
+esid: prod-ClassElement
+features: [class-methods-private, class]
+flags: [generated]
+info: |
+ Static Semantics: Early Errors
+
+ ClassBody : ClassElementList
+ It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
+
+---*/
+
+
+class C {
+ constructor() {
+ class B {
+ #m() {}
+ }
+ }
+
+ #m() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js
new file mode 100644
index 0000000000..c741b7755d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-classelementname-initializer-alt.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Valid PrivateName = Initializer Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1;
+ #_ = 2;
+ #\u{6F} = 3;
+ #℘ = 4; // DO NOT CHANGE THE NAME OF THIS FIELD
+ #ZW_‌_NJ = 5; // DO NOT CHANGE THE NAME OF THIS FIELD
+ #ZW_‍_J = 6; // DO NOT CHANGE THE NAME OF THIS FIELD
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js
new file mode 100644
index 0000000000..e80e425b7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-classelementname-initializer.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Valid PrivateName = Initializer Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ Initializer :
+ = AssignmentExpression
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$ = 1;
+ #_ = 2;
+ #\u{6F} = 3;
+ #\u2118 = 4;
+ #ZW_\u200C_NJ = 5;
+ #ZW_\u200D_J = 6;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-identifier.js
new file mode 100644
index 0000000000..d0166b4b60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-identifier.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Valid PrivateName Syntax (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ #$;
+ #_;
+ #\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js
new file mode 100644
index 0000000000..200f8b280e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-no-initializer-with-method.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: SyntaxError (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+class C {
+ #x
+ m() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatenames-multi-line.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatenames-multi-line.js
new file mode 100644
index 0000000000..e00ef3ed47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-privatenames-multi-line.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatenames-multi-line.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: SyntaxError (class declaration)
+esid: prod-ClassElement
+features: [class-fields-private, class]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+---*/
+
+
+class C {
+ #x
+ #y
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js
new file mode 100644
index 0000000000..d3cb1b1ce1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-accessor-meth-valid.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-prototype-accessor-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Accessor Methods can be named "prototype" (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage_opt { ClassBody_opt }
+
+ [...]
+ 6. Let proto be OrdinaryObjectCreate(protoParent).
+ [...]
+ 14. Perform MakeConstructor(F, false, proto).
+ [...]
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ With parameters object and enumerable.
+
+ MethodDefinition : get PropertyName ( ) { FunctionBody }
+
+ [...]
+ 9. Let desc be the PropertyDescriptor { [[Get]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true }.
+ 10. Return ? DefinePropertyOrThrow(object, propKey, desc).
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ [...]
+ 8. Let desc be the PropertyDescriptor { [[Set]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true }.
+ 9. Return ? DefinePropertyOrThrow(object, propKey, desc).
+
+---*/
+
+
+class C {
+ get prototype() { return 13; }
+ set prototype(_) {}
+}
+
+assert(C.hasOwnProperty('prototype'));
+assert(C.prototype.hasOwnProperty('prototype'));
+assert.notSameValue(C.prototype.prototype, C.prototype);
+assert.sameValue(C.prototype.prototype, 13);
+verifyProperty(C.prototype, 'prototype', {
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js
new file mode 100644
index 0000000000..2c7e0c8f6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-gen-meth-valid.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-prototype-async-gen-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Async Generator Methods can be named "prototype" (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage_opt { ClassBody_opt }
+
+ [...]
+ 6. Let proto be OrdinaryObjectCreate(protoParent).
+ [...]
+ 14. Perform MakeConstructor(F, false, proto).
+ [...]
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ With parameters object and enumerable.
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ [...]
+ 10. Let desc be PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }.
+ 11. Return ? DefinePropertyOrThrow(object, propKey, desc).
+
+---*/
+
+
+class C {
+ async * prototype() {}
+}
+
+assert(C.hasOwnProperty('prototype'));
+assert(C.prototype.hasOwnProperty('prototype'));
+assert.notSameValue(C.prototype.prototype, C.prototype);
+verifyProperty(C.prototype, 'prototype', {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js
new file mode 100644
index 0000000000..17fa1970f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-async-meth-valid.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-prototype-async-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Async Methods can be named "prototype" (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage_opt { ClassBody_opt }
+
+ [...]
+ 6. Let proto be OrdinaryObjectCreate(protoParent).
+ [...]
+ 14. Perform MakeConstructor(F, false, proto).
+ [...]
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ With parameters object and enumerable.
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ [...]
+ 8. Let desc be the PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }.
+ 9. Return ? DefinePropertyOrThrow(object, propKey, desc).
+
+---*/
+
+
+class C {
+ async prototype() {}
+}
+
+assert(C.hasOwnProperty('prototype'));
+assert(C.prototype.hasOwnProperty('prototype'));
+assert.notSameValue(C.prototype.prototype, C.prototype);
+verifyProperty(C.prototype, 'prototype', {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js
new file mode 100644
index 0000000000..ac18e1f825
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-gen-meth-valid.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-prototype-gen-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Generator Methods can be named "prototype" (class declaration)
+esid: prod-ClassElement
+features: [generators, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage_opt { ClassBody_opt }
+
+ [...]
+ 6. Let proto be OrdinaryObjectCreate(protoParent).
+ [...]
+ 14. Perform MakeConstructor(F, false, proto).
+ [...]
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ With parameters object and enumerable.
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ [...]
+ 10. Let desc be the PropertyDescriptor { [[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }.
+ 11. Return ? DefinePropertyOrThrow(object, propKey, desc).
+
+---*/
+
+
+class C {
+ * prototype() {}
+}
+
+assert(C.hasOwnProperty('prototype'));
+assert(C.prototype.hasOwnProperty('prototype'));
+assert.notSameValue(C.prototype.prototype, C.prototype);
+verifyProperty(C.prototype, 'prototype', {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js
new file mode 100644
index 0000000000..04ecfae0a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-special-prototype-meth-valid.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-special-prototype-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Methods can be named "prototype" (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ ClassTail : ClassHeritage_opt { ClassBody_opt }
+
+ [...]
+ 6. Let proto be OrdinaryObjectCreate(protoParent).
+ [...]
+ 14. Perform MakeConstructor(F, false, proto).
+ [...]
+ 20. For each ClassElement m in order from methods, do
+ a. If IsStatic of m is false, then
+ i. Let status be PropertyDefinitionEvaluation of m with arguments proto and false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ With parameters object and enumerable.
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let desc be the PropertyDescriptor { [[Value]]: methodDef.[[Closure]], [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true }.
+ 4. Return ? DefinePropertyOrThrow(object, methodDef.[[Key]], desc).
+
+---*/
+
+
+class C {
+ prototype() {}
+}
+
+assert(C.hasOwnProperty('prototype'));
+assert(C.prototype.hasOwnProperty('prototype'));
+assert.notSameValue(C.prototype.prototype, C.prototype);
+verifyProperty(C.prototype, 'prototype', {
+ writable: true,
+ enumerable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js
new file mode 100644
index 0000000000..50394530b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-accessor-meth-valid.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-ctor-accessor-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Static Accessor Methods can be named constructor (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "prototype".
+
+---*/
+
+
+class C {
+ static get constructor() {}
+ static set constructor(_) {}
+ constructor() {} // stacks with a valid constructor
+}
+
+assert(C.hasOwnProperty('constructor'));
+assert(C.prototype.hasOwnProperty('constructor'));
+assert.notSameValue(C.prototype.constructor, C.constructor);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js
new file mode 100644
index 0000000000..59d173ff32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-gen-meth-valid.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-ctor-async-gen-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Static Async Generator Methods can be named constructor (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class]
+flags: [generated]
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "prototype".
+
+---*/
+
+
+class C {
+ static async * constructor() {}
+ constructor() {} // stacks with a valid constructor
+}
+
+assert(C.hasOwnProperty('constructor'));
+assert(C.prototype.hasOwnProperty('constructor'));
+assert.notSameValue(C.prototype.constructor, C.constructor);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js
new file mode 100644
index 0000000000..47fbf0c78f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-async-meth-valid.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-ctor-async-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Static Methods can be named constructor (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class]
+flags: [generated]
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "prototype".
+
+---*/
+
+
+class C {
+ static async constructor() {}
+ constructor() {} // stacks with a valid constructor
+}
+
+assert(C.hasOwnProperty('constructor'));
+assert(C.prototype.hasOwnProperty('constructor'));
+assert.notSameValue(C.prototype.constructor, C.constructor);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js
new file mode 100644
index 0000000000..24f54213ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-gen-meth-valid.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-ctor-gen-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Static Generator Methods can be named constructor (class declaration)
+esid: prod-ClassElement
+features: [generators, class]
+flags: [generated]
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "prototype".
+
+---*/
+
+
+class C {
+ static * constructor() {}
+ constructor() {} // stacks with a valid constructor
+}
+
+assert(C.hasOwnProperty('constructor'));
+assert(C.prototype.hasOwnProperty('constructor'));
+assert.notSameValue(C.prototype.constructor, C.constructor);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js
new file mode 100644
index 0000000000..7b778bc72b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-ctor-meth-valid.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-ctor-meth-valid.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Static Methods can be named constructor (class declaration)
+esid: prod-ClassElement
+features: [class]
+flags: [generated]
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
+ It is a Syntax Error if PropName of MethodDefinition is "prototype".
+
+---*/
+
+
+class C {
+ static constructor() {}
+ constructor() {} // stacks with a valid constructor
+}
+
+assert(C.hasOwnProperty('constructor'));
+assert(C.prototype.hasOwnProperty('constructor'));
+assert.notSameValue(C.prototype.constructor, C.constructor);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js
new file mode 100644
index 0000000000..7c7b26a27d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js
@@ -0,0 +1,22 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-async-gen-meth-prototype.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Static Async Generator Private Methods can be named "#prototype" (class declaration)
+esid: prod-ClassElement
+features: [async-iteration, class-static-methods-private, class]
+flags: [generated]
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+class C {
+ static async * #prototype() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js
new file mode 100644
index 0000000000..445dea39c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js
@@ -0,0 +1,22 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-async-meth-prototype.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Static Async Private Methods can be named "#prototype" (class declaration)
+esid: prod-ClassElement
+features: [async-functions, class-static-methods-private, class]
+flags: [generated]
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+class C {
+ static async #prototype() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js
new file mode 100644
index 0000000000..5a15aae437
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js
@@ -0,0 +1,22 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-gen-meth-prototype.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Static Generator Private Methods can be named "#prototype" (class declaration)
+esid: prod-ClassElement
+features: [generators, class-static-methods-private, class]
+flags: [generated]
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+class C {
+ static * #prototype() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-meth-prototype.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-meth-prototype.js
new file mode 100644
index 0000000000..6907ef0886
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/grammar-static-private-meth-prototype.js
@@ -0,0 +1,22 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-static-private-meth-prototype.case
+// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template
+/*---
+description: Static Private Methods can be named "#prototype" (class declaration)
+esid: prod-ClassElement
+features: [class-static-methods-private, class]
+flags: [generated]
+info: |
+ Class Definitions / Static Semantics: Early Errors
+
+ ClassElement : static MethodDefinition
+ It is a Syntax Error if PropName of MethodDefinition is "prototype"
+
+---*/
+
+
+class C {
+ static #prototype() {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/syntax/valid/shell.js b/js/src/tests/test262/language/statements/class/elements/syntax/valid/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/syntax/valid/shell.js
diff --git a/js/src/tests/test262/language/statements/class/elements/ternary-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/ternary-init-err-contains-arguments.js
new file mode 100644
index 0000000000..6d238dc7d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/ternary-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-ternary.template
+/*---
+description: Syntax error if `arguments` used in class field (ternary expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = false ? {} : arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/ternary-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/ternary-init-err-contains-super.js
new file mode 100644
index 0000000000..daff75a0a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/ternary-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-ternary.template
+/*---
+description: Syntax error if `super()` used in class field (ternary expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = false ? {} : super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/typeof-init-err-contains-arguments.js b/js/src/tests/test262/language/statements/class/elements/typeof-init-err-contains-arguments.js
new file mode 100644
index 0000000000..008897003f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/typeof-init-err-contains-arguments.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-arguments.case
+// - src/class-elements/initializer-error/cls-decl-fields-typeof.template
+/*---
+description: Syntax error if `arguments` used in class field (typeof expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if ContainsArguments of Initializer is true.
+
+ Static Semantics: ContainsArguments
+ IdentifierReference : Identifier
+
+ 1. If the StringValue of Identifier is "arguments", return true.
+ ...
+ For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = typeof arguments;
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/typeof-init-err-contains-super.js b/js/src/tests/test262/language/statements/class/elements/typeof-init-err-contains-super.js
new file mode 100644
index 0000000000..ac76975da2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/typeof-init-err-contains-super.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/class-elements/init-err-contains-super.case
+// - src/class-elements/initializer-error/cls-decl-fields-typeof.template
+/*---
+description: Syntax error if `super()` used in class field (typeof expression)
+esid: sec-class-definitions-static-semantics-early-errors
+features: [class, class-fields-public]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Static Semantics: Early Errors
+
+ FieldDefinition:
+ PropertyNameInitializeropt
+
+ - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+class C {
+ x = typeof super();
+}
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-computed-names.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-computed-names.js
new file mode 100644
index 0000000000..30e6024dba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-computed-names.js
@@ -0,0 +1,96 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-names.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Computed property names (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-public, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = "b";
+
+
+
+class C {
+ ;;;;
+ ;;;;;;[x] = 42; [10] = "meep"; ["not initialized"];;;;;;;
+ ;;;;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
+ "10 doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "10"),
+ "10 doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "not initialized"),
+ "'not initialized' doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "not initialized", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-computed-symbol-names.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-computed-symbol-names.js
new file mode 100644
index 0000000000..ce1ebcd921
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-computed-symbol-names.js
@@ -0,0 +1,94 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/computed-symbol-names.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Computed property symbol names (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-public, Symbol, computed-property-names, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+var x = Symbol();
+var y = Symbol();
+
+
+
+class C {
+ ;;;;
+ ;;;;;;[x]; [y] = 42;;;;;;;
+ ;;;;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, x),
+ "Symbol x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, x),
+ "Symbol x doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, y),
+ "Symbol y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, y),
+ "Symbol y doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
+ "x doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "x"),
+ "x doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "x"),
+ "x doesn't appear as an own property on C instance"
+);
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
+ "y doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "y"),
+ "y doesn't appear as an own property on C constructor"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(c, "y"),
+ "y doesn't appear as an own property on C instance"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-grammar-privatename-identifier-semantics-stringvalue.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-grammar-privatename-identifier-semantics-stringvalue.js
new file mode 100644
index 0000000000..662df262e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-grammar-privatename-identifier-semantics-stringvalue.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: PrivateName Static Semantics, StringValue (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+
+ 1. Return the String value consisting of the sequence of code
+ units corresponding to PrivateName. In determining the sequence
+ any occurrences of \ UnicodeEscapeSequence are first replaced
+ with the code point represented by the UnicodeEscapeSequence
+ and then the code points of the entire PrivateName are converted
+ to code units by UTF16Encoding (10.1.1) each code point.
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#\u{6F};
+ #\u2118;
+ #ZW_\u200C_NJ;
+ #ZW_\u200D_J;;;;;;;;
+ ;;;;
+ o(value) {
+ this.#o = value;
+ return this.#o;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.o(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-literal-names-asi.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-literal-names-asi.js
new file mode 100644
index 0000000000..b7c8cba4af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-literal-names-asi.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names-asi.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Literal property names with ASI (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;a
+ b = 42;;;;;;;;
+ ;;;;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-literal-names.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-literal-names.js
new file mode 100644
index 0000000000..14874fa1aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-literal-names.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/literal-names.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Literal property names (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+const fn = function() {}
+
+
+
+class C {
+ ;;;;
+ ;;;;;;a; b = 42;
+ c = fn;;;;;;;
+ ;;;;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c doesn't appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c doesn't appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-field-usage.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-field-usage.js
new file mode 100644
index 0000000000..250732f70e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-field-usage.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-field-usage.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: PrivateName CallExpression usage (private field) (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#m = 'test262';;;;;;;;
+ ;;;;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-method-getter-usage.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-method-getter-usage.js
new file mode 100644
index 0000000000..96dc07fce4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-method-getter-usage.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-getter-usage.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: PrivateName CallExpression usage (Accesor get method) (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;get #m() { return 'test262'; };;;;;;;
+ ;;;;
+ method() {
+ return this.#m;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-method-usage.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-method-usage.js
new file mode 100644
index 0000000000..f40a7674dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-method-usage.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-method-usage.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: PrivateName CallExpression usage (private method) (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ Updated Productions
+
+ CallExpression[Yield, Await]:
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await]
+ SuperCall[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await]
+ CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]]
+ CallExpression[?Yield, ?Await].IdentifierName
+ CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await]
+ CallExpression[?Yield, ?Await].PrivateName
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#m() { return 'test262'; };;;;;;;
+ ;;;;
+ method() {
+ return this.#m();
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.method(), 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-names.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-names.js
new file mode 100644
index 0000000000..cd5fdb0d9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-private-names.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/private-names.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: private names (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#x; #y;;;;;;;
+ ;;;;
+ x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(c.x(), 42, "test 7");
+assert.sameValue(c.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-field-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-field-identifier-initializer.js
new file mode 100644
index 0000000000..b73e3b18f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-field-identifier-initializer.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid FieldDefinition (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;$ = 1; _ = 1; \u{6F} = 1; \u2118 = 1; ZW_\u200C_NJ = 1; ZW_\u200D_J = 1;;;;;;;
+ ;;;;
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-field-identifier.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-field-identifier.js
new file mode 100644
index 0000000000..258d3a90fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-field-identifier.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-field-identifier.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid FieldDefinition (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+
+ PropertyName :
+ LiteralPropertyName
+ ComputedPropertyName
+
+ LiteralPropertyName :
+ IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;$; _; \u{6F}; \u2118; ZW_\u200C_NJ; ZW_\u200D_J;;;;;;;
+ ;;;;
+
+}
+
+var c = new C();
+
+c.$ = 1;
+c._ = 1;
+c.\u{6F} = 1;
+c.\u2118 = 1;
+c.ZW_\u200C_NJ = 1;
+c.ZW_\u200D_J = 1;
+
+assert.sameValue(c.$, 1);
+assert.sameValue(c._, 1);
+assert.sameValue(c.\u{6F}, 1);
+assert.sameValue(c.\u2118, 1);
+assert.sameValue(c.ZW_\u200C_NJ, 1);
+assert.sameValue(c.ZW_\u200D_J, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-getter-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-getter-alt.js
new file mode 100644
index 0000000000..596acd77f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-getter-alt.js
@@ -0,0 +1,116 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName as private getter (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #℘() {
+ return this.#℘_;
+ }
+ get #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ get #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;;;;;;;
+ ;;;;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-getter.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-getter.js
new file mode 100644
index 0000000000..3dc72041ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-getter.js
@@ -0,0 +1,116 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-getter.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName as private getter (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ get ClassElementName ( ){ FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ get #$() {
+ return this.#$_;
+ }
+ get #_() {
+ return this.#__;
+ }
+ get #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ get #\u2118() {
+ return this.#\u2118_;
+ }
+ get #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ get #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;;;;;;;
+ ;;;;
+ $(value) {
+ this.#$_ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-method-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-method-alt.js
new file mode 100644
index 0000000000..b62a4f7d4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-method-alt.js
@@ -0,0 +1,115 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName as private method (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #℘() {
+ return this.#℘_;
+ }
+ #ZW_‌_NJ() {
+ return this.#ZW_‌_NJ_;
+ }
+ #ZW_‍_J() {
+ return this.#ZW_‍_J_;
+ }
+;;;;;;;
+ ;;;;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ ℘(value) {
+ this.#℘_ = value;
+ return this.#℘();
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ return this.#ZW_‌_NJ();
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ return this.#ZW_‍_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-method.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-method.js
new file mode 100644
index 0000000000..64e147f00e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-method.js
@@ -0,0 +1,115 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-method.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName as private method (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ) { FunctionBody }
+ ...
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ #$() {
+ return this.#$_;
+ }
+ #_() {
+ return this.#__;
+ }
+ #\u{6F}() {
+ return this.#\u{6F}_;
+ }
+ #\u2118() {
+ return this.#\u2118_;
+ }
+ #ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ_;
+ }
+ #ZW_\u200D_J() {
+ return this.#ZW_\u200D_J_;
+ }
+;;;;;;;
+ ;;;;
+ $(value) {
+ this.#$_ = value;
+ return this.#$();
+ }
+ _(value) {
+ this.#__ = value;
+ return this.#_();
+ }
+ \u{6F}(value) {
+ this.#\u{6F}_ = value;
+ return this.#\u{6F}();
+ }
+ \u2118(value) {
+ this.#\u2118_ = value;
+ return this.#\u2118();
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ return this.#ZW_\u200C_NJ();
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ return this.#ZW_\u200D_J();
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-setter-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-setter-alt.js
new file mode 100644
index 0000000000..293cb94806
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-setter-alt.js
@@ -0,0 +1,115 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName as private setter (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$_; #__; #\u{6F}_; #℘_; #ZW_‌_NJ_; #ZW_‍_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #℘(value) {
+ this.#℘_ = value;
+ }
+ set #ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ_ = value;
+ }
+ set #ZW_‍_J(value) {
+ this.#ZW_‍_J_ = value;
+ }
+;;;;;;;
+ ;;;;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘_;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ_;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-setter.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-setter.js
new file mode 100644
index 0000000000..e199eac710
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-private-setter.js
@@ -0,0 +1,115 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-private-setter.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName as private setter (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-methods-private, class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ ...
+ ;
+
+ MethodDefinition :
+ ...
+ set ClassElementName ( PropertySetParameterList ) { FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$_; #__; #\u{6F}_; #\u2118_; #ZW_\u200C_NJ_; #ZW_\u200D_J_;
+ set #$(value) {
+ this.#$_ = value;
+ }
+ set #_(value) {
+ this.#__ = value;
+ }
+ set #\u{6F}(value) {
+ this.#\u{6F}_ = value;
+ }
+ set #\u2118(value) {
+ this.#\u2118_ = value;
+ }
+ set #ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ_ = value;
+ }
+ set #ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J_ = value;
+ }
+;;;;;;;
+ ;;;;
+ $(value) {
+ this.#$ = value;
+ return this.#$_;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#__;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F}_;
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118_;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ_;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J_;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-alt.js
new file mode 100644
index 0000000000..d54f48af3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-alt.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$; #_; #\u{6F}; #℘; #ZW_‌_NJ; #ZW_‍_J;;;;;;;
+ ;;;;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ ℘(value) {
+ this.#℘ = value;
+ return this.#℘;
+ }
+ ZW_‌_NJ(value) {
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J(value) {
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.℘(1), 1);
+assert.sameValue(c.ZW_‌_NJ(1), 1);
+assert.sameValue(c.ZW_‍_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..dfce12d03b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer-alt.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$ = 1; #_ = 1; #\u{6F} = 1; #℘ = 1; #ZW_‌_NJ = 1; #ZW_‍_J = 1;;;;;;;
+ ;;;;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ ℘() {
+ return this.#℘;
+ }
+ ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.℘(), 1);
+assert.sameValue(c.ZW_‌_NJ(), 1);
+assert.sameValue(c.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..c8ca2df9b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$ = 1; #_ = 1; #\u{6F} = 1; #\u2118 = 1; #ZW_\u200C_NJ = 1; #ZW_\u200D_J = 1;;;;;;;
+ ;;;;
+ $() {
+ return this.#$;
+ }
+ _() {
+ return this.#_;
+ }
+ \u{6F}() {
+ return this.#\u{6F};
+ }
+ \u2118() {
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.$(), 1);
+assert.sameValue(c._(), 1);
+assert.sameValue(c.\u{6F}(), 1);
+assert.sameValue(c.\u2118(), 1);
+assert.sameValue(c.ZW_\u200C_NJ(), 1);
+assert.sameValue(c.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier.js
new file mode 100644
index 0000000000..33698474f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-privatename-identifier.js
@@ -0,0 +1,97 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;#$; #_; #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J;;;;;;;
+ ;;;;
+ $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(c.$(1), 1);
+assert.sameValue(c._(1), 1);
+assert.sameValue(c.\u{6F}(1), 1);
+assert.sameValue(c.\u2118(1), 1);
+assert.sameValue(c.ZW_\u200C_NJ(1), 1);
+assert.sameValue(c.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..af07c42679
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #o(value) {
+ yield * await value;
+ }
+ static async * #℘(value) {
+ yield * await value;
+ }
+ static async * #ZW_‌_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_‍_J(value) {
+ yield * await value;
+ };;;;;;;
+ ;;;;
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.o([1]).next(),
+ C.℘([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J([1]).next(), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..f4b1e4b5e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js
@@ -0,0 +1,123 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static AsyncGeneratorMethod PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * ClassElementName ( UniqueFormalParameters){ AsyncGeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static async * #$(value) {
+ yield * await value;
+ }
+ static async * #_(value) {
+ yield * await value;
+ }
+ static async * #\u{6F}(value) {
+ yield * await value;
+ }
+ static async * #\u2118(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200C_NJ(value) {
+ yield * await value;
+ }
+ static async * #ZW_\u200D_J(value) {
+ yield * await value;
+ };;;;;;;
+ ;;;;
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+Promise.all([
+ C.$([1]).next(),
+ C._([1]).next(),
+ C.\u{6F}([1]).next(),
+ C.\u2118([1]).next(),
+ C.ZW_\u200C_NJ([1]).next(),
+ C.ZW_\u200D_J([1]).next(),
+]).then(results => {
+
+ assert.sameValue(results[0].value, 1);
+ assert.sameValue(results[1].value, 1);
+ assert.sameValue(results[2].value, 1);
+ assert.sameValue(results[3].value, 1);
+ assert.sameValue(results[4].value, 1);
+ assert.sameValue(results[5].value, 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..71adbfab98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier-alt.js
@@ -0,0 +1,122 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static AsyncMethod PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #o(value) {
+ return await value;
+ }
+ static async #℘(value) {
+ return await value;
+ }
+ static async #ZW_‌_NJ(value) {
+ return await value;
+ }
+ static async #ZW_‍_J(value) {
+ return await value;
+ };;;;;;;
+ ;;;;
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async o(value) {
+ return await this.#o(value);
+ }
+ static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#℘(value);
+ }
+ static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‌_NJ(value);
+ }
+ static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return await this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.o(1),
+ C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js
new file mode 100644
index 0000000000..c8900b18e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-async-method-privatename-identifier.js
@@ -0,0 +1,123 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-async-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static AsyncMethod PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ AsyncMethod
+
+ AsyncMethod :
+ async [no LineTerminator here] ClassElementName ( UniqueFormalParameters ){ AsyncFunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static async #$(value) {
+ return await value;
+ }
+ static async #_(value) {
+ return await value;
+ }
+ static async #\u{6F}(value) {
+ return await value;
+ }
+ static async #\u2118(value) {
+ return await value;
+ }
+ static async #ZW_\u200C_NJ(value) {
+ return await value;
+ }
+ static async #ZW_\u200D_J(value) {
+ return await value;
+ };;;;;;;
+ ;;;;
+ static async $(value) {
+ return await this.#$(value);
+ }
+ static async _(value) {
+ return await this.#_(value);
+ }
+ static async \u{6F}(value) {
+ return await this.#\u{6F}(value);
+ }
+ static async \u2118(value) {
+ return await this.#\u2118(value);
+ }
+ static async ZW_\u200C_NJ(value) {
+ return await this.#ZW_\u200C_NJ(value);
+ }
+ static async ZW_\u200D_J(value) {
+ return await this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+Promise.all([
+ C.$(1),
+ C._(1),
+ C.\u{6F}(1),
+ C.\u2118(1),
+ C.ZW_\u200C_NJ(1),
+ C.ZW_\u200D_J(1),
+]).then(results => {
+
+ assert.sameValue(results[0], 1);
+ assert.sameValue(results[1], 1);
+ assert.sameValue(results[2], 1);
+ assert.sameValue(results[3], 1);
+ assert.sameValue(results[4], 1);
+ assert.sameValue(results[5], 1);
+
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..639550053b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #o(value) {
+ yield * value;
+ }
+ static * #℘(value) {
+ yield * value;
+ }
+ static * #ZW_‌_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_‍_J(value) {
+ yield * value;
+ };;;;;;;
+ ;;;;
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get o() {
+ return this.#o;
+ }
+ static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘;
+ }
+ static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ;
+ }
+ static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.o([1]).next().value, 1);
+assert.sameValue(C.℘([1]).next().value, 1);
+assert.sameValue(C.ZW_‌_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_‍_J([1]).next().value, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js
new file mode 100644
index 0000000000..d32b781a06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js
@@ -0,0 +1,113 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-generator-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static GeneratorMethod PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ GeneratorMethod
+
+ GeneratorMethod :
+ * ClassElementName ( UniqueFormalParameters ){ GeneratorBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static * #$(value) {
+ yield * value;
+ }
+ static * #_(value) {
+ yield * value;
+ }
+ static * #\u{6F}(value) {
+ yield * value;
+ }
+ static * #\u2118(value) {
+ yield * value;
+ }
+ static * #ZW_\u200C_NJ(value) {
+ yield * value;
+ }
+ static * #ZW_\u200D_J(value) {
+ yield * value;
+ };;;;;;;
+ ;;;;
+ static get $() {
+ return this.#$;
+ }
+ static get _() {
+ return this.#_;
+ }
+ static get \u{6F}() {
+ return this.#\u{6F};
+ }
+ static get \u2118() {
+ return this.#\u2118;
+ }
+ static get ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static get ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.$([1]).next().value, 1);
+assert.sameValue(C._([1]).next().value, 1);
+assert.sameValue(C.\u{6F}([1]).next().value, 1);
+assert.sameValue(C.\u2118([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200C_NJ([1]).next().value, 1);
+assert.sameValue(C.ZW_\u200D_J([1]).next().value, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js
new file mode 100644
index 0000000000..bf440f11f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static Method PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #o(value) {
+ return value;
+ }
+ static #℘(value) {
+ return value;
+ }
+ static #ZW_‌_NJ(value) {
+ return value;
+ }
+ static #ZW_‍_J(value) {
+ return value;
+ };;;;;;;
+ ;;;;
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static o(value) {
+ return this.#o(value);
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#℘(value);
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‌_NJ(value);
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ return this.#ZW_‍_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js
new file mode 100644
index 0000000000..7e20ca05ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js
@@ -0,0 +1,110 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-method-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static Method PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ MethodDefinition :
+ ClassElementName ( UniqueFormalParameters ){ FunctionBody }
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #$(value) {
+ return value;
+ }
+ static #_(value) {
+ return value;
+ }
+ static #\u{6F}(value) {
+ return value;
+ }
+ static #\u2118(value) {
+ return value;
+ }
+ static #ZW_\u200C_NJ(value) {
+ return value;
+ }
+ static #ZW_\u200D_J(value) {
+ return value;
+ };;;;;;;
+ ;;;;
+ static $(value) {
+ return this.#$(value);
+ }
+ static _(value) {
+ return this.#_(value);
+ }
+ static \u{6F}(value) {
+ return this.#\u{6F}(value);
+ }
+ static \u2118(value) {
+ return this.#\u2118(value);
+ }
+ static ZW_\u200C_NJ(value) {
+ return this.#ZW_\u200C_NJ(value);
+ }
+ static ZW_\u200D_J(value) {
+ return this.#ZW_\u200D_J(value);
+ }
+
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt-by-classname.js
new file mode 100644
index 0000000000..53c919ff36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt-by-classname.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;;;;;;;
+ ;;;;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static o(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#℘ = value;
+ return C.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‌_NJ = value;
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ C.#ZW_‍_J = value;
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt.js
new file mode 100644
index 0000000000..c71bcea7df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #$; static #_; static #\u{6F}; static #℘; static #ZW_‌_NJ; static #ZW_‍_J;;;;;;;
+ ;;;;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static o(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#℘ = value;
+ return this.#℘;
+ }
+ static ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‌_NJ = value;
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD
+ this.#ZW_‍_J = value;
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.o(1), 1);
+assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-by-classname.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-by-classname.js
new file mode 100644
index 0000000000..88b4fa5341
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-by-classname.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-by-classname.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;;;;;;;
+ ;;;;
+ static $(value) {
+ C.#$ = value;
+ return C.#$;
+ }
+ static _(value) {
+ C.#_ = value;
+ return C.#_;
+ }
+ static \u{6F}(value) {
+ C.#\u{6F} = value;
+ return C.#\u{6F};
+ }
+ static \u2118(value) {
+ C.#\u2118 = value;
+ return C.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ C.#ZW_\u200C_NJ = value;
+ return C.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ C.#ZW_\u200D_J = value;
+ return C.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt-by-classname.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt-by-classname.js
new file mode 100644
index 0000000000..c05a55b679
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt-by-classname.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt-by-classname.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;;;;;;;
+ ;;;;
+ static $() {
+ return C.#$;
+ }
+ static _() {
+ return C.#_;
+ }
+ static \u{6F}() {
+ return C.#\u{6F};
+ }
+ static ℘() {
+ return C.#℘;
+ }
+ static ZW_‌_NJ() {
+ return C.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return C.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt.js
new file mode 100644
index 0000000000..ed638fd79a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer-alt.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #℘ = 1; static #ZW_‌_NJ = 1; static #ZW_‍_J = 1;;;;;;;
+ ;;;;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static ℘() {
+ return this.#℘;
+ }
+ static ZW_‌_NJ() {
+ return this.#ZW_‌_NJ;
+ }
+ static ZW_‍_J() {
+ return this.#ZW_‍_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.℘(), 1);
+assert.sameValue(C.ZW_‌_NJ(), 1);
+assert.sameValue(C.ZW_‍_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer.js
new file mode 100644
index 0000000000..34b301ccfe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier-initializer.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #$ = 1; static #_ = 1; static #\u{6F} = 1; static #\u2118 = 1; static #ZW_\u200C_NJ = 1; static #ZW_\u200D_J = 1;;;;;;;
+ ;;;;
+ static $() {
+ return this.#$;
+ }
+ static _() {
+ return this.#_;
+ }
+ static \u{6F}() {
+ return this.#\u{6F};
+ }
+ static \u2118() {
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ() {
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J() {
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(), 1);
+assert.sameValue(C._(), 1);
+assert.sameValue(C.\u{6F}(), 1);
+assert.sameValue(C.\u2118(), 1);
+assert.sameValue(C.ZW_\u200C_NJ(), 1);
+assert.sameValue(C.ZW_\u200D_J(), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier.js
new file mode 100644
index 0000000000..92a8097f2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-rs-static-privatename-identifier.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/rs-static-privatename-identifier.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: Valid Static PrivateName (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition :
+ ClassElementName Initializer _opt
+
+ ClassElementName :
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName
+
+ IdentifierName ::
+ IdentifierStart
+ IdentifierName IdentifierPart
+
+ IdentifierStart ::
+ UnicodeIDStart
+ $
+ _
+ \ UnicodeEscapeSequence
+
+ IdentifierPart::
+ UnicodeIDContinue
+ $
+ \ UnicodeEscapeSequence
+ <ZWNJ> <ZWJ>
+
+ UnicodeIDStart::
+ any Unicode code point with the Unicode property "ID_Start"
+
+ UnicodeIDContinue::
+ any Unicode code point with the Unicode property "ID_Continue"
+
+
+ NOTE 3
+ The sets of code points with Unicode properties "ID_Start" and
+ "ID_Continue" include, respectively, the code points with Unicode
+ properties "Other_ID_Start" and "Other_ID_Continue".
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #$; static #_; static #\u{6F}; static #\u2118; static #ZW_\u200C_NJ; static #ZW_\u200D_J;;;;;;;
+ ;;;;
+ static $(value) {
+ this.#$ = value;
+ return this.#$;
+ }
+ static _(value) {
+ this.#_ = value;
+ return this.#_;
+ }
+ static \u{6F}(value) {
+ this.#\u{6F} = value;
+ return this.#\u{6F};
+ }
+ static \u2118(value) {
+ this.#\u2118 = value;
+ return this.#\u2118;
+ }
+ static ZW_\u200C_NJ(value) {
+ this.#ZW_\u200C_NJ = value;
+ return this.#ZW_\u200C_NJ;
+ }
+ static ZW_\u200D_J(value) {
+ this.#ZW_\u200D_J = value;
+ return this.#ZW_\u200D_J;
+ }
+}
+
+var c = new C();
+
+assert.sameValue(C.$(1), 1);
+assert.sameValue(C._(1), 1);
+assert.sameValue(C.\u{6F}(1), 1);
+assert.sameValue(C.\u2118(1), 1);
+assert.sameValue(C.ZW_\u200C_NJ(1), 1);
+assert.sameValue(C.ZW_\u200D_J(1), 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-fields.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-fields.js
new file mode 100644
index 0000000000..2c8f938c1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-fields.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-fields.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: static private fields (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #x; static #y;;;;;;;
+ ;;;;
+ static x() {
+ this.#x = 42;
+ return this.#x;
+ }
+ static y() {
+ this.#y = 43;
+ return this.#y;
+ }
+}
+
+var c = new C();
+
+// Test the private fields do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 43, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-methods-with-fields.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-methods-with-fields.js
new file mode 100644
index 0000000000..366df0d7b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-methods-with-fields.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods-with-fields.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: static private methods with fields (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class-static-fields-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;static #xVal; static #yVal;;;;;;;
+ ;;;;
+ static #x(value) {
+ this.#xVal = value;
+ return this.#xVal;
+ }
+ static #y(value) {
+ this.#yVal = value;
+ return this.#yVal;
+ }
+ static x() {
+ return this.#x(42);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7");
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8");
+assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11");
+assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "test 12");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 13");
+assert.sameValue(C.y(), 43, "test 14");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16");
+
+assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17");
+assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 18");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-methods.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-methods.js
new file mode 100644
index 0000000000..e2276b3a20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-static-private-methods.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/static-private-methods.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: static private methods (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-static-methods-private, class, class-fields-public]
+flags: [generated]
+info: |
+ ClassElement :
+ ...
+ static FieldDefinition ;
+
+ FieldDefinition :
+ ClassElementName Initializer_opt
+
+ ClassElementName :
+ PrivateName
+
+ PrivateName :
+ # IdentifierName
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;;;;;;;;
+ ;;;;
+ static #x(value) {
+ return value / 2;
+ }
+ static #y(value) {
+ return value * 2;
+ }
+ static x() {
+ return this.#x(84);
+ }
+ static y() {
+ return this.#y(43);
+ }
+}
+
+var c = new C();
+
+// Test the private methods do not appear as properties before set to value
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1");
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2");
+assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3");
+
+assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5");
+assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6");
+
+// Test if private fields can be sucessfully accessed and set to value
+assert.sameValue(C.x(), 42, "test 7");
+assert.sameValue(C.y(), 86, "test 8");
+
+// Test the private fields do not appear as properties before after set to value
+assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9");
+assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 10");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-string-literal-names.js b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-string-literal-names.js
new file mode 100644
index 0000000000..adbc00ec7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/elements/wrapped-in-sc-string-literal-names.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/class-elements/string-literal-names.case
+// - src/class-elements/productions/cls-decl-wrapped-in-sc.template
+/*---
+description: String literal names (fields definition wrapped in semicolons)
+esid: prod-FieldDefinition
+features: [class-fields-public, class]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+
+---*/
+
+
+class C {
+ ;;;;
+ ;;;;;;'a'; "b"; 'c' = 39;
+ "d" = 42;;;;;;;
+ ;;;;
+
+}
+
+var c = new C();
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
+ "a does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "a"),
+ "a does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
+ "b does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "b"),
+ "b does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "b", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
+ "c does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "c"),
+ "c does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "c", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert(
+ !Object.prototype.hasOwnProperty.call(C.prototype, "d"),
+ "d does not appear as an own property on C prototype"
+);
+assert(
+ !Object.prototype.hasOwnProperty.call(C, "d"),
+ "d does not appear as an own property on C constructor"
+);
+
+verifyProperty(c, "d", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-length-dflt.js b/js/src/tests/test262/language/statements/class/gen-method-length-dflt.js
new file mode 100644
index 0000000000..d3e00887d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-length-dflt.js
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.1.6
+description: >
+ Default parameters' effect on function length
+info: |
+ Function length is counted by the non initialized parameters in the left.
+
+ 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope)
+
+ [...]
+ 2. Let len be the ExpectedArgumentCount of ParameterList.
+ 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]:
+ len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
+ [...]
+
+ FormalsList : FormalParameter
+
+ 1. If HasInitializer of FormalParameter is true return 0
+ 2. Return 1.
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let count be the ExpectedArgumentCount of FormalsList.
+ 2. If HasInitializer of FormalsList is true or HasInitializer of
+ FormalParameter is true, return count.
+ 3. Return count+1.
+features: [generators, default-parameters]
+includes: [propertyHelper.js]
+---*/
+
+class C1 { *m(x = 42) {} }
+
+var m1 = C1.prototype.m;
+
+assert.sameValue(m1.length, 0, 'formalslist: x = 42');
+verifyNotEnumerable(m1, 'length');
+verifyNotWritable(m1, 'length');
+verifyConfigurable(m1, 'length');
+
+class C2 { *m(x = 42, y) {} }
+
+var m2 = C2.prototype.m;
+
+assert.sameValue(m2.length, 0, 'formalslist: x = 42, y');
+verifyNotEnumerable(m2, 'length');
+verifyNotWritable(m2, 'length');
+verifyConfigurable(m2, 'length');
+
+class C3 { *m(x, y = 42) {} }
+
+var m3 = C3.prototype.m;
+
+assert.sameValue(m3.length, 1, 'formalslist: x, y = 42');
+verifyNotEnumerable(m3, 'length');
+verifyNotWritable(m3, 'length');
+verifyConfigurable(m3, 'length');
+
+class C4 { *m(x, y = 42, z) {} }
+
+var m4 = C4.prototype.m;
+
+assert.sameValue(m4.length, 1, 'formalslist: x, y = 42, z');
+verifyNotEnumerable(m4, 'length');
+verifyNotWritable(m4, 'length');
+verifyConfigurable(m4, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-param-dflt-yield.js b/js/src/tests/test262/language/statements/class/gen-method-param-dflt-yield.js
new file mode 100644
index 0000000000..0cb2a793e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-param-dflt-yield.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-generator-function-definitions
+es6id: 14.4
+description: >
+ YieldExpression cannot be used within the FormalParameters of a generator
+ function
+info: |
+ GeneratorMethod[Yield]:
+
+ * PropertyName[?Yield] ( StrictFormalParameters[Yield] ) { GeneratorBody }
+
+ YieldExpression cannot be used within the FormalParameters of a generator
+ function because any expressions that are part of FormalParameters are
+ evaluated before the resulting generator object is in a resumable state.
+features: [generators, default-parameters]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ *g(x = yield) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/gen-method-static/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..22204bdbf1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/array-destructuring-param-strict-body.js
@@ -0,0 +1,157 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-gen-meth-static.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static *method([element]) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/browser.js b/js/src/tests/test262/language/statements/class/gen-method-static/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/browser.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-abrupt.js
new file mode 100644
index 0000000000..ec9286935c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-abrupt.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/cls-decl-gen-meth-static.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+var callCount = 0;
+class C {
+ static *method(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..2c7bfbc71f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/cls-decl-gen-meth-static.template
+/*---
+description: Use of initializer when argument value is not `undefined` (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+var callCount = 0;
+class C {
+ static *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(false, '', NaN, 0, null, obj).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..403b8151bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-arg-val-undefined.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/cls-decl-gen-meth-static.template
+/*---
+description: Use of initializer when argument value is `undefined` (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+var callCount = 0;
+class C {
+ static *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(undefined, void 0).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-duplicates.js
new file mode 100644
index 0000000000..9346b39d9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-duplicates.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/cls-decl-gen-meth-static.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static *method(x = 0, x) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-later.js
new file mode 100644
index 0000000000..e13e551a92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-later.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/cls-decl-gen-meth-static.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ static *method(x = y, y) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..b023781640
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-prior.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/cls-decl-gen-meth-static.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ static *method(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+ }
+}
+
+C.method(3).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-self.js
new file mode 100644
index 0000000000..0841078cde
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-ref-self.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/cls-decl-gen-meth-static.template
+/*---
+description: Referencing a parameter from within its own initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ static *method(x = x) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-rest.js b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-rest.js
new file mode 100644
index 0000000000..8b0fb0dd3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-rest.js
@@ -0,0 +1,90 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/cls-decl-gen-meth-static.template
+/*---
+description: RestParameter does not support an initializer (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static *method(...x = []) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..d9f4fe5b57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/dflt-params-trailing-comma.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/cls-decl-gen-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ static *method(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(42, undefined, 1).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/cls-decl-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/cls-decl-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..6377a89f1b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/cls-decl-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template
+/*---
+description: Forbidden extension, f.arguments (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ static *method() {
+ assert.sameValue(this.method.hasOwnProperty("arguments"), false);
+ callCount++;
+ }
+}
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/cls-decl-gen-meth-static-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/cls-decl-gen-meth-static-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..1bbbb759e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/cls-decl-gen-meth-static-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ static *method() {
+ assert.sameValue(this.method.hasOwnProperty("caller"), false);
+ callCount++;
+ }
+}
+
+C.method().next();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..dbaa9c2c0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ static *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method().next();
+
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..10d70f4670
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ static *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method().next();
+
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..33a95f63b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/cls-decl-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ static *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method().next();
+
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/gen-method-static/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..bf4ccd839e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/object-destructuring-param-strict-body.js
@@ -0,0 +1,157 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-gen-meth-static.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static *method({property}) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/class/gen-method-static/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..58ab67fc29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/params-trailing-comma-multiple.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/cls-decl-gen-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ static *method(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(42, 39, 1).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 2, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/class/gen-method-static/params-trailing-comma-single.js
new file mode 100644
index 0000000000..f638c61197
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/params-trailing-comma-single.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/cls-decl-gen-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ static *method(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(42, 39).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/rest-param-strict-body.js b/js/src/tests/test262/language/statements/class/gen-method-static/rest-param-strict-body.js
new file mode 100644
index 0000000000..4ab6f6d7f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/rest-param-strict-body.js
@@ -0,0 +1,157 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-gen-meth-static.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static *method(a,...rest) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/class/gen-method-static/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..f3ee1689c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,83 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/cls-decl-gen-meth-static.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static *method(...a,) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/shell.js b/js/src/tests/test262/language/statements/class/gen-method-static/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/shell.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..674410fd55
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier-escaped.case
+// - src/generators/syntax/class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *gen() {
+ var yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..14060c146c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-binding-identifier.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier.case
+// - src/generators/syntax/class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *gen() {
+ var yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..0033f06424
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference-escaped.case
+// - src/generators/syntax/class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *gen() {
+ void yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..dbc38e6a7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-identifier-reference.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference.case
+// - src/generators/syntax/class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *gen() {
+ void yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..9ee1269a64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-label-identifier-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier-escaped.case
+// - src/generators/syntax/class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *gen() {
+ yi\u0065ld: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-label-identifier.js
new file mode 100644
index 0000000000..3e58703d96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-as-label-identifier.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier.case
+// - src/generators/syntax/class-decl-static-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C {static *gen() {
+ yield: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..844d21c890
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,54 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-spread-strict.case
+// - src/generators/default/class-decl-static-method.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [object-spread, generators]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+class C {static *gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..280fc5bb56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-identifier-strict-strict.js
@@ -0,0 +1,45 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-strict.case
+// - src/generators/default/class-decl-static-method.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+class C {static *gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..c5e27efa20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-arr-multiple.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-multiple.case
+// - src/generators/default/class-decl-static-method.template
+/*---
+description: Use yield value in a array spread position (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+var callCount = 0;
+
+class C {static *gen() {
+ callCount += 1;
+ yield [...yield yield];
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+item = iter.next(item.value);
+
+assert.compareArray(item.value, arr);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-arr-single.js
new file mode 100644
index 0000000000..08baa75ed6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-arr-single.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-single.case
+// - src/generators/default/class-decl-static-method.template
+/*---
+description: Use yield value in a array spread position (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+---*/
+var arr = ['a', 'b', 'c'];
+
+var callCount = 0;
+
+class C {static *gen() {
+ callCount += 1;
+ yield [...yield];
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next(false);
+var item = iter.next(arr);
+var value = item.value;
+
+assert.notSameValue(value, arr, 'value is a new array');
+assert(Array.isArray(value), 'value is an Array exotic object');
+assert.sameValue(value.length, 3)
+assert.sameValue(value[0], 'a');
+assert.sameValue(value[1], 'b');
+assert.sameValue(value[2], 'c');
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-obj.js b/js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-obj.js
new file mode 100644
index 0000000000..429f35eb9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method-static/yield-spread-obj.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-obj.case
+// - src/generators/default/class-decl-static-method.template
+/*---
+description: Use yield value in a object spread position (Static generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [object-spread, generators]
+flags: [generated]
+info: |
+ ClassElement :
+ static MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+var callCount = 0;
+
+class C {static *gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+}}
+
+var gen = C.gen;
+
+var iter = gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+assert.sameValue(item.value.x, 42);
+assert.sameValue(item.value.y, 39);
+assert.sameValue(Object.keys(item.value).length, 2);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/gen-method/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..e6d0cf99a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/array-destructuring-param-strict-body.js
@@ -0,0 +1,157 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-gen-meth.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ *method([element]) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/browser.js b/js/src/tests/test262/language/statements/class/gen-method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/browser.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-abrupt.js
new file mode 100644
index 0000000000..1b084ac1b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-abrupt.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/cls-decl-gen-meth.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+var callCount = 0;
+class C {
+ *method(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(Test262Error, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..c7e02f7c79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,112 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/cls-decl-gen-meth.template
+/*---
+description: Use of initializer when argument value is not `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+var callCount = 0;
+class C {
+ *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(false, '', NaN, 0, null, obj).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..1b3131ac20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-arg-val-undefined.js
@@ -0,0 +1,95 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/cls-decl-gen-meth.template
+/*---
+description: Use of initializer when argument value is `undefined` (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+var callCount = 0;
+class C {
+ *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(undefined, void 0).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-duplicates.js
new file mode 100644
index 0000000000..55875096b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-duplicates.js
@@ -0,0 +1,86 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/cls-decl-gen-meth.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ *method(x = 0, x) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-later.js
new file mode 100644
index 0000000000..0551964520
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-later.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/cls-decl-gen-meth.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ *method(x = y, y) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..f7dd334fd4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-prior.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/cls-decl-gen-meth.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ *method(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(3).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-self.js
new file mode 100644
index 0000000000..aac84e6fa1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-ref-self.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/cls-decl-gen-meth.template
+/*---
+description: Referencing a parameter from within its own initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ *method(x = x) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/dflt-params-rest.js b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-rest.js
new file mode 100644
index 0000000000..1268cbb8d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-rest.js
@@ -0,0 +1,90 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/cls-decl-gen-meth.template
+/*---
+description: RestParameter does not support an initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ *method(...x = []) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..23ce717020
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/dflt-params-trailing-comma.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/cls-decl-gen-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ *method(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(42, undefined, 1).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/cls-decl-gen-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/cls-decl-gen-meth-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..d3eb48a9ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/cls-decl-gen-meth-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template
+/*---
+description: Forbidden extension, f.arguments (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ *method() {
+ assert.sameValue(this.method.hasOwnProperty("arguments"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method().next();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/cls-decl-gen-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/cls-decl-gen-meth-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..a9a9fa54f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/cls-decl-gen-meth-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ *method() {
+ assert.sameValue(this.method.hasOwnProperty("caller"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method().next();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..c63b93776a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method().next();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..6998ef9360
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method().next();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..e6305a593c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/cls-decl-gen-meth-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [class, generators]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method().next();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/gen-method/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..416e2791eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/object-destructuring-param-strict-body.js
@@ -0,0 +1,157 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-gen-meth.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ *method({property}) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/class/gen-method/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..e59b4461f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/params-trailing-comma-multiple.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/cls-decl-gen-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ *method(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(42, 39, 1).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 2, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/class/gen-method/params-trailing-comma-single.js
new file mode 100644
index 0000000000..0b7c6fddb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/params-trailing-comma-single.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/cls-decl-gen-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ *method(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(42, 39).next();
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/rest-param-strict-body.js b/js/src/tests/test262/language/statements/class/gen-method/rest-param-strict-body.js
new file mode 100644
index 0000000000..ad3b876fec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/rest-param-strict-body.js
@@ -0,0 +1,157 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-gen-meth.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ *method(a,...rest) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/class/gen-method/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..35fbeeb2f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,83 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/cls-decl-gen-meth.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+class C {
+ *method(...a,) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/shell.js b/js/src/tests/test262/language/statements/class/gen-method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/shell.js
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/gen-method/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..17ecc0c5d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier-escaped.case
+// - src/generators/syntax/class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *gen() {
+ var yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/gen-method/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..76e2b87f32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-as-binding-identifier.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier.case
+// - src/generators/syntax/class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *gen() {
+ var yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/gen-method/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..670dc2e705
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference-escaped.case
+// - src/generators/syntax/class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *gen() {
+ void yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/gen-method/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..b3701c7e7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-as-identifier-reference.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference.case
+// - src/generators/syntax/class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *gen() {
+ void yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/gen-method/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..f8173bc45f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-as-label-identifier-escaped.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier-escaped.case
+// - src/generators/syntax/class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *gen() {
+ yi\u0065ld: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/class/gen-method/yield-as-label-identifier.js
new file mode 100644
index 0000000000..ef0b7e2ca6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-as-label-identifier.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier.case
+// - src/generators/syntax/class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+class C { *gen() {
+ yield: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/class/gen-method/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..66078a5fb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,54 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-spread-strict.case
+// - src/generators/default/class-decl-method.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [object-spread, generators]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+class C { *gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/class/gen-method/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..ba5630356b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-identifier-strict-strict.js
@@ -0,0 +1,45 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-strict.case
+// - src/generators/default/class-decl-method.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+class C { *gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/class/gen-method/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..5fc963769b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-spread-arr-multiple.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-multiple.case
+// - src/generators/default/class-decl-method.template
+/*---
+description: Use yield value in a array spread position (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+var callCount = 0;
+
+class C { *gen() {
+ callCount += 1;
+ yield [...yield yield];
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+item = iter.next(item.value);
+
+assert.compareArray(item.value, arr);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/class/gen-method/yield-spread-arr-single.js
new file mode 100644
index 0000000000..d93a8847dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-spread-arr-single.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-single.case
+// - src/generators/default/class-decl-method.template
+/*---
+description: Use yield value in a array spread position (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [generators]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+---*/
+var arr = ['a', 'b', 'c'];
+
+var callCount = 0;
+
+class C { *gen() {
+ callCount += 1;
+ yield [...yield];
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next(false);
+var item = iter.next(arr);
+var value = item.value;
+
+assert.notSameValue(value, arr, 'value is a new array');
+assert(Array.isArray(value), 'value is an Array exotic object');
+assert.sameValue(value.length, 3)
+assert.sameValue(value[0], 'a');
+assert.sameValue(value[1], 'b');
+assert.sameValue(value[2], 'c');
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/gen-method/yield-spread-obj.js b/js/src/tests/test262/language/statements/class/gen-method/yield-spread-obj.js
new file mode 100644
index 0000000000..54171419bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/gen-method/yield-spread-obj.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-obj.case
+// - src/generators/default/class-decl-method.template
+/*---
+description: Use yield value in a object spread position (Generator method as a ClassDeclaration element)
+esid: prod-GeneratorMethod
+features: [object-spread, generators]
+flags: [generated]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ GeneratorMethod
+
+ 14.4 Generator Function Definitions
+
+ GeneratorMethod :
+ * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+var callCount = 0;
+
+class C { *gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+assert.sameValue(item.value.x, 42);
+assert.sameValue(item.value.y, 39);
+assert.sameValue(Object.keys(item.value).length, 2);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/getter-param-dflt.js b/js/src/tests/test262/language/statements/class/getter-param-dflt.js
new file mode 100644
index 0000000000..f5d813fff0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/getter-param-dflt.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-method-definitions
+es6id: 14.3
+description: >
+ Get accessor method may not have a formal parameter (regardless of the
+ presence of an initializer)
+info: |
+ Syntax
+
+ MethodDefinition[Yield] :
+
+ get PropertyName[?Yield] ( ) { FunctionBody }
+features: [default-parameters]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C { get a(param = null) {} }
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-break-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-break-escaped.js
new file mode 100644
index 0000000000..bfcedac619
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-break-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/break-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: break is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ bre\u0061k() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['break'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-case-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-case-escaped.js
new file mode 100644
index 0000000000..6830cb6187
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-case-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/case-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: case is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ c\u0061se() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['case'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-catch-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-catch-escaped.js
new file mode 100644
index 0000000000..4f4cf9068f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-catch-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/catch-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: catch is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ c\u0061tch() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['catch'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-class-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-class-escaped.js
new file mode 100644
index 0000000000..2b16ead2e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-class-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/class-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: class is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ cl\u0061ss() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['class'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-const-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-const-escaped.js
new file mode 100644
index 0000000000..5083eeb0f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-const-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/const-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: const is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0063onst() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['const'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-continue-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-continue-escaped.js
new file mode 100644
index 0000000000..e99588679b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-continue-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/continue-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: continue is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0063ontinue() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['continue'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-debugger-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-debugger-escaped.js
new file mode 100644
index 0000000000..b0657b5cf6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-debugger-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/debugger-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: debugger is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0064ebugger() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['debugger'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-default-escaped-ext.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-default-escaped-ext.js
new file mode 100644
index 0000000000..a7b6bdf12a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-default-escaped-ext.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/default-escaped-ext.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: default is a valid identifier name, using extended escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ def\u{61}ult() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['default'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-default-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-default-escaped.js
new file mode 100644
index 0000000000..e3fd1ee427
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-default-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/default-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: default is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ def\u0061ult() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['default'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-default.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-default.js
new file mode 100644
index 0000000000..47a92739ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-default.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/default.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: default is a valid identifier name (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ default() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['default'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-delete-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-delete-escaped.js
new file mode 100644
index 0000000000..fa1ed7ed4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-delete-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/delete-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: delete is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0064elete() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['delete'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-do-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-do-escaped.js
new file mode 100644
index 0000000000..bcfa66ae50
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-do-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/do-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: do is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0064o() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['do'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-else-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-else-escaped.js
new file mode 100644
index 0000000000..384dddc501
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-else-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/else-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: else is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0065lse() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['else'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-enum-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-enum-escaped.js
new file mode 100644
index 0000000000..6a9c5a580c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-enum-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/enum-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: enum is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0065num() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['enum'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-export-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-export-escaped.js
new file mode 100644
index 0000000000..9d057327a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-export-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/export-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: export is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0065xport() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['export'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-extends-escaped-ext.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-extends-escaped-ext.js
new file mode 100644
index 0000000000..d880700cf1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-extends-escaped-ext.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/extends-escaped-ext.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: extends is a valid identifier name, using extended escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u{65}xtends() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['extends'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-extends-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-extends-escaped.js
new file mode 100644
index 0000000000..df0ecebdcc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-extends-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/extends-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: extends is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0065xtends() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['extends'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-extends.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-extends.js
new file mode 100644
index 0000000000..c8b6b46db7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-extends.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/extends.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: extends is a valid identifier name (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ extends() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['extends'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-finally-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-finally-escaped.js
new file mode 100644
index 0000000000..01ae276115
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-finally-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/finally-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: finally is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0066inally() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['finally'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-for-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-for-escaped.js
new file mode 100644
index 0000000000..34737f7bb4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-for-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/for-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: for is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0066or() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['for'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-function-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-function-escaped.js
new file mode 100644
index 0000000000..6230712a8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-function-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/function-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: function is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0066unction() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['function'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-if-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-if-escaped.js
new file mode 100644
index 0000000000..5f68c226a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-if-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/if-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: if is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ i\u0066() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['if'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-implements-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-implements-escaped.js
new file mode 100644
index 0000000000..ecc8d182ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-implements-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/implements-escaped.case
+// - src/identifier-names/future-reserved-words/class-statement-method-def.template
+/*---
+description: implements is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0069mplements() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['implements'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-import-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-import-escaped.js
new file mode 100644
index 0000000000..fef86812b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-import-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/import-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: import is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0069mport() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['import'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-in-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-in-escaped.js
new file mode 100644
index 0000000000..4b228a3110
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-in-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/in-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: in is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0069n() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['in'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-instanceof-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-instanceof-escaped.js
new file mode 100644
index 0000000000..3169ec3265
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-instanceof-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/instanceof-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: instanceof is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ \u0069nstanceof() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['instanceof'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-interface-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-interface-escaped.js
new file mode 100644
index 0000000000..0f13a0c9f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-interface-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/interface-escaped.case
+// - src/identifier-names/future-reserved-words/class-statement-method-def.template
+/*---
+description: interface is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ interf\u0061ce() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['interface'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-let-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-let-escaped.js
new file mode 100644
index 0000000000..c240a393cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-let-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/let-escaped.case
+// - src/identifier-names/future-reserved-words/class-statement-method-def.template
+/*---
+description: let is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ l\u0065t() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['let'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-new-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-new-escaped.js
new file mode 100644
index 0000000000..4e3b9988f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-new-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/new-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: new is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ n\u0065w() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['new'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-package-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-package-escaped.js
new file mode 100644
index 0000000000..815418c6ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-package-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/package-escaped.case
+// - src/identifier-names/future-reserved-words/class-statement-method-def.template
+/*---
+description: package is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ p\u0061ckage() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['package'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-private-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-private-escaped.js
new file mode 100644
index 0000000000..bb38984d92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-private-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/private-escaped.case
+// - src/identifier-names/future-reserved-words/class-statement-method-def.template
+/*---
+description: private is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ privat\u0065() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['private'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-protected-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-protected-escaped.js
new file mode 100644
index 0000000000..11aacc7112
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-protected-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/protected-escaped.case
+// - src/identifier-names/future-reserved-words/class-statement-method-def.template
+/*---
+description: protected is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ prot\u0065cted() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['protected'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-public-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-public-escaped.js
new file mode 100644
index 0000000000..7d64d6ed91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-public-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/public-escaped.case
+// - src/identifier-names/future-reserved-words/class-statement-method-def.template
+/*---
+description: public is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ pu\u0062lic() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['public'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-return-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-return-escaped.js
new file mode 100644
index 0000000000..250774c536
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-return-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/return-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: return is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ r\u0065turn() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['return'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-static-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-static-escaped.js
new file mode 100644
index 0000000000..2976f6dcb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-static-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/static-escaped.case
+// - src/identifier-names/future-reserved-words/class-statement-method-def.template
+/*---
+description: static is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ st\u0061tic() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['static'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-super-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-super-escaped.js
new file mode 100644
index 0000000000..e0392ac5ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-super-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/super-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: super is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ sup\u0065r() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['super'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-switch-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-switch-escaped.js
new file mode 100644
index 0000000000..5d3388b8e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-switch-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/switch-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: switch is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ sw\u0069tch() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['switch'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-this-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-this-escaped.js
new file mode 100644
index 0000000000..073901ff5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-this-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/this-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: this is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ th\u0069s() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['this'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-throw-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-throw-escaped.js
new file mode 100644
index 0000000000..bbf8d8acd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-throw-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/throw-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: throw is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ t\u0068row() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['throw'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-try-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-try-escaped.js
new file mode 100644
index 0000000000..0187eb665d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-try-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/try-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: try is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ tr\u0079() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['try'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-typeof-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-typeof-escaped.js
new file mode 100644
index 0000000000..10bf1065f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-typeof-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/typeof-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: typeof is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ typ\u0065of() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['typeof'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-var-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-var-escaped.js
new file mode 100644
index 0000000000..5cb915a3e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-var-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/var-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: var is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ v\u0061r() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['var'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-void-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-void-escaped.js
new file mode 100644
index 0000000000..a290a9dd88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-void-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/void-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: void is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ voi\u0064() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['void'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-while-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-while-escaped.js
new file mode 100644
index 0000000000..cfde8f919a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-while-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/while-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: while is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ whil\u0065() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['while'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/ident-name-method-def-with-escaped.js b/js/src/tests/test262/language/statements/class/ident-name-method-def-with-escaped.js
new file mode 100644
index 0000000000..07309d0177
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/ident-name-method-def-with-escaped.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/identifier-names/with-escaped.case
+// - src/identifier-names/default/class-statement-method-def.template
+/*---
+description: with is a valid identifier name, using escape (MethodDefinition)
+esid: prod-PropertyDefinition
+features: [class]
+flags: [generated]
+info: |
+ ObjectLiteral :
+ { PropertyDefinitionList }
+ { PropertyDefinitionList , }
+
+ PropertyDefinitionList:
+ PropertyDefinition
+ PropertyDefinitionList , PropertyDefinition
+
+ PropertyDefinition:
+ MethodDefinition
+ ...
+
+ MethodDefinition:
+ PropertyName ( UniqueFormalParameters ){ FunctionBody }
+
+ PropertyName:
+ LiteralPropertyName
+ ...
+
+ LiteralPropertyName:
+ IdentifierName
+ ...
+
+ Reserved Words
+
+ A reserved word is an IdentifierName that cannot be used as an Identifier.
+
+---*/
+
+
+class C {
+ w\u0069th() { return 42; }
+}
+
+var obj = new C();
+
+assert.sameValue(obj['with'](), 42, 'property exists');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-length-dflt.js b/js/src/tests/test262/language/statements/class/method-length-dflt.js
new file mode 100644
index 0000000000..c57f8a2236
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-length-dflt.js
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.1.6
+description: >
+ Default parameters' effect on function length
+info: |
+ Function length is counted by the non initialized parameters in the left.
+
+ 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope)
+
+ [...]
+ 2. Let len be the ExpectedArgumentCount of ParameterList.
+ 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]:
+ len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
+ [...]
+
+ FormalsList : FormalParameter
+
+ 1. If HasInitializer of FormalParameter is true return 0
+ 2. Return 1.
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let count be the ExpectedArgumentCount of FormalsList.
+ 2. If HasInitializer of FormalsList is true or HasInitializer of
+ FormalParameter is true, return count.
+ 3. Return count+1.
+features: [default-parameters]
+includes: [propertyHelper.js]
+---*/
+
+class C1 { m(x = 42) {} }
+
+var m1 = C1.prototype.m;
+
+assert.sameValue(m1.length, 0, 'formalslist: x = 42');
+verifyNotEnumerable(m1, 'length');
+verifyNotWritable(m1, 'length');
+verifyConfigurable(m1, 'length');
+
+class C2 { m(x = 42, y) {} }
+
+var m2 = C2.prototype.m;
+
+assert.sameValue(m2.length, 0, 'formalslist: x = 42, y');
+verifyNotEnumerable(m2, 'length');
+verifyNotWritable(m2, 'length');
+verifyConfigurable(m2, 'length');
+
+class C3 { m(x, y = 42) {} }
+
+var m3 = C3.prototype.m;
+
+assert.sameValue(m3.length, 1, 'formalslist: x, y = 42');
+verifyNotEnumerable(m3, 'length');
+verifyNotWritable(m3, 'length');
+verifyConfigurable(m3, 'length');
+
+class C4 { m(x, y = 42, z) {} }
+
+var m4 = C4.prototype.m;
+
+assert.sameValue(m4.length, 1, 'formalslist: x, y = 42, z');
+verifyNotEnumerable(m4, 'length');
+verifyNotWritable(m4, 'length');
+verifyConfigurable(m4, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-param-yield.js b/js/src/tests/test262/language/statements/class/method-param-yield.js
new file mode 100644
index 0000000000..a6caac76cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-param-yield.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-method-definitions
+es6id: 14.3
+description: >
+ YieldExpression cannot be used within the FormalParameters of a class method
+info: |
+ MethodDefinition[Yield] :
+
+ PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody }
+features: [generators, default-parameters]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ m(x = yield) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/method-static/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/method-static/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..9f515ac743
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/array-destructuring-param-strict-body.js
@@ -0,0 +1,154 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-meth-static.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static method([element]) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method-static/browser.js b/js/src/tests/test262/language/statements/class/method-static/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/browser.js
diff --git a/js/src/tests/test262/language/statements/class/method-static/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/class/method-static/dflt-params-abrupt.js
new file mode 100644
index 0000000000..92e9bba807
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/dflt-params-abrupt.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/cls-decl-meth-static.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+var callCount = 0;
+class C {
+ static method(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(Test262Error, function() {
+ C.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/class/method-static/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..6847bb534e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/cls-decl-meth-static.template
+/*---
+description: Use of initializer when argument value is not `undefined` (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+var callCount = 0;
+class C {
+ static method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(false, '', NaN, 0, null, obj);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/class/method-static/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..802862c01f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/dflt-params-arg-val-undefined.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/cls-decl-meth-static.template
+/*---
+description: Use of initializer when argument value is `undefined` (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+var callCount = 0;
+class C {
+ static method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(undefined, void 0);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/class/method-static/dflt-params-duplicates.js
new file mode 100644
index 0000000000..8c4b05c71a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/dflt-params-duplicates.js
@@ -0,0 +1,83 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/cls-decl-meth-static.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static method(x = 0, x) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-later.js
new file mode 100644
index 0000000000..b4fa9f3992
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-later.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/cls-decl-meth-static.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ static method(x = y, y) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..7ba959125a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-prior.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/cls-decl-meth-static.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ static method(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+ }
+}
+
+C.method(3);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-self.js
new file mode 100644
index 0000000000..42013042ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/dflt-params-ref-self.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/cls-decl-meth-static.template
+/*---
+description: Referencing a parameter from within its own initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ static method(x = x) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/dflt-params-rest.js b/js/src/tests/test262/language/statements/class/method-static/dflt-params-rest.js
new file mode 100644
index 0000000000..a7841ccd90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/dflt-params-rest.js
@@ -0,0 +1,87 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/cls-decl-meth-static.template
+/*---
+description: RestParameter does not support an initializer (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static method(...x = []) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method-static/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/class/method-static/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..c8c78c68c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/dflt-params-trailing-comma.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/cls-decl-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ static method(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(42, undefined, 1);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/cls-decl-meth-static-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/cls-decl-meth-static-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..4b4d3b0078
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/cls-decl-meth-static-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template
+/*---
+description: Forbidden extension, f.arguments (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ static method() {
+ assert.sameValue(this.method.hasOwnProperty("arguments"), false);
+ callCount++;
+ }
+}
+
+C.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/cls-decl-meth-static-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/cls-decl-meth-static-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..f98dede24d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/cls-decl-meth-static-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ static method() {
+ assert.sameValue(this.method.hasOwnProperty("caller"), false);
+ callCount++;
+ }
+}
+
+C.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..9403f1f66b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ static method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..177e2303d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ static method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..8331dceed3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/cls-decl-meth-static-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template
+/*---
+description: Forbidden extension, o.caller (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ static method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/class/method-static/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/method-static/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..0719ae9c12
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/object-destructuring-param-strict-body.js
@@ -0,0 +1,154 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-meth-static.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static method({property}) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method-static/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/class/method-static/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..07792de2ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/params-trailing-comma-multiple.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/cls-decl-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ static method(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(42, 39, 1);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 2, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/class/method-static/params-trailing-comma-single.js
new file mode 100644
index 0000000000..0e9e5914d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/params-trailing-comma-single.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/cls-decl-meth-static.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ static method(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+ }
+}
+
+C.method(42, 39);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method-static/rest-param-strict-body.js b/js/src/tests/test262/language/statements/class/method-static/rest-param-strict-body.js
new file mode 100644
index 0000000000..f3557563c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/rest-param-strict-body.js
@@ -0,0 +1,154 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-meth-static.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static method(a,...rest) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method-static/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/class/method-static/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..4dafdc9681
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,79 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/cls-decl-meth-static.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+class C {
+ static method(...a,) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method-static/shell.js b/js/src/tests/test262/language/statements/class/method-static/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method-static/shell.js
diff --git a/js/src/tests/test262/language/statements/class/method/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/method/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..ec50f6f725
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/array-destructuring-param-strict-body.js
@@ -0,0 +1,154 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-meth.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ method([element]) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method/browser.js b/js/src/tests/test262/language/statements/class/method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/browser.js
diff --git a/js/src/tests/test262/language/statements/class/method/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/class/method/dflt-params-abrupt.js
new file mode 100644
index 0000000000..cd6c3a13fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/dflt-params-abrupt.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/cls-decl-meth.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+var callCount = 0;
+class C {
+ method(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(Test262Error, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/class/method/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..18651a613b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,109 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/cls-decl-meth.template
+/*---
+description: Use of initializer when argument value is not `undefined` (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+var callCount = 0;
+class C {
+ method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(false, '', NaN, 0, null, obj);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/class/method/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..427e0a2957
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/dflt-params-arg-val-undefined.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/cls-decl-meth.template
+/*---
+description: Use of initializer when argument value is `undefined` (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+var callCount = 0;
+class C {
+ method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(undefined, void 0);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/class/method/dflt-params-duplicates.js
new file mode 100644
index 0000000000..7f538556d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/dflt-params-duplicates.js
@@ -0,0 +1,83 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/cls-decl-meth.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ method(x = 0, x) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/class/method/dflt-params-ref-later.js
new file mode 100644
index 0000000000..7182c96538
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/dflt-params-ref-later.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/cls-decl-meth.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ method(x = y, y) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/class/method/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..2318e55d8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/dflt-params-ref-prior.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/cls-decl-meth.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ method(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(3);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/class/method/dflt-params-ref-self.js
new file mode 100644
index 0000000000..720abe5a79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/dflt-params-ref-self.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/cls-decl-meth.template
+/*---
+description: Referencing a parameter from within its own initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ method(x = x) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/dflt-params-rest.js b/js/src/tests/test262/language/statements/class/method/dflt-params-rest.js
new file mode 100644
index 0000000000..ad7fad6e70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/dflt-params-rest.js
@@ -0,0 +1,87 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/cls-decl-meth.template
+/*---
+description: RestParameter does not support an initializer (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ method(...x = []) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/class/method/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..0a95459ff6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/dflt-params-trailing-comma.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/cls-decl-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ method(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(42, undefined, 1);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/cls-decl-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/cls-decl-meth-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..f5892c457f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/cls-decl-meth-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template
+/*---
+description: Forbidden extension, f.arguments (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ method() {
+ assert.sameValue(this.method.hasOwnProperty("arguments"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/cls-decl-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/cls-decl-meth-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..62f6e9e322
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/cls-decl-meth-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ method() {
+ assert.sameValue(this.method.hasOwnProperty("caller"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..4252206488
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..292a409f22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..23577b3c1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/cls-decl-meth-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [class]
+flags: [generated, noStrict]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method();
+assert.sameValue(callCount, 1, 'method body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/class/method/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/class/method/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/class/method/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/method/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..950347f1b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/object-destructuring-param-strict-body.js
@@ -0,0 +1,154 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-meth.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ method({property}) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/class/method/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..06f47ab0e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/params-trailing-comma-multiple.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/cls-decl-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ method(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(42, 39, 1);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 2, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/class/method/params-trailing-comma-single.js
new file mode 100644
index 0000000000..1b264c609c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/params-trailing-comma-single.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/cls-decl-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ method(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(42, 39);
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/method/rest-param-strict-body.js b/js/src/tests/test262/language/statements/class/method/rest-param-strict-body.js
new file mode 100644
index 0000000000..0a6215c24c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/rest-param-strict-body.js
@@ -0,0 +1,154 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-meth.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ method(a,...rest) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/class/method/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..68072feed6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,79 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/cls-decl-meth.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+class C {
+ method(...a,) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/method/shell.js b/js/src/tests/test262/language/statements/class/method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/method/shell.js
diff --git a/js/src/tests/test262/language/statements/class/name-binding/basic.js b/js/src/tests/test262/language/statements/class/name-binding/basic.js
new file mode 100644
index 0000000000..cdee07ecc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/name-binding/basic.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class name binding
+---*/
+var C2;
+class C {
+ constructor() {
+ C2 = C;
+ }
+ m() {
+ C2 = C;
+ }
+ get x() {
+ C2 = C;
+ }
+ set x(_) {
+ C2 = C;
+ }
+}
+new C();
+assert.sameValue(C, C2, "The value of `C` is `C2`");
+
+C2 = undefined;
+new C().m();
+assert.sameValue(C, C2, "The value of `C` is `C2`");
+
+C2 = undefined;
+new C().x;
+assert.sameValue(C, C2, "The value of `C` is `C2`");
+
+C2 = undefined;
+new C().x = 1;
+assert.sameValue(C, C2, "The value of `C` is `C2`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/name-binding/browser.js b/js/src/tests/test262/language/statements/class/name-binding/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/name-binding/browser.js
diff --git a/js/src/tests/test262/language/statements/class/name-binding/const.js b/js/src/tests/test262/language/statements/class/name-binding/const.js
new file mode 100644
index 0000000000..326ac008a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/name-binding/const.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class name binding const
+---*/
+assert.throws(TypeError, function() {
+ class C { constructor() { C = 42; } }; new C();
+});
+assert.throws(TypeError, function() {
+ new (class C { constructor() { C = 42; } })
+});
+assert.throws(TypeError, function() {
+ class C { m() { C = 42; } }; new C().m()
+});
+assert.throws(TypeError, function() {
+ new (class C { m() { C = 42; } }).m()
+});
+assert.throws(TypeError, function() {
+ class C { get x() { C = 42; } }; new C().x
+});
+assert.throws(TypeError, function() {
+ (new (class C { get x() { C = 42; } })).x
+});
+assert.throws(TypeError, function() {
+ class C { set x(_) { C = 42; } }; new C().x = 15;
+});
+assert.throws(TypeError, function() {
+ (new (class C { set x(_) { C = 42; } })).x = 15;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/name-binding/expression.js b/js/src/tests/test262/language/statements/class/name-binding/expression.js
new file mode 100644
index 0000000000..26a584e479
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/name-binding/expression.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class name binding expression
+---*/
+var Cc;
+var Cm;
+var Cgx;
+var Csx;
+var Cv = class C {
+ constructor() {
+ assert.sameValue(C, Cv, "The value of `C` is `Cv`, inside `constructor()`");
+ Cc = C;
+ }
+ m() {
+ assert.sameValue(C, Cv, "The value of `C` is `Cv`, inside `m()`");
+ Cm = C;
+ }
+ get x() {
+ assert.sameValue(C, Cv, "The value of `C` is `Cv`, inside `get x()`");
+ Cgx = C;
+ }
+ set x(_) {
+ assert.sameValue(C, Cv, "The value of `C` is `Cv`, inside `set x()`");
+ Csx = C;
+ }
+};
+
+new Cv();
+assert.sameValue(Cc, Cv, "The value of `Cc` is `Cv`, after executing `new Cv();`");
+
+new Cv().m();
+assert.sameValue(Cm, Cv, "The value of `Cm` is `Cv`, after executing `new Cv().m();`");
+
+new Cv().x;
+assert.sameValue(Cgx, Cv, "The value of `Cgx` is `Cv`, after executing `new Cv().x;`");
+
+new Cv().x = 1;
+assert.sameValue(Csx, Cv, "The value of `Csx` is `Cv`, after executing `new Cv().x = 1;`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/name-binding/in-extends-expression-assigned.js b/js/src/tests/test262/language/statements/class/name-binding/in-extends-expression-assigned.js
new file mode 100644
index 0000000000..eb0b9818f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/name-binding/in-extends-expression-assigned.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class name binding in extends expression, assigned
+---*/
+assert.throws(ReferenceError, function() {
+ var x = (class x extends x {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/name-binding/in-extends-expression-grouped.js b/js/src/tests/test262/language/statements/class/name-binding/in-extends-expression-grouped.js
new file mode 100644
index 0000000000..c4259d8ae4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/name-binding/in-extends-expression-grouped.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class name binding in extends expression, grouped
+---*/
+
+assert.throws(ReferenceError, function() {
+ (class x extends x {});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/name-binding/in-extends-expression.js b/js/src/tests/test262/language/statements/class/name-binding/in-extends-expression.js
new file mode 100644
index 0000000000..cd586bc04b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/name-binding/in-extends-expression.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class name binding in extends expression
+---*/
+assert.throws(ReferenceError, function() {
+ class x extends x {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/name-binding/shell.js b/js/src/tests/test262/language/statements/class/name-binding/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/name-binding/shell.js
diff --git a/js/src/tests/test262/language/statements/class/name.js b/js/src/tests/test262/language/statements/class/name.js
new file mode 100644
index 0000000000..a426556179
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/name.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 14.5.15
+description: Assignment of function `name` attribute
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ [...]
+ 6. If hasNameProperty is false, then perform SetFunctionName(value,
+ className).
+includes: [propertyHelper.js]
+---*/
+
+class Test262 {}
+
+assert.sameValue(Test262.name, 'Test262');
+verifyNotEnumerable(Test262, 'name');
+verifyNotWritable(Test262, 'name');
+verifyConfigurable(Test262, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-args-unmapped.js b/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-args-unmapped.js
new file mode 100644
index 0000000000..ca91616981
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-args-unmapped.js
@@ -0,0 +1,106 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+es6id: 14.5.16
+features: [generators, default-parameters]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+class C {
+ *method(x, _ = 0) {
+ assert.sameValue(x, undefined, 'parameter binding value (initial)');
+ assert.sameValue(
+ arguments[0], undefined, 'arguments property value (initial)'
+ );
+
+ arguments[0] = 1;
+
+ assert.sameValue(
+ x, undefined, 'parameter binding value (after arguments modification)'
+ );
+ assert.sameValue(
+ arguments[0], 1, 'arguments property value (after arguments modification)'
+ );
+
+ x = 2;
+
+ assert.sameValue(
+ x, 2, 'parameter binding value (after parameter binding modification)'
+ );
+ assert.sameValue(
+ arguments[0],
+ 1,
+ 'arguments property value (after parameter binding modification)'
+ );
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method().next();
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-ref-arguments.js b/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-ref-arguments.js
new file mode 100644
index 0000000000..36f27467df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-ref-arguments.js
@@ -0,0 +1,85 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+es6id: 14.5.16
+features: [generators, default-parameters]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+class C {
+ *method(x = arguments[2], y = arguments[3], z) {
+ assert.sameValue(x, 'third', 'first parameter');
+ assert.sameValue(y, 'fourth', 'second parameter');
+ assert.sameValue(z, 'third', 'third parameter');
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(undefined, undefined, 'third', 'fourth').next();
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-static-args-unmapped.js b/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-static-args-unmapped.js
new file mode 100644
index 0000000000..fde66a0534
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-static-args-unmapped.js
@@ -0,0 +1,106 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+es6id: 14.5.15
+features: [generators, default-parameters]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+class C {
+ static *method(x, _ = 0) {
+ assert.sameValue(x, undefined, 'parameter binding value (initial)');
+ assert.sameValue(
+ arguments[0], undefined, 'arguments property value (initial)'
+ );
+
+ arguments[0] = 1;
+
+ assert.sameValue(
+ x, undefined, 'parameter binding value (after arguments modification)'
+ );
+ assert.sameValue(
+ arguments[0], 1, 'arguments property value (after arguments modification)'
+ );
+
+ x = 2;
+
+ assert.sameValue(
+ x, 2, 'parameter binding value (after parameter binding modification)'
+ );
+ assert.sameValue(
+ arguments[0],
+ 1,
+ 'arguments property value (after parameter binding modification)'
+ );
+ callCount = callCount + 1;
+ }
+}
+
+C.method().next();
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-static-ref-arguments.js b/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-static-ref-arguments.js
new file mode 100644
index 0000000000..8cf52d1a56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/params-dflt-gen-meth-static-ref-arguments.js
@@ -0,0 +1,85 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (static class expression generator method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+es6id: 14.5.15
+features: [generators, default-parameters]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation
+
+ GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this GeneratorMethod is strict mode code,
+ let strict be true. Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be GeneratorFunctionCreate(Method,
+ StrictFormalParameters, GeneratorBody, scope, strict).
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+class C {
+ static *method(x = arguments[2], y = arguments[3], z) {
+ assert.sameValue(x, 'third', 'first parameter');
+ assert.sameValue(y, 'fourth', 'second parameter');
+ assert.sameValue(z, 'third', 'third parameter');
+ callCount = callCount + 1;
+ }
+}
+
+C.method(undefined, undefined, 'third', 'fourth').next();
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/params-dflt-meth-args-unmapped.js b/js/src/tests/test262/language/statements/class/params-dflt-meth-args-unmapped.js
new file mode 100644
index 0000000000..e38673c6b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/params-dflt-meth-args-unmapped.js
@@ -0,0 +1,104 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+es6id: 14.5.15
+features: [default-parameters]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+class C {
+ method(x, _ = 0) {
+ assert.sameValue(x, undefined, 'parameter binding value (initial)');
+ assert.sameValue(
+ arguments[0], undefined, 'arguments property value (initial)'
+ );
+
+ arguments[0] = 1;
+
+ assert.sameValue(
+ x, undefined, 'parameter binding value (after arguments modification)'
+ );
+ assert.sameValue(
+ arguments[0], 1, 'arguments property value (after arguments modification)'
+ );
+
+ x = 2;
+
+ assert.sameValue(
+ x, 2, 'parameter binding value (after parameter binding modification)'
+ );
+ assert.sameValue(
+ arguments[0],
+ 1,
+ 'arguments property value (after parameter binding modification)'
+ );
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method();
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/params-dflt-meth-ref-arguments.js b/js/src/tests/test262/language/statements/class/params-dflt-meth-ref-arguments.js
new file mode 100644
index 0000000000..ce6906e22c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/params-dflt-meth-ref-arguments.js
@@ -0,0 +1,83 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+es6id: 14.5.15
+features: [default-parameters]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+class C {
+ method(x = arguments[2], y = arguments[3], z) {
+ assert.sameValue(x, 'third', 'first parameter');
+ assert.sameValue(y, 'fourth', 'second parameter');
+ assert.sameValue(z, 'third', 'third parameter');
+ callCount = callCount + 1;
+ }
+}
+
+C.prototype.method(undefined, undefined, 'third', 'fourth');
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/params-dflt-meth-static-args-unmapped.js b/js/src/tests/test262/language/statements/class/params-dflt-meth-static-args-unmapped.js
new file mode 100644
index 0000000000..5765b8ef0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/params-dflt-meth-static-args-unmapped.js
@@ -0,0 +1,104 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+es6id: 14.5.15
+features: [default-parameters]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+class C {
+ static method(x, _ = 0) {
+ assert.sameValue(x, undefined, 'parameter binding value (initial)');
+ assert.sameValue(
+ arguments[0], undefined, 'arguments property value (initial)'
+ );
+
+ arguments[0] = 1;
+
+ assert.sameValue(
+ x, undefined, 'parameter binding value (after arguments modification)'
+ );
+ assert.sameValue(
+ arguments[0], 1, 'arguments property value (after arguments modification)'
+ );
+
+ x = 2;
+
+ assert.sameValue(
+ x, 2, 'parameter binding value (after parameter binding modification)'
+ );
+ assert.sameValue(
+ arguments[0],
+ 1,
+ 'arguments property value (after parameter binding modification)'
+ );
+ callCount = callCount + 1;
+ }
+}
+
+C.method();
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/params-dflt-meth-static-ref-arguments.js b/js/src/tests/test262/language/statements/class/params-dflt-meth-static-ref-arguments.js
new file mode 100644
index 0000000000..fc107fd2e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/params-dflt-meth-static-ref-arguments.js
@@ -0,0 +1,83 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (static class expression method)
+esid: sec-runtime-semantics-bindingclassdeclarationevaluation
+es6id: 14.5.15
+features: [default-parameters]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ b. Else,
+ Let status be the result of performing PropertyDefinitionEvaluation for
+ m with arguments F and false.
+ [...]
+
+ 14.3.8 Runtime Semantics: DefineMethod
+
+ MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
+
+ [...]
+ 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
+ scope, strict). If functionPrototype was passed as a parameter then pass its
+ value as the functionPrototype optional argument of FunctionCreate.
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+class C {
+ static method(x = arguments[2], y = arguments[3], z) {
+ assert.sameValue(x, 'third', 'first parameter');
+ assert.sameValue(y, 'fourth', 'second parameter');
+ assert.sameValue(z, 'third', 'third parameter');
+ callCount = callCount + 1;
+ }
+}
+
+C.method(undefined, undefined, 'third', 'fourth');
+
+assert.sameValue(callCount, 1, 'method invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/poisoned-underscore-proto.js b/js/src/tests/test262/language/statements/class/poisoned-underscore-proto.js
new file mode 100644
index 0000000000..5f71e08af1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/poisoned-underscore-proto.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: prod-ClassDeclaration
+description: >
+ ClassDeclaration should directly set [[Prototype]] internal slot.
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 7. Let proto be ObjectCreate(protoParent).
+
+ ObjectCreate ( proto [ , internalSlotsList ] )
+
+ [...]
+ 4. Set obj.[[Prototype]] to proto.
+features: [class]
+---*/
+
+Object.defineProperty(Object.prototype, '__proto__', {
+ set: function() {
+ throw new Test262Error('should not be called');
+ },
+});
+
+class A extends Array {}
+
+assert.sameValue(new A(1).length, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/private-non-static-getter-static-setter-early-error.js b/js/src/tests/test262/language/statements/class/private-non-static-getter-static-setter-early-error.js
new file mode 100644
index 0000000000..7bfce814cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/private-non-static-getter-static-setter-early-error.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: >
+ It is a Syntax Error if we declare a private instance getter and private static setter
+features: [class-static-methods-private, class-methods-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ get #f() {}
+ static set #f(v) {}
+}
+
diff --git a/js/src/tests/test262/language/statements/class/private-non-static-setter-static-getter-early-error.js b/js/src/tests/test262/language/statements/class/private-non-static-setter-static-getter-early-error.js
new file mode 100644
index 0000000000..3710b7c81f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/private-non-static-setter-static-getter-early-error.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: >
+ It is a Syntax Error if we declare a private instance setter and a static private getter
+features: [class-static-methods-private, class-methods-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ set #f(v) {}
+ static get #f() {}
+}
+
diff --git a/js/src/tests/test262/language/statements/class/private-static-getter-non-static-setter-early-error.js b/js/src/tests/test262/language/statements/class/private-static-getter-non-static-setter-early-error.js
new file mode 100644
index 0000000000..fa3e07f438
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/private-static-getter-non-static-setter-early-error.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: >
+ It is a Syntax Error if we declare a private static getter and a private instance setter
+features: [class-static-methods-private, class-methods-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static get #f() {}
+ set #f(v) {}
+}
+
diff --git a/js/src/tests/test262/language/statements/class/private-static-setter-non-static-getter-early-error.js b/js/src/tests/test262/language/statements/class/private-static-setter-non-static-getter-early-error.js
new file mode 100644
index 0000000000..970336b31b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/private-static-setter-non-static-getter-early-error.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: >
+ It is a Syntax Error if we declare a static private setter and a private instance getter
+features: [class-static-methods-private, class-methods-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static set #f(v) {}
+ get #f() {}
+}
+
diff --git a/js/src/tests/test262/language/statements/class/restricted-properties.js b/js/src/tests/test262/language/statements/class/restricted-properties.js
new file mode 100644
index 0000000000..25a9b2db1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/restricted-properties.js
@@ -0,0 +1,62 @@
+// Copyright (C) 2015 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Functions created using ClassDeclaration syntactic form do not have own
+ properties "caller" or "arguments", but inherit them from
+ %FunctionPrototype%.
+es6id: 16.1
+---*/
+
+class BaseClass {}
+
+assert.sameValue(
+ BaseClass.hasOwnProperty('caller'), false, 'No "caller" own property'
+);
+assert.sameValue(
+ BaseClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
+);
+
+assert.throws(TypeError, function() {
+ return BaseClass.caller;
+});
+
+assert.throws(TypeError, function() {
+ BaseClass.caller = {};
+});
+
+assert.throws(TypeError, function() {
+ return BaseClass.arguments;
+});
+
+assert.throws(TypeError, function() {
+ BaseClass.arguments = {};
+});
+
+class SubClass extends BaseClass {}
+
+assert.sameValue(
+ SubClass.hasOwnProperty('caller'), false, 'No "caller" own property'
+);
+assert.sameValue(
+ SubClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
+);
+
+assert.throws(TypeError, function() {
+ return SubClass.caller;
+});
+
+assert.throws(TypeError, function() {
+ SubClass.caller = {};
+});
+
+assert.throws(TypeError, function() {
+ return SubClass.arguments;
+});
+
+assert.throws(TypeError, function() {
+ SubClass.arguments = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-gen-meth-paramsbody-var-close.js b/js/src/tests/test262/language/statements/class/scope-gen-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..52f5b6d614
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-gen-meth-paramsbody-var-close.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Disposal of variable environment for the function body
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+features: [generators]
+---*/
+
+var probe;
+
+class C {
+ // A parameter expression is necessary to trigger the creation of the scope
+ // under test.
+ *m(_ = null) {
+ var x = 'inside';
+ probe = function() { return x; };
+ }
+}
+C.prototype.m().next();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-gen-meth-paramsbody-var-open.js b/js/src/tests/test262/language/statements/class/scope-gen-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..1a04446edb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-gen-meth-paramsbody-var-open.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new variable environment for the function body (as distinct from
+ that for the function's parameters)
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+features: [generators]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+ *m(_ = probeParams = function() { return x; }) {
+ var x = 'inside';
+ probeBody = function() { return x; };
+ }
+}
+C.prototype.m().next();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-meth-paramsbody-var-close.js b/js/src/tests/test262/language/statements/class/scope-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..e22e47f812
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-meth-paramsbody-var-close.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Disposal of variable environment for the function body
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var probe;
+
+class C {
+ // A parameter expression is necessary to trigger the creation of the scope
+ // under test.
+ m(_ = null) {
+ var x = 'inside';
+ probe = function() { return x; };
+ }
+}
+C.prototype.m();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-meth-paramsbody-var-open.js b/js/src/tests/test262/language/statements/class/scope-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..d66ff74869
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-meth-paramsbody-var-open.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new variable environment for the function body (as distinct from
+ that for the function's parameters)
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+ m(_ = probeParams = function() { return x; }) {
+ var x = 'inside';
+ probeBody = function() { return x; };
+ }
+}
+C.prototype.m();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-name-lex-close.js b/js/src/tests/test262/language/statements/class/scope-name-lex-close.js
new file mode 100644
index 0000000000..11fbcdf31e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-name-lex-close.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: Removal of lexical environment for class "name"
+info: |
+ [...]
+ 22. Set the running execution context's LexicalEnvironment to lex.
+ [...]
+---*/
+
+class C {
+ method() {
+ return C;
+ }
+}
+
+var cls = C;
+assert.sameValue(typeof C, 'function');
+C = null;
+assert.sameValue(C, null);
+assert.sameValue(cls.prototype.method(), cls, 'from instance method');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-name-lex-open-heritage.js b/js/src/tests/test262/language/statements/class/scope-name-lex-open-heritage.js
new file mode 100644
index 0000000000..fb2a809b40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-name-lex-open-heritage.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ Creation of new lexical environment for the class "name" (with a heritage)
+info: |
+ 1. Let lex be the LexicalEnvironment of the running execution context.
+ 2. Let classScope be NewDeclarativeEnvironment(lex).
+ 3. Let classScopeEnvRec be classScope's EnvironmentRecord.
+ 4. If className is not undefined, then
+ a. Perform classScopeEnvRec.CreateImmutableBinding(className, true).
+ 5. If ClassHeritageopt is not present, then
+ [...]
+ 6. Else,
+ a. Set the running execution context's LexicalEnvironment to classScope.
+ [...]
+---*/
+
+var setBefore = function() { C = null; };
+var probeBefore = function() { return C; };
+var probeHeritage, setHeritage;
+
+class C extends (
+ probeHeritage = function() { return C; },
+ setHeritage = function() { C = null; }
+ ) {
+ method() {
+ return C;
+ }
+};
+
+var cls = probeBefore();
+assert.sameValue(typeof cls, 'function');
+setBefore();
+assert.sameValue(probeBefore(), null);
+assert.sameValue(probeHeritage(), cls, 'inner binding is independent');
+assert.throws(
+ TypeError, setHeritage, 'inner binding rejects modification'
+);
+assert.sameValue(
+ typeof probeHeritage(), 'function', 'inner binding is immutable'
+);
+assert.sameValue(
+ typeof cls.prototype.method(), 'function', 'from instance method'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-name-lex-open-no-heritage.js b/js/src/tests/test262/language/statements/class/scope-name-lex-open-no-heritage.js
new file mode 100644
index 0000000000..6755b167c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-name-lex-open-no-heritage.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ Creation of new lexical environment for the class "name" (without a
+ heritage)
+info: |
+ 1. Let lex be the LexicalEnvironment of the running execution context.
+ 2. Let classScope be NewDeclarativeEnvironment(lex).
+ 3. Let classScopeEnvRec be classScope's EnvironmentRecord.
+ 4. If className is not undefined, then
+ a. Perform classScopeEnvRec.CreateImmutableBinding(className, true).
+ 5. If ClassHeritageopt is not present, then
+ [...]
+ 6. Else,
+ a. Set the running execution context's LexicalEnvironment to classScope.
+ [...]
+ 11. Set the running execution context's LexicalEnvironment to classScope.
+---*/
+
+var probeBefore = function() { return C; };
+var setBefore = function() { C = null; };
+
+class C {
+ probe() {
+ return C;
+ }
+ modify() {
+ C = null;
+ }
+};
+
+var cls = probeBefore();
+assert.sameValue(typeof cls, 'function');
+setBefore();
+assert.sameValue(probeBefore(), null);
+
+assert.sameValue(cls.prototype.probe(), cls, 'inner binding value');
+assert.throws(
+ TypeError, cls.prototype.modify, 'inner binding rejects modification'
+);
+assert.sameValue(
+ typeof cls.prototype.probe(), 'function', 'inner binding is immutable'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-setter-paramsbody-var-close.js b/js/src/tests/test262/language/statements/class/scope-setter-paramsbody-var-close.js
new file mode 100644
index 0000000000..3441207a93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-setter-paramsbody-var-close.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Disposal of variable environment for the function body
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var probe;
+
+class C {
+ // A parameter expression is necessary to trigger the creation of the scope
+ // under test.
+ set a(_ = null) {
+ var x = 'inside';
+ probe = function() { return x; };
+ }
+}
+C.prototype.a = null;
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-setter-paramsbody-var-open.js b/js/src/tests/test262/language/statements/class/scope-setter-paramsbody-var-open.js
new file mode 100644
index 0000000000..0df927eb66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-setter-paramsbody-var-open.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new variable environment for the function body (as distinct from
+ that for the function's parameters)
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+ set a(_ = probeParams = function() { return x; }) {
+ var x = 'inside';
+ probeBody = function() { return x; };
+ }
+}
+C.prototype.a = undefined;
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-static-gen-meth-paramsbody-var-close.js b/js/src/tests/test262/language/statements/class/scope-static-gen-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..13fe98bfcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-static-gen-meth-paramsbody-var-close.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Disposal of variable environment for the function body
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+features: [generators]
+---*/
+
+var probe;
+
+class C {
+ // A parameter expression is necessary to trigger the creation of the scope
+ // under test.
+ static *m(_ = null) {
+ var x = 'inside';
+ probe = function() { return x; };
+ }
+}
+C.m().next();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-static-gen-meth-paramsbody-var-open.js b/js/src/tests/test262/language/statements/class/scope-static-gen-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..09a890069e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-static-gen-meth-paramsbody-var-open.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new variable environment for the function body (as distinct from
+ that for the function's parameters)
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+features: [generators]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+ static *m(_ = probeParams = function() { return x; }) {
+ var x = 'inside';
+ probeBody = function() { return x; };
+ }
+}
+C.m().next();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-static-meth-paramsbody-var-close.js b/js/src/tests/test262/language/statements/class/scope-static-meth-paramsbody-var-close.js
new file mode 100644
index 0000000000..cd94ab2977
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-static-meth-paramsbody-var-close.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Disposal of variable environment for the function body
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var probe;
+
+class C {
+ // A parameter expression is necessary to trigger the creation of the scope
+ // under test.
+ static m(_ = null) {
+ var x = 'inside';
+ probe = function() { return x; };
+ }
+}
+C.m();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-static-meth-paramsbody-var-open.js b/js/src/tests/test262/language/statements/class/scope-static-meth-paramsbody-var-open.js
new file mode 100644
index 0000000000..024867a196
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-static-meth-paramsbody-var-open.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new variable environment for the function body (as distinct from
+ that for the function's parameters)
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+ static m(_ = probeParams = function() { return x; }) {
+ var x = 'inside';
+ probeBody = function() { return x; };
+ }
+}
+C.m();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-static-setter-paramsbody-var-close.js b/js/src/tests/test262/language/statements/class/scope-static-setter-paramsbody-var-close.js
new file mode 100644
index 0000000000..97976c664a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-static-setter-paramsbody-var-close.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Disposal of variable environment for the function body
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var probe;
+
+class C {
+ // A parameter expression is necessary to trigger the creation of the scope
+ // under test.
+ static set a(_ = null) {
+ var x = 'inside';
+ probe = function() { return x; };
+ }
+}
+C.a = null;
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/scope-static-setter-paramsbody-var-open.js b/js/src/tests/test262/language/statements/class/scope-static-setter-paramsbody-var-open.js
new file mode 100644
index 0000000000..5f5975b048
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/scope-static-setter-paramsbody-var-open.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new variable environment for the function body (as distinct from
+ that for the function's parameters)
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+class C {
+ static set a(_ = probeParams = function() { return x; }) {
+ var x = 'inside';
+ probeBody = function() { return x; };
+ }
+}
+C.a = undefined;
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/setter-length-dflt.js b/js/src/tests/test262/language/statements/class/setter-length-dflt.js
new file mode 100644
index 0000000000..c8099c2415
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/setter-length-dflt.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.1.6
+description: >
+ Default parameters' effect on function length
+info: |
+ Function length is counted by the non initialized parameters in the left.
+
+ 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope)
+
+ [...]
+ 2. Let len be the ExpectedArgumentCount of ParameterList.
+ 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]:
+ len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
+ [...]
+
+ FormalsList : FormalParameter
+
+ 1. If HasInitializer of FormalParameter is true return 0
+ 2. Return 1.
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let count be the ExpectedArgumentCount of FormalsList.
+ 2. If HasInitializer of FormalsList is true or HasInitializer of
+ FormalParameter is true, return count.
+ 3. Return count+1.
+features: [default-parameters]
+includes: [propertyHelper.js]
+---*/
+
+class C { set m(x = 42) {} }
+var set = Object.getOwnPropertyDescriptor(C.prototype, 'm').set;
+
+assert.sameValue(set.length, 0, 'FormalsList: x = 42');
+verifyNotEnumerable(set, 'length');
+verifyNotWritable(set, 'length');
+verifyConfigurable(set, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/shell.js b/js/src/tests/test262/language/statements/class/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/shell.js
diff --git a/js/src/tests/test262/language/statements/class/static-classelementname-abrupt-completion.js b/js/src/tests/test262/language/statements/class/static-classelementname-abrupt-completion.js
new file mode 100644
index 0000000000..f18907bedd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-classelementname-abrupt-completion.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Class definition should error if evaluation of static ClassElementName errors
+esid: runtime-semantics-class-definition-evaluation
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+ ...
+ 27. For each ClassElement e in order from elements
+ a. If IsStatic of e is false, then
+ i. Let fields be the result of performing ClassElementEvaluation
+ for e with arguments proto and false.
+ b. Else,
+ i. Let fields be the result of performing ClassElementEvaluation
+ for e with arguments F and false.
+ c. If fields is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
+ iii. Return Completion(status).
+
+features: [class-static-fields-public]
+---*/
+
+function f() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ class C {
+ static [f()]
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-gen-method-param-dflt-yield.js b/js/src/tests/test262/language/statements/class/static-gen-method-param-dflt-yield.js
new file mode 100644
index 0000000000..f9db1da288
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-gen-method-param-dflt-yield.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-generator-function-definitions
+es6id: 14.4
+description: >
+ YieldExpression cannot be used within the FormalParameters of a generator
+ function
+info: |
+ GeneratorMethod[Yield]:
+
+ * PropertyName[?Yield] ( StrictFormalParameters[Yield] ) { GeneratorBody }
+
+ YieldExpression cannot be used within the FormalParameters of a generator
+ function because any expressions that are part of FormalParameters are
+ evaluated before the resulting generator object is in a resumable state.
+features: [generators, default-parameters]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static *g(x = yield) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-abrupt.js b/js/src/tests/test262/language/statements/class/static-init-abrupt.js
new file mode 100644
index 0000000000..0f94cb1962
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-abrupt.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Returns abrupt completion and halts further class body evaluation
+info: |
+ 34. For each element elementRecord of staticElements in List order, do
+ a. If elementRecord is a ClassFieldDefinition Record, then
+ [...]
+ b. Else,
+ i. Assert: fieldRecord is a ClassStaticBlockDefinition Record.
+ ii. Let status be the result of performing EvaluateStaticBlock(F,
+ elementRecord).
+ d. If status is an abrupt completion, then
+ i. Set the running execution context's LexicalEnvironment to lex.
+ ii. Set the running execution context's PrivateEnvironment to
+ outerPrivateEnvironment.
+ iii. Return Completion(status).
+features: [class-static-fields-public, class-static-block]
+---*/
+
+var thrown = new Test262Error();
+var caught;
+var sameBlock = false;
+var subsequentField = false;
+var subsequentBlock = false;
+
+try {
+ class C {
+ static {
+ throw thrown;
+ sameBlock = true;
+ }
+ static x = subsequentField = true;
+ static {
+ subsequentBlock = true;
+ }
+ }
+} catch (error) {
+ caught = error;
+}
+
+assert.sameValue(caught, thrown);
+assert.sameValue(sameBlock, false, 'same block');
+assert.sameValue(subsequentField, false, 'subsequent field');
+assert.sameValue(subsequentBlock, false, 'subsequent block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-arguments-functions.js b/js/src/tests/test262/language/statements/class/static-init-arguments-functions.js
new file mode 100644
index 0000000000..0473586d1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-arguments-functions.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The identifier `arguments` is not restricted within function forms
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ - It is a Syntax Error if ContainsArguments of ClassStaticBlockStatementList
+ is true.
+includes: [compareArray.js]
+features: [class-static-block]
+---*/
+
+var fn, fnParam;
+var gen, genParam;
+var asyncFn, asyncFnParam;
+
+class C {
+ static {
+ (function({test262 = fnParam = arguments}) {
+ fn = arguments;
+ })('function');
+
+ (function * ({test262 = genParam = arguments}) {
+ gen = arguments;
+ })('generator function').next();
+
+ (async function ({test262 = asyncFnParam = arguments}) {
+ asyncFn = arguments;
+ })('async function');
+ }
+}
+
+assert.compareArray(['function'], fn, 'body');
+assert.compareArray(['function'], fnParam, 'parameter');
+assert.compareArray(['generator function'], gen, 'body');
+assert.compareArray(['generator function'], genParam, 'parameter');
+assert.compareArray(['async function'], asyncFn, 'body');
+assert.compareArray(['async function'], asyncFnParam, 'parameter');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-arguments-methods.js b/js/src/tests/test262/language/statements/class/static-init-arguments-methods.js
new file mode 100644
index 0000000000..bb4f12c008
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-arguments-methods.js
@@ -0,0 +1,60 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The identifier `arguments` is not restricted within method forms
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ - It is a Syntax Error if ContainsArguments of ClassStaticBlockStatementList
+ is true.
+includes: [compareArray.js]
+features: [class-static-block]
+---*/
+
+var instance;
+var method, methodParam;
+var getter;
+var setter, setterParam;
+var genMethod, genMethodParam;
+var asyncMethod, asyncMethodParam;
+
+class C {
+ static {
+ instance = new class {
+ method({test262 = methodParam = arguments}) {
+ method = arguments;
+ }
+ get accessor() {
+ getter = arguments;
+ }
+ set accessor({test262 = setterParam = arguments}) {
+ setter = arguments;
+ }
+ *gen({test262 = genMethodParam = arguments}) {
+ genMethod = arguments;
+ }
+ async async({test262 = asyncMethodParam = arguments}) {
+ asyncMethod = arguments;
+ }
+ }();
+ }
+}
+
+instance.method('method');
+instance.accessor;
+instance.accessor = 'setter';
+instance.gen('generator method').next();
+instance.async('async method');
+
+assert.compareArray(['method'], method, 'body');
+assert.compareArray(['method'], methodParam, 'parameter');
+assert.compareArray([], getter, 'body');
+assert.compareArray(['setter'], setter, 'body');
+assert.compareArray(['setter'], setterParam, 'parameter');
+assert.compareArray(['generator method'], genMethod, 'body');
+assert.compareArray(['generator method'], genMethodParam, 'parameter');
+assert.compareArray(['async method'], asyncMethod, 'body');
+assert.compareArray(['async method'], asyncMethodParam, 'parameter');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-await-binding-invalid.js b/js/src/tests/test262/language/statements/class/static-init-await-binding-invalid.js
new file mode 100644
index 0000000000..071063276e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-await-binding-invalid.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: BindingIdentifier may not be `await` within class static blocks
+info: |
+ BindingIdentifier : Identifier
+
+ [...]
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ class await {}
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-await-binding-valid.js b/js/src/tests/test262/language/statements/class/static-init-await-binding-valid.js
new file mode 100644
index 0000000000..caecf44369
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-await-binding-valid.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The `await` keyword is interpreted as an identifier within arrow function bodies
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ [...]
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+features: [class-static-block]
+---*/
+
+class C {
+ static {
+ (() => { class await {} });
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-expr-new-target.js b/js/src/tests/test262/language/statements/class/static-init-expr-new-target.js
new file mode 100644
index 0000000000..8753b03bdd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-expr-new-target.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-operations-on-objects
+description: The "new.target" value within a static initialization block is undefined
+info: |
+ 2.1.1 EvaluateStaticBlock ( receiver , blockRecord )
+
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: blockRecord is a ClassStaticBlockDefinition Record.
+ 3. Perform ? Call(blockRecord.[[Body]], receiver).
+features: [class-static-block]
+---*/
+
+var value = null;
+
+class C {
+ static {
+ value = new.target;
+ }
+}
+
+assert.sameValue(value, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-expr-this.js b/js/src/tests/test262/language/statements/class/static-init-expr-this.js
new file mode 100644
index 0000000000..b71a935c13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-expr-this.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-operations-on-objects
+description: The "this" value within a static initialization block is the class
+info: |
+ 2.1.1 EvaluateStaticBlock ( receiver , blockRecord )
+
+ 1. Assert: Type(receiver) is Object.
+ 2. Assert: blockRecord is a ClassStaticBlockDefinition Record.
+ 3. Perform ? Call(blockRecord.[[Body]], receiver).
+features: [class-static-block]
+---*/
+
+var value;
+
+class C {
+ static {
+ value = this;
+ }
+}
+
+assert.sameValue(value, C);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-arguments.js b/js/src/tests/test262/language/statements/class/static-init-invalid-arguments.js
new file mode 100644
index 0000000000..1b80fe85ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-arguments.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Block cannot use `arguments` as an identifier
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ - It is a Syntax Error if ContainsArguments of ClassStaticBlockStatementList
+ is true.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ (class { [argument\u0073]() {} });
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-await.js b/js/src/tests/test262/language/statements/class/static-init-invalid-await.js
new file mode 100644
index 0000000000..87dc665a6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-await.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions
+description: The "Await" parsing context does not apply to the block's statement list
+info: |
+ Syntax
+
+ [...]
+
+ ClassStaticBlockStatementList :
+ StatementList[~Yield, +Await, ~Return]opt
+
+ ## 15.7.1 Static Semantics: Early Errors
+
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+async function f() {
+ class C {
+ static {
+ await 0;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-label-dup.js b/js/src/tests/test262/language/statements/class/static-init-invalid-label-dup.js
new file mode 100644
index 0000000000..3f8ffe448e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-label-dup.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Block cannot declare duplicate labels
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ - It is a Syntax Error if ContainsDuplicateLabels of
+ ClassStaticBlockStatementList with argument « » is true.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ x: x: 0;
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-lex-dup.js b/js/src/tests/test262/language/statements/class/static-init-invalid-lex-dup.js
new file mode 100644
index 0000000000..2d750737cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-lex-dup.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Block cannot declare duplicate lexically-scoped bindings
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ - It is a Syntax Error if the LexicallyDeclaredNames of
+ ClassStaticBlockStatementList contains any duplicate entries.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ let x;
+ let x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-lex-var.js b/js/src/tests/test262/language/statements/class/static-init-invalid-lex-var.js
new file mode 100644
index 0000000000..2aa0e4286b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-lex-var.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Block cannot declare a lexically-scoped binding and function-scoped binding with the same name.
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ - It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ ClassStaticBlockStatementList also occurs in the VarDeclaredNames of
+ ClassStaticBlockStatementList.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ let x;
+ var x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-return.js b/js/src/tests/test262/language/statements/class/static-init-invalid-return.js
new file mode 100644
index 0000000000..7ee3cbe89b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-return.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions
+description: The "Return" parsing context does not apply to the block's statement list
+info: |
+ Syntax
+
+ [...]
+
+ ClassStaticBlockStatementList :
+ StatementList[~Yield, +Await, ~Return]opt
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ class C {
+ static {
+ return;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-super-call.js b/js/src/tests/test262/language/statements/class/static-init-invalid-super-call.js
new file mode 100644
index 0000000000..774bcaf4d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-super-call.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Block cannot contain SuperCall
+info: |
+ ClassStaticBlock : static { ClassStaticBlockBody }
+
+ - It is a Syntax Error if HasDirectSuper of ClassStaticBlock is true.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ super();
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-undefined-break-target.js b/js/src/tests/test262/language/statements/class/static-init-invalid-undefined-break-target.js
new file mode 100644
index 0000000000..f5a42e5d0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-undefined-break-target.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Block cannot reference an undefined `break` target
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ - It is a Syntax Error if ContainsUndefinedBreakTarget of
+ ClassStaticBlockStatementList with argument « » is true.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ x: while (false) {
+ break y;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-undefined-continue-target.js b/js/src/tests/test262/language/statements/class/static-init-invalid-undefined-continue-target.js
new file mode 100644
index 0000000000..b98dd61045
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-undefined-continue-target.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Block cannot reference an undefined `continue` target
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ - It is a Syntax Error if ContainsUndefinedContinueTarget of
+ ClassStaticBlockStatementList with arguments « » and « » is true.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ x: while (false) {
+ continue y;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-invalid-yield.js b/js/src/tests/test262/language/statements/class/static-init-invalid-yield.js
new file mode 100644
index 0000000000..bd872a1e85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-invalid-yield.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions
+description: The "Yield" parsing context does not apply to the block's statement list
+info: |
+ Syntax
+
+ [...]
+
+ ClassStaticBlockStatementList :
+ StatementList[~Yield, +Await, ~Return]opt
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+function * g() {
+ class C {
+ static {
+ yield;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/static-init-scope-lex-close.js b/js/src/tests/test262/language/statements/class/static-init-scope-lex-close.js
new file mode 100644
index 0000000000..e433a49a5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-scope-lex-close.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classstaticblockdefinitionevaluation
+description: Destruction of environment record for variable-scoped bindings
+info: |
+ ClassStaticBlock : static { ClassStaticBlockBody }
+
+ 1. Let lex be the running execution context's LexicalEnvironment.
+ 2. Let privateScope be the running execution context's PrivateEnvironment.
+ 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope).
+features: [class-static-block]
+---*/
+
+var test262 = 'outer scope';
+var probe;
+
+class C {
+ static {
+ let test262 = 'first block';
+ }
+ static {
+ probe = test262;
+ }
+}
+
+assert.sameValue(probe, 'outer scope');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-scope-lex-derived.js b/js/src/tests/test262/language/statements/class/static-init-scope-lex-derived.js
new file mode 100644
index 0000000000..364583c077
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-scope-lex-derived.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classstaticblockdefinitionevaluation
+description: Derivation of environment record for lexically-scoped bindings
+info: |
+ ClassStaticBlock : static { ClassStaticBlockBody }
+
+ 1. Let lex be the running execution context's LexicalEnvironment.
+ 2. Let privateScope be the running execution context's PrivateEnvironment.
+ 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope).
+features: [class-static-block]
+---*/
+
+let probe;
+
+class C {
+ static {
+ probe = C;
+ }
+}
+
+assert.sameValue(probe, C);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-scope-lex-open.js b/js/src/tests/test262/language/statements/class/static-init-scope-lex-open.js
new file mode 100644
index 0000000000..8567ef1cff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-scope-lex-open.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classstaticblockdefinitionevaluation
+description: Creation of new environment record for lexically-scoped bindings
+info: |
+ ClassStaticBlock : static { ClassStaticBlockBody }
+
+ 1. Let lex be the running execution context's LexicalEnvironment.
+ 2. Let privateScope be the running execution context's PrivateEnvironment.
+ 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope).
+features: [class-static-block]
+---*/
+
+let test262 = 'outer scope';
+let probe1, probe2;
+
+class C {
+ static {
+ let test262 = 'first block';
+ probe1 = test262;
+ }
+ static {
+ let test262 = 'second block';
+ probe2 = test262;
+ }
+}
+
+assert.sameValue(test262, 'outer scope');
+assert.sameValue(probe1, 'first block');
+assert.sameValue(probe2, 'second block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-scope-private.js b/js/src/tests/test262/language/statements/class/static-init-scope-private.js
new file mode 100644
index 0000000000..2718097083
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-scope-private.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classstaticblockdefinitionevaluation
+description: Shares environment record for privately-scoped bindings
+info: |
+ ClassStaticBlock : static { ClassStaticBlockBody }
+
+ 1. Let lex be the running execution context's LexicalEnvironment.
+ 2. Let privateScope be the running execution context's PrivateEnvironment.
+ 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope).
+features: [class-fields-private, class-static-block]
+---*/
+
+var probe;
+
+class C {
+ static #test262 = 'private';
+
+ static {
+ probe = C.#test262;
+ }
+}
+
+assert.sameValue(probe, 'private');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-scope-var-close.js b/js/src/tests/test262/language/statements/class/static-init-scope-var-close.js
new file mode 100644
index 0000000000..f4e9f88a34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-scope-var-close.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classstaticblockdefinitionevaluation
+description: Destruction of environment record for variable-scoped bindings
+info: |
+ ClassStaticBlock : static { ClassStaticBlockBody }
+
+ 1. Let lex be the running execution context's LexicalEnvironment.
+ 2. Let privateScope be the running execution context's PrivateEnvironment.
+ 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope).
+features: [class-static-block]
+---*/
+
+var test262 = 'outer scope';
+var probe;
+
+class C {
+ static {
+ var test262 = 'first block';
+ }
+ static {
+ probe = test262;
+ }
+}
+
+assert.sameValue(probe, 'outer scope');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-scope-var-derived.js b/js/src/tests/test262/language/statements/class/static-init-scope-var-derived.js
new file mode 100644
index 0000000000..befc4dd9cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-scope-var-derived.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classstaticblockdefinitionevaluation
+description: Derivation of environment record for variable-scoped bindings
+info: |
+ ClassStaticBlock : static { ClassStaticBlockBody }
+
+ 1. Let lex be the running execution context's LexicalEnvironment.
+ 2. Let privateScope be the running execution context's PrivateEnvironment.
+ 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope).
+features: [class-static-block]
+---*/
+
+var test262 = 'outer scope';
+var probe;
+
+class C {
+ static {
+ probe = test262;
+ }
+}
+
+assert.sameValue(probe, 'outer scope');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-scope-var-open.js b/js/src/tests/test262/language/statements/class/static-init-scope-var-open.js
new file mode 100644
index 0000000000..0711446b8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-scope-var-open.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classstaticblockdefinitionevaluation
+description: Creation of new environment record for variable-scoped bindings
+info: |
+ ClassStaticBlock : static { ClassStaticBlockBody }
+
+ 1. Let lex be the running execution context's LexicalEnvironment.
+ 2. Let privateScope be the running execution context's PrivateEnvironment.
+ 3. Let body be OrdinaryFunctionCreate(Method, « », ClassStaticBlockBody, lex, privateScope).
+features: [class-static-block]
+---*/
+
+var test262 = 'outer scope';
+var probe1, probe2;
+
+class C {
+ static {
+ var test262 = 'first block';
+ probe1 = test262;
+ }
+ static {
+ var test262 = 'second block';
+ probe2 = test262;
+ }
+}
+
+assert.sameValue(test262, 'outer scope');
+assert.sameValue(probe1, 'first block');
+assert.sameValue(probe2, 'second block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-sequence.js b/js/src/tests/test262/language/statements/class/static-init-sequence.js
new file mode 100644
index 0000000000..f3afe0139e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-sequence.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classelementevaluation
+description: Static blocks are evaluated in the order they appear in the source text, interleaved with static fields
+info: |
+ 5.1.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 34. For each element elementRecord of staticElements in List order, do
+ a. If elementRecord is a ClassFieldDefinition Record, then
+ i. Let status be the result of performing DefineField(F,
+ elementRecord).
+ b. Else,
+ i. Assert: fieldRecord is a ClassStaticBlockDefinition Record.
+ ii. Let status be the result of performing EvaluateStaticBlock(F,
+ elementRecord).
+ [...]
+features: [class-static-fields-public, class-static-block]
+---*/
+
+var sequence = [];
+
+class C {
+ static x = sequence.push('first field');
+ static {
+ sequence.push('first block');
+ }
+ static x = sequence.push('second field');
+ static {
+ sequence.push('second block');
+ }
+}
+
+assert.sameValue(sequence[0], 'first field');
+assert.sameValue(sequence[1], 'first block');
+assert.sameValue(sequence[2], 'second field');
+assert.sameValue(sequence[3], 'second block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-statement-list-optional.js b/js/src/tests/test262/language/statements/class/static-init-statement-list-optional.js
new file mode 100644
index 0000000000..21bf888ed7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-statement-list-optional.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions
+description: The block's statement list is optional
+info: |
+ Syntax
+
+ [...]
+
+ ClassStaticBlockStatementList :
+ StatementList[~Yield, +Await, ~Return]opt
+features: [class-static-block]
+---*/
+
+class C {
+ static {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-init-super-property.js b/js/src/tests/test262/language/statements/class/static-init-super-property.js
new file mode 100644
index 0000000000..1e28eb6753
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-init-super-property.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classstaticblockdefinitionevaluation
+description: The home object for a class static initialization block is the parent class
+info: |
+ ClassStaticBlock : static { ClassStaticBlockBody }
+
+ [...]
+ 4. Perform MakeMethod(body, homeObject).
+features: [class-static-block]
+---*/
+
+function Parent() {}
+Parent.test262 = 'test262';
+var value;
+
+class C extends Parent {
+ static {
+ value = super.test262;
+ }
+}
+
+assert.sameValue(value, 'test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-method-gen-non-configurable-err.js b/js/src/tests/test262/language/statements/class/static-method-gen-non-configurable-err.js
new file mode 100644
index 0000000000..09b60d1539
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-method-gen-non-configurable-err.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation
+es6id: 14.4.13
+description: Failure to define property for static generator method
+info: |
+ [...]
+ 10. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]:
+ true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ 11. Return ? DefinePropertyOrThrow(object, propKey, desc).
+features: [generators]
+---*/
+
+assert.throws(TypeError, function() {
+ class C { static *['prototype']() {} }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-method-length-dflt.js b/js/src/tests/test262/language/statements/class/static-method-length-dflt.js
new file mode 100644
index 0000000000..d8691ebe6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-method-length-dflt.js
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.1.6
+description: >
+ Default parameters' effect on function length
+info: |
+ Function length is counted by the non initialized parameters in the left.
+
+ 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope)
+
+ [...]
+ 2. Let len be the ExpectedArgumentCount of ParameterList.
+ 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]:
+ len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
+ [...]
+
+ FormalsList : FormalParameter
+
+ 1. If HasInitializer of FormalParameter is true return 0
+ 2. Return 1.
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let count be the ExpectedArgumentCount of FormalsList.
+ 2. If HasInitializer of FormalsList is true or HasInitializer of
+ FormalParameter is true, return count.
+ 3. Return count+1.
+features: [default-parameters]
+includes: [propertyHelper.js]
+---*/
+
+class C1 { static m(x = 42) {} }
+
+var m1 = C1.m;
+
+assert.sameValue(m1.length, 0, 'formalslist: x = 42');
+verifyNotEnumerable(m1, 'length');
+verifyNotWritable(m1, 'length');
+verifyConfigurable(m1, 'length');
+
+class C2 { static m(x = 42, y) {} }
+
+var m2 = C2.m;
+
+assert.sameValue(m2.length, 0, 'formalslist: x = 42, y');
+verifyNotEnumerable(m2, 'length');
+verifyNotWritable(m2, 'length');
+verifyConfigurable(m2, 'length');
+
+class C3 { static m(x, y = 42) {} }
+
+var m3 = C3.m;
+
+assert.sameValue(m3.length, 1, 'formalslist: x, y = 42');
+verifyNotEnumerable(m3, 'length');
+verifyNotWritable(m3, 'length');
+verifyConfigurable(m3, 'length');
+
+class C4 { static m(x, y = 42, z) {} }
+
+var m4 = C4.m;
+
+assert.sameValue(m4.length, 1, 'formalslist: x, y = 42, z');
+verifyNotEnumerable(m4, 'length');
+verifyNotWritable(m4, 'length');
+verifyConfigurable(m4, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-method-non-configurable-err.js b/js/src/tests/test262/language/statements/class/static-method-non-configurable-err.js
new file mode 100644
index 0000000000..404fa01f47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-method-non-configurable-err.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-method-definitions-runtime-semantics-propertydefinitionevaluation
+es6id: 14.3.9
+description: Failure to define property for static method
+info: |
+ [...]
+ 10. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]:
+ true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
+ 11. Return ? DefinePropertyOrThrow(object, propKey, desc).
+---*/
+
+assert.throws(TypeError, function() {
+ class C { static ['prototype']() {} }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/static-method-param-yield.js b/js/src/tests/test262/language/statements/class/static-method-param-yield.js
new file mode 100644
index 0000000000..ce498c7f29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/static-method-param-yield.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-method-definitions
+es6id: 14.3
+description: >
+ YieldExpression cannot be used within the FormalParameters of a class method
+info: |
+ MethodDefinition[Yield] :
+
+ PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody }
+features: [generators, default-parameters]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static m(x = yield) {}
+}
diff --git a/js/src/tests/test262/language/statements/class/strict-mode/arguments-callee.js b/js/src/tests/test262/language/statements/class/strict-mode/arguments-callee.js
new file mode 100644
index 0000000000..f0538aff17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/strict-mode/arguments-callee.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class strict mode
+---*/
+var D = class extends function() {
+ arguments.callee;
+} {};
+assert.throws(TypeError, function() {
+ Object.getPrototypeOf(D).arguments;
+});
+assert.throws(TypeError, function() {
+ new D;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/strict-mode/browser.js b/js/src/tests/test262/language/statements/class/strict-mode/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/strict-mode/browser.js
diff --git a/js/src/tests/test262/language/statements/class/strict-mode/shell.js b/js/src/tests/test262/language/statements/class/strict-mode/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/strict-mode/shell.js
diff --git a/js/src/tests/test262/language/statements/class/strict-mode/with.js b/js/src/tests/test262/language/statements/class/strict-mode/with.js
new file mode 100644
index 0000000000..064a6cd008
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/strict-mode/with.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class strict mode: `with` disallowed
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C extends (function B() { with ({}); return B; }()) {}
+
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/browser.js b/js/src/tests/test262/language/statements/class/subclass-builtins/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/shell.js b/js/src/tests/test262/language/statements/class/subclass-builtins/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-AggregateError.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-AggregateError.js
new file mode 100644
index 0000000000..7f1c35da3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-AggregateError.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/AggregateError.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubAggregateError() instanceof AggregateError (Subclass instanceof Heritage)
+features: [AggregateError]
+flags: [generated]
+---*/
+
+
+class Subclass extends AggregateError {}
+
+const sub = new Subclass([]);
+assert(sub instanceof Subclass);
+assert(sub instanceof AggregateError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Array.js
new file mode 100644
index 0000000000..4da3d445cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Array.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubArray() instanceof Array (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-ArrayBuffer.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-ArrayBuffer.js
new file mode 100644
index 0000000000..7c36fef86e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-ArrayBuffer.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/ArrayBuffer.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubArrayBuffer() instanceof ArrayBuffer (Subclass instanceof Heritage)
+features: [TypedArray, ArrayBuffer]
+flags: [generated]
+---*/
+
+
+class Subclass extends ArrayBuffer {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof ArrayBuffer);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-BigInt64Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-BigInt64Array.js
new file mode 100644
index 0000000000..2c348d0750
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-BigInt64Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/BigInt64Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubBigInt64Array() instanceof BigInt64Array (Subclass instanceof Heritage)
+features: [TypedArray, BigInt]
+flags: [generated]
+---*/
+
+
+class Subclass extends BigInt64Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof BigInt64Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-BigUint64Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-BigUint64Array.js
new file mode 100644
index 0000000000..4167ae674d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-BigUint64Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/BigUint64Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubBigUint64Array() instanceof BigUint64Array (Subclass instanceof Heritage)
+features: [TypedArray, BigInt]
+flags: [generated]
+---*/
+
+
+class Subclass extends BigUint64Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof BigUint64Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Boolean.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Boolean.js
new file mode 100644
index 0000000000..c54788605e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Boolean.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Boolean.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubBoolean() instanceof Boolean (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends Boolean {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Boolean);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-DataView.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-DataView.js
new file mode 100644
index 0000000000..3f554f75b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-DataView.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/DataView.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubDataView() instanceof DataView (Subclass instanceof Heritage)
+features: [TypedArray, DataView]
+flags: [generated]
+---*/
+
+
+class Subclass extends DataView {}
+
+const sub = new Subclass(new ArrayBuffer(1));
+assert(sub instanceof Subclass);
+assert(sub instanceof DataView);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Date.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Date.js
new file mode 100644
index 0000000000..5ef9ae4f1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Date.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Date.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubDate() instanceof Date (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends Date {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Date);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Error.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Error.js
new file mode 100644
index 0000000000..0b1abb0c67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Error.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Error.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubError() instanceof Error (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends Error {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Error);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-EvalError.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-EvalError.js
new file mode 100644
index 0000000000..bdd98e6ba5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-EvalError.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/EvalError.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubEvalError() instanceof EvalError (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends EvalError {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof EvalError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Float32Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Float32Array.js
new file mode 100644
index 0000000000..576c9a5b26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Float32Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Float32Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubFloat32Array() instanceof Float32Array (Subclass instanceof Heritage)
+features: [TypedArray, Float32Array]
+flags: [generated]
+---*/
+
+
+class Subclass extends Float32Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Float32Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Float64Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Float64Array.js
new file mode 100644
index 0000000000..68b383d543
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Float64Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Float64Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubFloat64Array() instanceof Float64Array (Subclass instanceof Heritage)
+features: [TypedArray, Float64Array]
+flags: [generated]
+---*/
+
+
+class Subclass extends Float64Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Float64Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Function.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Function.js
new file mode 100644
index 0000000000..1271932e28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Function.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Function.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubFunction() instanceof Function (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends Function {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Function);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int16Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int16Array.js
new file mode 100644
index 0000000000..b55e8e12d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int16Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Int16Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubInt16Array() instanceof Int16Array (Subclass instanceof Heritage)
+features: [TypedArray, Int16Array]
+flags: [generated]
+---*/
+
+
+class Subclass extends Int16Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Int16Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int32Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int32Array.js
new file mode 100644
index 0000000000..8776f9f93d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int32Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Int32Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubInt32Array() instanceof Int32Array (Subclass instanceof Heritage)
+features: [TypedArray, Int32Array]
+flags: [generated]
+---*/
+
+
+class Subclass extends Int32Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Int32Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int8Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int8Array.js
new file mode 100644
index 0000000000..416fa8db5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Int8Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Int8Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubInt8Array() instanceof Int8Array (Subclass instanceof Heritage)
+features: [TypedArray, Int8Array]
+flags: [generated]
+---*/
+
+
+class Subclass extends Int8Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Int8Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Map.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Map.js
new file mode 100644
index 0000000000..a47e381092
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Map.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Map.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubMap() instanceof Map (Subclass instanceof Heritage)
+features: [Map]
+flags: [generated]
+---*/
+
+
+class Subclass extends Map {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Map);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Number.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Number.js
new file mode 100644
index 0000000000..c1d5057aab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Number.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Number.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubNumber() instanceof Number (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends Number {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Number);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Object.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Object.js
new file mode 100644
index 0000000000..b784f10b87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Object.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Object.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubObject() instanceof Object (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends Object {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Object);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Promise.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Promise.js
new file mode 100644
index 0000000000..3f74cc8625
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Promise.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Promise.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubPromise() instanceof Promise (Subclass instanceof Heritage)
+features: [Promise]
+flags: [generated]
+---*/
+
+
+class Subclass extends Promise {}
+
+const sub = new Subclass(() => {});
+assert(sub instanceof Subclass);
+assert(sub instanceof Promise);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-RangeError.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-RangeError.js
new file mode 100644
index 0000000000..1c6693bcad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-RangeError.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/RangeError.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubRangeError() instanceof RangeError (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends RangeError {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof RangeError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-ReferenceError.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-ReferenceError.js
new file mode 100644
index 0000000000..05613c49ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-ReferenceError.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/ReferenceError.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubReferenceError() instanceof ReferenceError (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends ReferenceError {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof ReferenceError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-RegExp.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-RegExp.js
new file mode 100644
index 0000000000..f1e8dc9869
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-RegExp.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/RegExp.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubRegExp() instanceof RegExp (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends RegExp {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof RegExp);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Set.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Set.js
new file mode 100644
index 0000000000..0724548e7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Set.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Set.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubSet() instanceof Set (Subclass instanceof Heritage)
+features: [Set]
+flags: [generated]
+---*/
+
+
+class Subclass extends Set {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Set);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-SharedArrayBuffer.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-SharedArrayBuffer.js
new file mode 100644
index 0000000000..240412e689
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-SharedArrayBuffer.js
@@ -0,0 +1,18 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/SharedArrayBuffer.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubSharedArrayBuffer() instanceof SharedArrayBuffer (Subclass instanceof Heritage)
+features: [SharedArrayBuffer]
+flags: [generated]
+---*/
+
+
+class Subclass extends SharedArrayBuffer {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof SharedArrayBuffer);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-String.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-String.js
new file mode 100644
index 0000000000..8884f5bacc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-String.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/String.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubString() instanceof String (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends String {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof String);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-SyntaxError.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-SyntaxError.js
new file mode 100644
index 0000000000..b865e826f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-SyntaxError.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/SyntaxError.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubSyntaxError() instanceof SyntaxError (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends SyntaxError {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof SyntaxError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-TypeError.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-TypeError.js
new file mode 100644
index 0000000000..20f2b916c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-TypeError.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/TypeError.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubTypeError() instanceof TypeError (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends TypeError {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof TypeError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-URIError.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-URIError.js
new file mode 100644
index 0000000000..2dfd7fae49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-URIError.js
@@ -0,0 +1,16 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/URIError.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubURIError() instanceof URIError (Subclass instanceof Heritage)
+flags: [generated]
+---*/
+
+
+class Subclass extends URIError {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof URIError);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint16Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint16Array.js
new file mode 100644
index 0000000000..11ef8aace7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint16Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Uint16Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubUint16Array() instanceof Uint16Array (Subclass instanceof Heritage)
+features: [TypedArray, Uint16Array]
+flags: [generated]
+---*/
+
+
+class Subclass extends Uint16Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Uint16Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint32Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint32Array.js
new file mode 100644
index 0000000000..f349a0f3f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint32Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Uint32Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubUint32Array() instanceof Uint32Array (Subclass instanceof Heritage)
+features: [TypedArray, Uint32Array]
+flags: [generated]
+---*/
+
+
+class Subclass extends Uint32Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Uint32Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint8Array.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint8Array.js
new file mode 100644
index 0000000000..e542c6d412
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint8Array.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Uint8Array.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubUint8Array() instanceof Uint8Array (Subclass instanceof Heritage)
+features: [TypedArray, Uint8Array]
+flags: [generated]
+---*/
+
+
+class Subclass extends Uint8Array {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Uint8Array);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint8ClampedArray.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint8ClampedArray.js
new file mode 100644
index 0000000000..e45f89dbdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-Uint8ClampedArray.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/Uint8ClampedArray.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubUint8ClampedArray() instanceof Uint8ClampedArray (Subclass instanceof Heritage)
+features: [TypedArray, Uint8ClampedArray]
+flags: [generated]
+---*/
+
+
+class Subclass extends Uint8ClampedArray {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof Uint8ClampedArray);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakMap.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakMap.js
new file mode 100644
index 0000000000..3e6b8ccf31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakMap.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/WeakMap.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubWeakMap() instanceof WeakMap (Subclass instanceof Heritage)
+features: [WeakMap]
+flags: [generated]
+---*/
+
+
+class Subclass extends WeakMap {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof WeakMap);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakRef.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakRef.js
new file mode 100644
index 0000000000..fd97648922
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakRef.js
@@ -0,0 +1,18 @@
+// |reftest| skip-if(!this.hasOwnProperty('WeakRef')) -- WeakRef is not enabled unconditionally
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/WeakRef.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubWeakRef() instanceof WeakRef (Subclass instanceof Heritage)
+features: [WeakRef]
+flags: [generated]
+---*/
+
+
+class Subclass extends WeakRef {}
+
+const sub = new Subclass({});
+assert(sub instanceof Subclass);
+assert(sub instanceof WeakRef);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakSet.js b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakSet.js
new file mode 100644
index 0000000000..969c54ced4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass-builtins/subclass-WeakSet.js
@@ -0,0 +1,17 @@
+// This file was procedurally generated from the following sources:
+// - src/subclass-builtins/WeakSet.case
+// - src/subclass-builtins/default/statement.template
+/*---
+description: new SubWeakSet() instanceof WeakSet (Subclass instanceof Heritage)
+features: [WeakSet]
+flags: [generated]
+---*/
+
+
+class Subclass extends WeakSet {}
+
+const sub = new Subclass();
+assert(sub instanceof Subclass);
+assert(sub instanceof WeakSet);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/binding.js b/js/src/tests/test262/language/statements/class/subclass/binding.js
new file mode 100644
index 0000000000..cd22c23d35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/binding.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class subclass binding
+---*/
+class Base {
+ constructor(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+}
+
+var obj = {};
+class Subclass extends Base {
+ constructor(x, y) {
+ super(x,y);
+ assert.sameValue(this !== obj, true, "The result of `this !== obj` is `true`");
+ }
+}
+
+var f = Subclass.bind(obj);
+assert.throws(TypeError, function () { f(1, 2); });
+var s = new f(1, 2);
+assert.sameValue(s.x, 1, "The value of `s.x` is `1`");
+assert.sameValue(s.y, 2, "The value of `s.y` is `2`");
+assert.sameValue(
+ Object.getPrototypeOf(s),
+ Subclass.prototype,
+ "`Object.getPrototypeOf(s)` returns `Subclass.prototype`"
+);
+
+var s1 = new f(1);
+assert.sameValue(s1.x, 1, "The value of `s1.x` is `1`");
+assert.sameValue(s1.y, undefined, "The value of `s1.y` is `undefined`");
+assert.sameValue(
+ Object.getPrototypeOf(s1),
+ Subclass.prototype,
+ "`Object.getPrototypeOf(s1)` returns `Subclass.prototype`"
+);
+
+var g = Subclass.bind(obj, 1);
+assert.throws(TypeError, function () { g(8); });
+var s2 = new g(8);
+assert.sameValue(s2.x, 1, "The value of `s2.x` is `1`");
+assert.sameValue(s2.y, 8, "The value of `s2.y` is `8`");
+assert.sameValue(
+ Object.getPrototypeOf(s),
+ Subclass.prototype,
+ "`Object.getPrototypeOf(s)` returns `Subclass.prototype`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/browser.js b/js/src/tests/test262/language/statements/class/subclass/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js
new file mode 100644
index 0000000000..e1d285b914
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.1.1
+description: >
+ Constructor calling super() with 2+ arguments creates an Array object
+info: |
+ 22.1.1 The Array Constructor
+
+ The Array constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the exotic Array behaviour must include a super call to the
+ Array constructor to initialize subclass instances that are exotic Array
+ objects.
+includes: [compareArray.js]
+---*/
+
+class Sub extends Array {
+ constructor(a, b) {
+ super(a, b);
+ }
+}
+
+var sub = new Sub(42, 'foo');
+
+assert.compareArray(sub, [42, 'foo']);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-single-argument.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-single-argument.js
new file mode 100644
index 0000000000..9311d7f278
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-single-argument.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.1.1
+description: >
+ Constructor calling super() with a single argument creates an Array object
+info: |
+ 22.1.1 The Array Constructor
+
+ The Array constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the exotic Array behaviour must include a super call to the
+ Array constructor to initialize subclass instances that are exotic Array
+ objects.
+---*/
+
+class Sub extends Array {
+ constructor(a) {
+ super(a);
+ }
+}
+
+var sub = new Sub(42);
+
+assert.sameValue(sub.length, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js
new file mode 100644
index 0000000000..e19bc322a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.1.4.1
+description: >
+ Instances has the own property length
+info: |
+ 22.1.4.1 length
+
+ The length property of an Array instance is a data property whose value is
+ always numerically greater than the name of every configurable own property
+ whose name is an array index.
+
+ The length property initially has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: false }.
+---*/
+
+class Ar extends Array {}
+
+var arr = new Ar('foo', 'bar');
+
+assert.sameValue(arr[0], 'foo');
+assert.sameValue(arr[1], 'bar');
+
+var arrDesc = Object.getOwnPropertyDescriptor(arr, 'length');
+
+assert.sameValue(arrDesc.writable, true);
+assert.sameValue(arrDesc.enumerable, false);
+assert.sameValue(arrDesc.configurable, false);
+
+assert.sameValue(arr[1], 'bar');
+
+arr.length = 1;
+
+assert.sameValue(arr[0], 'foo');
+assert.sameValue(arr[1], undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js
new file mode 100644
index 0000000000..3b5df29719
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.1.1
+description: Subclassing Array
+info: |
+ 22.1.1 The Array Constructor
+
+ The Array constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. (...)
+includes: [compareArray.js]
+---*/
+
+class Sub extends Array {}
+
+var a1 = new Sub(42, 'foo');
+
+assert.sameValue(a1.length, 2);
+assert.sameValue(a1[0], 42);
+assert.sameValue(a1[1], 'foo');
+
+a1.push(true);
+assert.sameValue(a1.length, 3, 'Array#push updates the length property');
+assert.sameValue(a1[0], 42);
+assert.sameValue(a1[1], 'foo');
+assert.sameValue(a1[2], true, 'Adds new item');
+
+var a2 = new Sub(7);
+assert.sameValue(a2.length, 7);
+
+var a3 = new Sub();
+assert.compareArray(a3, []);
+assert.sameValue(a3.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/super-must-be-called.js
new file mode 100644
index 0000000000..134c3a7702
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/super-must-be-called.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.1.1
+description: Super need to be called to initialize internals
+info: |
+ 22.1.1 The Array Constructor
+
+ ...
+
+ The Array constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the exotic Array behaviour must include a super call to the
+ Array constructor to initialize subclass instances that are exotic Array
+ objects.
+---*/
+
+class A extends Array {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new A();
+});
+
+class A2 extends Array {
+ constructor() {
+ super();
+ }
+}
+
+new A2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing.js
new file mode 100644
index 0000000000..d2b319173a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 24.1.2
+description: Subclassing the ArrayBuffer object
+info: |
+ 24.1.2 The ArrayBuffer Constructor
+
+ ...
+
+ The ArrayBuffer constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified ArrayBuffer behaviour must include a
+ super call to the ArrayBuffer constructor to create and initialize subclass
+ instances with the internal state necessary to support the
+ ArrayBuffer.prototype built-in methods.
+---*/
+
+class AB extends ArrayBuffer {}
+
+var ab = new AB(4);
+
+var sliced = ab.slice(0, 1);
+
+assert(sliced instanceof AB);
+assert(sliced instanceof ArrayBuffer);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/super-must-be-called.js
new file mode 100644
index 0000000000..232c344cee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/ArrayBuffer/super-must-be-called.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 24.1.2
+description: Super need to be called to initialize internals
+info: |
+ 24.1.2 The ArrayBuffer Constructor
+
+ ...
+
+ The ArrayBuffer constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified ArrayBuffer behaviour must include a
+ super call to the ArrayBuffer constructor to create and initialize subclass
+ instances with the internal state necessary to support the
+ ArrayBuffer.prototype built-in methods.
+---*/
+
+class AB1 extends ArrayBuffer {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new AB1(1);
+});
+
+class AB2 extends ArrayBuffer {
+ constructor(length) {
+ super(length);
+ }
+}
+
+new AB2(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/regular-subclassing.js
new file mode 100644
index 0000000000..e296c1d4e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/regular-subclassing.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.3.1
+description: Subclassing Function
+info: |
+ 19.3.1 The Boolean Constructor
+
+ The Boolean constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition.
+ ...
+---*/
+
+class Bln extends Boolean {}
+
+var b1 = new Bln(1);
+
+assert.notSameValue(b1, true, 'b1 is an Boolean object');
+assert.sameValue(b1.valueOf(), true);
+
+var b2 = new Bln(0);
+assert.notSameValue(b2, false, 'bln is an Boolean object');
+assert.sameValue(b2.valueOf(), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/super-must-be-called.js
new file mode 100644
index 0000000000..fde940702f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Boolean/super-must-be-called.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.3.1
+description: Super need to be called to initialize Boolean internals
+info: |
+ 19.3.1 The Boolean Constructor
+
+ ...
+ Subclass constructors that intend to inherit the specified Boolean behaviour
+ must include a super call to the Boolean constructor to create and initialize
+ the subclass instance with a [[BooleanData]] internal slot.
+---*/
+
+class Bln extends Boolean {
+ constructor() {}
+}
+
+// Boolean internals are not initialized
+assert.throws(ReferenceError, function() {
+ new Bln(1);
+});
+
+class Bln2 extends Boolean {
+ constructor() {
+ super();
+ }
+}
+
+var b = new Bln2(1);
+assert(b instanceof Boolean);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/regular-subclassing.js
new file mode 100644
index 0000000000..fe91d32a2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/regular-subclassing.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 24.2.2
+description: Subclassing the DataView object
+info: |
+ 24.2.2 The DataView Constructor
+
+ ...
+
+ The DataView constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified DataView behaviour must include a super call
+ to the DataView constructor to create and initialize subclass instances with
+ the internal state necessary to support the DataView.prototype built-in
+ methods.
+---*/
+
+class DV extends DataView {}
+
+var buffer = new ArrayBuffer(1);
+
+var dv = new DV(buffer);
+assert.sameValue(dv.buffer, buffer);
+
+assert.throws(TypeError, function() {
+ new DV();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/super-must-be-called.js
new file mode 100644
index 0000000000..9693b9a205
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/DataView/super-must-be-called.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 24.2.2
+description: Super need to be called to initialize internals
+info: |
+ 24.2.2 The DataView Constructor
+
+ ...
+
+ The DataView constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified DataView behaviour must include a super call
+ to the DataView constructor to create and initialize subclass instances with
+ the internal state necessary to support the DataView.prototype built-in
+ methods.
+---*/
+
+class DV1 extends DataView {
+ constructor() {}
+}
+
+var buffer = new ArrayBuffer(1);
+
+assert.throws(ReferenceError, function() {
+ new DV1(buffer);
+});
+
+class DV2 extends DataView {
+ constructor(length) {
+ super(length);
+ }
+}
+
+new DV2(buffer);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/regular-subclassing.js
new file mode 100644
index 0000000000..41619f26b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/regular-subclassing.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 20.3.2
+description: Subclassing the String object
+info: |
+ 20.3.2 The Date Constructor
+
+ ...
+
+ The Date constructor is a single function whose behaviour is overloaded based
+ upon the number and types of its arguments.
+
+ The Date constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Date behaviour must include a super call to
+ the Date constructor to create and initialize the subclass instance with a
+ [[DateValue]] internal slot.
+---*/
+
+class D extends Date {}
+
+var d1 = new D(1859, '10', 24, 11);
+assert.sameValue(d1.getFullYear(), 1859);
+assert.sameValue(d1.getMonth(), 10);
+assert.sameValue(d1.getDate(), 24);
+
+var d2 = new D(-3474558000000);
+assert.sameValue(d2.getUTCFullYear(), 1859);
+assert.sameValue(d2.getUTCMonth(), 10);
+assert.sameValue(d2.getUTCDate(), 24);
+
+var d3 = new D();
+var d4 = new Date();
+assert.sameValue(d3.getFullYear(), d4.getFullYear());
+assert.sameValue(d3.getMonth(), d4.getMonth());
+assert.sameValue(d3.getDate(), d4.getDate());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/super-must-be-called.js
new file mode 100644
index 0000000000..8099ac871f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Date/super-must-be-called.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 20.3.2
+description: Super need to be called to initialize internals
+info: |
+ 20.3.2 The Date Constructor
+
+ ...
+
+ The Date constructor is a single function whose behaviour is overloaded based
+ upon the number and types of its arguments.
+
+ The Date constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Date behaviour must include a super call to
+ the Date constructor to create and initialize the subclass instance with a
+ [[DateValue]] internal slot.
+---*/
+
+class D extends Date {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new D();
+});
+
+class D2 extends Date {
+ constructor() {
+ super();
+ }
+}
+
+new D2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/message-property-assignment.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/message-property-assignment.js
new file mode 100644
index 0000000000..afa9b7e924
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/message-property-assignment.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.1.1 Error ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. ReturnIfAbrupt(msg).
+ c. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ d. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends Error {}
+
+Err.prototype.message = 'custom-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/regular-subclassing.js
new file mode 100644
index 0000000000..d34c85cb3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/regular-subclassing.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.1
+description: Subclassing the Error object
+info: |
+ 19.5.1 The Error Constructor
+
+ ...
+ The Error constructor is designed to be subclassable. It may be used as the
+ alue of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Error behaviour must include a super call to
+ the Error constructor to create and initialize subclass instances with a
+ [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends Error {}
+
+var err = new CustomError('foo 42');
+
+assert.sameValue(err.message, 'foo 42');
+assert.sameValue(err.name, 'Error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/super-must-be-called.js
new file mode 100644
index 0000000000..8d7dcae53e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Error/super-must-be-called.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.1 The Error Constructor
+
+ ...
+ The Error constructor is designed to be subclassable. It may be used as the
+ alue of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Error behaviour must include a super call to
+ the Error constructor to create and initialize subclass instances with a
+ [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends Error {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError('foo');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-length.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-length.js
new file mode 100644
index 0000000000..d14cd344d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-length.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.2.4.1
+description: Subclassed Function instances has length and name properties
+info: |
+ 19.2.4.1 length
+
+ The value of the length property is an integer that indicates the typical
+ number of arguments expected by the function. However, the language permits
+ the function to be invoked with some other number of arguments. The behaviour
+ of a function when invoked on a number of arguments other than the number
+ specified by its length property depends on the function. This property has
+ the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+class Fn extends Function {}
+
+var fn = new Fn('a', 'b', 'return a + b');
+
+assert.sameValue(fn.length, 2);
+
+verifyNotEnumerable(fn, 'length');
+verifyNotWritable(fn, 'length');
+verifyConfigurable(fn, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-name.js
new file mode 100644
index 0000000000..6648909da4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/instance-name.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.2.4.2
+description: Subclassed Function instances has length and name properties
+info: |
+ 19.2.4.2 name
+
+ The value of the name property is an String that is descriptive of the
+ function. The name has no semantic significance but is typically a variable or
+ property name that is used to refer to the function at its point of definition
+ in ECMAScript code. This property has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+
+ Anonymous functions objects that do not have a contextual name associated with
+ them by this specification do not have a name own property but inherit the
+ name property of %FunctionPrototype%.
+
+ 19.2.1.1.1 RuntimeSemantics: CreateDynamicFunction(constructor, newTarget,
+ kind, args)
+
+ ...
+ 29. Perform SetFunctionName(F, "anonymous").
+ ...
+includes: [propertyHelper.js]
+---*/
+
+class Fn extends Function {}
+
+var fn = new Fn('a', 'b', 'return a + b');
+
+assert.sameValue(
+ fn.name, 'anonymous',
+ 'Dynamic Functions are called anonymous'
+);
+
+verifyNotEnumerable(fn, 'name');
+verifyNotWritable(fn, 'name');
+verifyConfigurable(fn, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/regular-subclassing.js
new file mode 100644
index 0000000000..d68fb28206
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/regular-subclassing.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.2.1
+description: Subclassing Function
+info: |
+ 19.2.1 The Function Constructor
+
+ ...
+
+ The Function constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition.
+ ...
+---*/
+
+class Fn extends Function {}
+
+var fn = new Fn('a', 'return a * 2');
+
+assert.sameValue(fn(42), 84);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/super-must-be-called.js
new file mode 100644
index 0000000000..9d8fc30c0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Function/super-must-be-called.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.2.1
+description: >
+ super must be called to initialize Function internal slots
+info: |
+ 19.2.1 The Function Constructor
+
+ ...
+
+ The Function constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Function behaviour must include a super call
+ to the Function constructor to create and initialize a subclass instances with
+ the internal slots necessary for built-in function behaviour.
+ ...
+---*/
+
+class Fn extends Function {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new Fn();
+});
+
+class Fn2 extends Function {
+ constructor() {
+ super();
+ }
+}
+
+var fn = new Fn2();
+assert(fn instanceof Function);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-length.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-length.js
new file mode 100644
index 0000000000..f5d17fe131
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-length.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.4.1
+description: >
+ Subclassed GeneratorFunction instances `length` property
+info: |
+ 25.2.4.1 length
+
+ The value of the length property is an integer that indicates the typical
+ number of arguments expected by the GeneratorFunction. However, the language
+ permits the function to be invoked with some other number of arguments. The
+ behaviour of a GeneratorFunction when invoked on a number of arguments other
+ than the number specified by its length property depends on the function.
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class GFn extends GeneratorFunction {}
+
+var gfn = new GFn('a', 'b', 'return a + b');
+
+assert.sameValue(gfn.length, 2);
+
+verifyNotEnumerable(gfn, 'length');
+verifyNotWritable(gfn, 'length');
+verifyConfigurable(gfn, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-name.js
new file mode 100644
index 0000000000..69be80c2e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-name.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.4.2
+description: Subclassed GeneratorFunction instances `name` property
+info: |
+ 25.2.4.2 name
+
+ The specification for the name property of Function instances given in
+ 19.2.4.2 also applies to GeneratorFunction instances.
+
+ 19.2.4.2 name
+
+ The value of the name property is an String that is descriptive of the
+ function. The name has no semantic significance but is typically a variable or
+ property name that is used to refer to the function at its point of definition
+ in ECMAScript code. This property has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+
+ Anonymous functions objects that do not have a contextual name associated with
+ them by this specification do not have a name own property but inherit the
+ name property of %FunctionPrototype%.
+
+ 19.2.1.1.1 RuntimeSemantics: CreateDynamicFunction(constructor, newTarget,
+ kind, args)
+
+ ...
+ 29. Perform SetFunctionName(F, "anonymous").
+ ...
+includes: [propertyHelper.js]
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class GFn extends GeneratorFunction {}
+
+var gfn = new GFn('a', 'b', 'return a + b');
+
+assert.sameValue(
+ gfn.name, 'anonymous',
+ 'Dynamic Functions are called anonymous'
+);
+
+verifyNotEnumerable(gfn, 'name');
+verifyNotWritable(gfn, 'name');
+verifyConfigurable(gfn, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-prototype.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-prototype.js
new file mode 100644
index 0000000000..3b4029adcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/instance-prototype.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.4.3
+description: >
+ Subclassed GeneratorFunction instances `prototype` property
+info: |
+ 25.2.4.3 prototype
+
+ Whenever a GeneratorFunction instance is created another ordinary object is
+ also created and is the initial value of the generator function’s prototype
+ property. The value of the prototype property is used to initialize the
+ [[Prototype]] internal slot of a newly created Generator object when the
+ generator function object is invoked using either [[Call]] or [[Construct]].
+
+ This property has the attributes { [[Writable]]: true, [[Enumerable]]: false,
+ [[Configurable]]: false }.
+includes: [propertyHelper.js]
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class GFn extends GeneratorFunction {}
+
+var gfn = new GFn(';');
+
+assert.sameValue(
+ Object.keys(gfn.prototype).length, 0,
+ 'prototype is a new ordinary object'
+);
+assert.sameValue(
+ gfn.prototype.hasOwnProperty('constructor'), false,
+ 'prototype has no constructor reference'
+);
+
+verifyNotEnumerable(gfn, 'prototype');
+verifyWritable(gfn, 'prototype');
+verifyNotConfigurable(gfn, 'prototype');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/regular-subclassing.js
new file mode 100644
index 0000000000..55a8c2ded5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/regular-subclassing.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.1
+description: Subclassing GeneratorFunction
+info: |
+ 25.2.1 The GeneratorFunction Constructor
+
+ ...
+
+ GeneratorFunction is designed to be subclassable. It may be used as the value
+ of an extends clause of a class definition. Subclass constructors that intend
+ to inherit the specified GeneratorFunction behaviour must include a super call
+ to the GeneratorFunction constructor to create and initialize subclass
+ instances with the internal slots necessary for built-in GeneratorFunction
+ behaviour.
+ ...
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class Gfn extends GeneratorFunction {}
+
+var gfn = new Gfn('a', 'yield a; yield a * 2;');
+
+var iter = gfn(42);
+
+assert.sameValue(iter.next().value, 42);
+assert.sameValue(iter.next().value, 84);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.js
new file mode 100644
index 0000000000..6d3aa6004d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.1
+description: >
+ super must be called to initialize GeneratorFunction internal slots
+info: |
+ 25.2.1 The GeneratorFunction Constructor
+
+ ...
+
+ GeneratorFunction is designed to be subclassable. It may be used as the value
+ of an extends clause of a class definition. Subclass constructors that intend
+ to inherit the specified GeneratorFunction behaviour must include a super call
+ to the GeneratorFunction constructor to create and initialize subclass
+ instances with the internal slots necessary for built-in GeneratorFunction
+ behaviour.
+ ...
+---*/
+
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+class GFn1 extends GeneratorFunction {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new GFn1();
+});
+
+class GFn2 extends GeneratorFunction {
+ constructor() {
+ super();
+ }
+}
+
+var fn = new GFn2();
+assert(fn instanceof GeneratorFunction);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js
new file mode 100644
index 0000000000..755b2b1faa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1
+description: Subclassing the Map object
+info: |
+ 23.1.1 The Map Constructor
+
+ ...
+
+ The Map constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Map behaviour must include a super call to the
+ Map constructor to create and initialize the subclass instance with the
+ internal state necessary to support the Map.prototype built-in methods.
+---*/
+
+class M extends Map {}
+
+var map = new M([{ 'foo': 'bar' }]);
+
+assert.sameValue(map.size, 1);
+
+map.set('bar', 'baz');
+
+assert.sameValue(map.size, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/super-must-be-called.js
new file mode 100644
index 0000000000..23d3e8dbf8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Map/super-must-be-called.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.1.1
+description: Super need to be called to initialize internals
+info: |
+ 23.1.1 The Map Constructor
+
+ ...
+
+ The Map constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Map behaviour must include a super call to the
+ Map constructor to create and initialize the subclass instance with the
+ internal state necessary to support the Map.prototype built-in methods.
+---*/
+
+class M1 extends Map {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new M1();
+});
+
+class M2 extends Map {
+ constructor() {
+ super();
+ }
+}
+
+new M2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-message.js
new file mode 100644
index 0000000000..6d911069bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends EvalError {}
+
+Err.prototype.message = 'custom-eval-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-eval-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-name.js
new file mode 100644
index 0000000000..9f4c87eeb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends EvalError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'EvalError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-super.js
new file mode 100644
index 0000000000..3e7055bcc0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/EvalError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends EvalError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-message.js
new file mode 100644
index 0000000000..28931bfcd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends RangeError {}
+
+Err.prototype.message = 'custom-range-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-range-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-name.js
new file mode 100644
index 0000000000..49a05b2ab0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends RangeError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'RangeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-super.js
new file mode 100644
index 0000000000..af5a17d16e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/RangeError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends RangeError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-message.js
new file mode 100644
index 0000000000..cb5626c984
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends ReferenceError {}
+
+Err.prototype.message = 'custom-reference-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-reference-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-name.js
new file mode 100644
index 0000000000..8898f2e7b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends ReferenceError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'ReferenceError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-super.js
new file mode 100644
index 0000000000..b8517e4e25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/ReferenceError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends ReferenceError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-message.js
new file mode 100644
index 0000000000..c5460959d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends SyntaxError {}
+
+Err.prototype.message = 'custom-syntax-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-syntax-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-name.js
new file mode 100644
index 0000000000..19719c503c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends SyntaxError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'SyntaxError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-super.js
new file mode 100644
index 0000000000..00c4865cab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/SyntaxError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends SyntaxError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-message.js
new file mode 100644
index 0000000000..855e3ad1a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends TypeError {}
+
+Err.prototype.message = 'custom-type-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-type-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-name.js
new file mode 100644
index 0000000000..ca1cb0995a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends TypeError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-super.js
new file mode 100644
index 0000000000..80fcbf935a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/TypeError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends TypeError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-message.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-message.js
new file mode 100644
index 0000000000..1131b75185
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-message.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ A new instance has the message property if created with a parameter
+info: |
+ 19.5.6.1.1 NativeError ( message )
+
+ ...
+ 4. If message is not undefined, then
+ a. Let msg be ToString(message).
+ b. Let msgDesc be the PropertyDescriptor{[[Value]]: msg, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true}.
+ c. Let status be DefinePropertyOrThrow(O, "message", msgDesc).
+ ...
+includes: [propertyHelper.js]
+
+---*/
+
+class Err extends URIError {}
+
+Err.prototype.message = 'custom-uri-error';
+
+var err1 = new Err('foo 42');
+assert.sameValue(err1.message, 'foo 42');
+assert(err1.hasOwnProperty('message'));
+
+verifyWritable(err1, 'message');
+verifyNotEnumerable(err1, 'message');
+verifyConfigurable(err1, 'message');
+
+var err2 = new Err();
+assert.sameValue(err2.hasOwnProperty('message'), false);
+assert.sameValue(err2.message, 'custom-uri-error');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-name.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-name.js
new file mode 100644
index 0000000000..83d8d8f5e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-name.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1.1
+description: >
+ The name property on a new instance
+info: |
+ 19.5.6.3.3 NativeError.prototype.name
+
+ The initial value of the name property of the prototype for a given
+ NativeError constructor is a string consisting of the name of the constructor
+ (the name used instead of NativeError).
+---*/
+
+class Err extends URIError {}
+
+var err1 = new Err();
+assert.sameValue(err1.name, 'URIError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-super.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-super.js
new file mode 100644
index 0000000000..3714a11749
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/URIError-super.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.5.6.1
+description: Super need to be called to initialize internals
+info: |
+ 19.5.6.1 NativeError Constructors
+
+ ...
+ Each NativeError constructor is designed to be subclassable. It may be used as
+ the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified NativeError behaviour must include a
+ super call to the NativeError constructor to create and initialize subclass
+ instances with a [[ErrorData]] internal slot.
+---*/
+
+class CustomError extends URIError {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new CustomError();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/NativeError/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/regular-subclassing.js
new file mode 100644
index 0000000000..f5764f046f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/regular-subclassing.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 20.1.1
+description: Subclassing the Number object
+info: |
+ 20.1.1 The Number Constructor
+
+ ...
+
+ The Number constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Number behaviour must include a super call to
+ the Number constructor to create and initialize the subclass instance with a
+ [[NumberData]] internal slot.
+---*/
+
+class N extends Number {}
+
+var n = new N(42);
+
+assert.sameValue(n.toFixed(2), '42.00');
+assert.sameValue(n.toExponential(2), '4.20e+1');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/super-must-be-called.js
new file mode 100644
index 0000000000..fb37ca829c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Number/super-must-be-called.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 20.1.1
+description: Super need to be called to initialize internals
+info: |
+ 20.1.1 The Number Constructor
+
+ ...
+
+ The Number constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Number behaviour must include a super call to
+ the Number constructor to create and initialize the subclass instance with a
+ [[NumberData]] internal slot.
+---*/
+
+class N extends Number {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new N();
+});
+
+class N2 extends Number {
+ constructor() {
+ super();
+ }
+}
+
+new N2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-return-undefined-throws.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-return-undefined-throws.js
new file mode 100644
index 0000000000..ddf4ec4795
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-return-undefined-throws.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: Throws a ReferenceError if constructor result is undefined
+info: |
+ 9.2.2 [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ ...
+ 13. If result.[[type]] is return, then
+ a. If Type(result.[[value]]) is Object, return
+ NormalCompletion(result.[[value]]).
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+ 15. Return envRec.GetThisBinding().
+
+ 8.1.1.3.4 GetThisBinding ()
+
+ ...
+ 3. If envRec.[[thisBindingStatus]] is "uninitialized", throw a ReferenceError
+ exception.
+ ...
+
+---*/
+
+class Obj extends Object {
+ constructor() {
+ return undefined;
+ }
+}
+
+class Obj2 extends Object {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new Obj();
+});
+
+assert.throws(ReferenceError, function() {
+ new Obj2();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js
new file mode 100644
index 0000000000..6f266cc1e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/constructor-returns-non-object.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: The Type of the return value must be an Object
+info: |
+ 9.2.2 [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ ...
+ 13. If result.[[type]] is return, then
+ a. If Type(result.[[value]]) is Object, return
+ NormalCompletion(result.[[value]]).
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ 6.1.7.2 Object Internal Methods and Internal Slots
+
+ ...
+ If any specified use of an internal method of an exotic object is not
+ supported by an implementation, that usage must throw a TypeError exception
+ when attempted.
+
+ 6.1.7.3 Invariants of the Essential Internal Methods
+
+ [[Construct]] ( )
+ - The Type of the return value must be Object.
+---*/
+
+class Obj extends Object {
+ constructor() {
+ return 42;
+ }
+}
+
+assert.throws(TypeError, function() {
+ var obj = new Obj();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/regular-subclassing.js
new file mode 100644
index 0000000000..59b6afd6a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/regular-subclassing.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.1.1
+description: Subclassing Object
+info: |
+ 19.1.1 The Object Constructor
+
+ The Object constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition.
+---*/
+
+class Obj extends Object {}
+
+var obj = new Obj();
+
+assert.notSameValue(
+ Object.getPrototypeOf(obj), Object.prototype,
+ 'returns the class prototype'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/replacing-prototype.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/replacing-prototype.js
new file mode 100644
index 0000000000..dd6e7d5635
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/replacing-prototype.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.1.1
+description: Subclassing Object replacing a prototype method
+info: |
+ 19.1.1 The Object Constructor
+
+ The Object constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition.
+---*/
+
+class Obj extends Object {
+ valueOf() {
+ return 42;
+ }
+}
+
+var obj = new Obj();
+
+assert.sameValue(obj.valueOf(), 42, 'Replaces prototype');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/regular-subclassing.js
new file mode 100644
index 0000000000..397e452cf0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/regular-subclassing.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.4.3
+description: Subclassing the Promise object
+info: |
+ 25.4.3 The Promise Constructor
+
+ ...
+
+ The Promise constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Promise behaviour must include a super call
+ to the Promise constructor to create and initialize the subclass instance with
+ the internal state necessary to support the Promise and Promise.prototype
+ built-in methods.
+---*/
+
+class Prom extends Promise {}
+
+assert.throws(TypeError, function() {
+ new Prom();
+});
+
+var calledExecutor = false;
+var executorArguments;
+
+var prom1 = new Prom(function() {
+ calledExecutor = true;
+ executorArguments = arguments;
+});
+
+assert(calledExecutor);
+assert.sameValue(executorArguments.length, 2);
+assert.sameValue(typeof executorArguments[0], "function");
+assert.sameValue(typeof executorArguments[1], "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/super-must-be-called.js
new file mode 100644
index 0000000000..8ed2fb3f63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Promise/super-must-be-called.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.4.3
+description: Super need to be called to initialize internals
+info: |
+ 25.4.3 The Promise Constructor
+
+ ...
+
+ The Promise constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Promise behaviour must include a super call
+ to the Promise constructor to create and initialize the subclass instance with
+ the internal state necessary to support the Promise and Promise.prototype
+ built-in methods.
+---*/
+
+class Prom1 extends Promise {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new Prom1();
+});
+
+class Prom2 extends Promise {
+ constructor(exec) {
+ super(exec);
+ }
+}
+
+new Prom2(function() {});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/no-prototype-throws.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/no-prototype-throws.js
new file mode 100644
index 0000000000..c61848395c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/no-prototype-throws.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.14
+description: The Proxy Object is not subclasseable without a prototype
+info: |
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 5. If ClassHeritageopt is not present, then
+ ...
+ 6. Else
+ ...
+ e. If superclass is null, then
+ ...
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+ g. Else
+ ...
+ ii. Let protoParent be Get(superclass, "prototype").
+ iii. ReturnIfAbrupt(protoParent).
+ iv. If Type(protoParent) is neither Object nor Null, throw a TypeError exception.
+
+ 26.2.1 The Proxy Constructor
+
+ The Proxy constructor is the %Proxy% intrinsic object and the initial value of
+ the Proxy property of the global object. When called as a constructor it
+ creates and initializes a new proxy exotic object. Proxy is not intended to be
+ called as a function and will throw an exception when called in that manner.
+---*/
+
+assert.throws(TypeError, function() {
+ class P extends Proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Proxy/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/lastIndex.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/lastIndex.js
new file mode 100644
index 0000000000..bf0726227b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/lastIndex.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.2.6.1
+description: Instances has the own property lastIndex
+info: |
+ 21.2.6.1 lastIndex
+
+ The value of the lastIndex property specifies the String index at which to
+ start the next match. It is coerced to an integer when used (see 21.2.5.2.2).
+ This property shall have the attributes { [[Writable]]: true, [[Enumerable]]:
+ false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+---*/
+
+class RE extends RegExp {}
+
+var re = new RE('39?');
+
+re.exec('TC39');
+
+assert.sameValue(re.lastIndex, 0);
+
+verifyWritable(re, 'lastIndex');
+verifyNotEnumerable(re, 'lastIndex');
+verifyNotConfigurable(re, 'lastIndex');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/regular-subclassing.js
new file mode 100644
index 0000000000..3dab8a3ee6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/regular-subclassing.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.2.3
+description: Subclassing the RegExp object
+info: |
+ 21.2.3 The RegExp Constructor
+
+ ...
+
+ The RegExp constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified RegExp behaviour must include a super call to
+ the RegExp constructor to create and initialize subclass instances with the
+ necessary internal slots.
+---*/
+
+class RE extends RegExp {}
+
+var re = new RE(39);
+
+assert.sameValue(re.test('TC39'), true);
+assert.sameValue(re.test('42'), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/super-must-be-called.js
new file mode 100644
index 0000000000..8d617a15ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/RegExp/super-must-be-called.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.2.3
+description: Super need to be called to initialize internals
+info: |
+ 21.2.3 The RegExp Constructor
+
+ ...
+
+ The RegExp constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified RegExp behaviour must include a super call to
+ the RegExp constructor to create and initialize subclass instances with the
+ necessary internal slots.
+---*/
+
+class RE1 extends RegExp {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new RE1();
+});
+
+class RE2 extends RegExp {
+ constructor() {
+ super();
+ }
+}
+
+new RE2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/regular-subclassing.js
new file mode 100644
index 0000000000..43a92d8a69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/regular-subclassing.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.2.1
+description: Subclassing the Set object
+info: |
+ 23.2.1 The Set Constructor
+
+ ...
+
+ The Set constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Set behaviour must include a super call to the
+ Set constructor to create and initialize the subclass instance with the
+ internal state necessary to support the Set.prototype built-in methods.
+---*/
+
+class S extends Set {}
+
+var set = new S([{}, {}]);
+
+assert.sameValue(set.size, 2);
+
+set.add({});
+
+assert.sameValue(set.size, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/super-must-be-called.js
new file mode 100644
index 0000000000..1b5e23cd08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Set/super-must-be-called.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.2.1
+description: Super need to be called to initialize internals
+info: |
+ 23.2.1 The Set Constructor
+
+ ...
+
+ The Set constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified Set behaviour must include a super call to the
+ Set constructor to create and initialize the subclass instance with the
+ internal state necessary to support the Set.prototype built-in methods.
+---*/
+
+class S1 extends Set {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new S1();
+});
+
+class S2 extends Set {
+ constructor() {
+ super();
+ }
+}
+
+new S2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/length.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/length.js
new file mode 100644
index 0000000000..0d1f33ef7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/length.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.1.4
+description: Instances has the own property length
+info: |
+ 21.1.4 Properties of String Instances
+
+ ...
+
+ String instances have a length property, and a set of enumerable properties
+ with integer indexed names.
+includes: [propertyHelper.js]
+---*/
+
+class S extends String {}
+
+var s1 = new S();
+assert.sameValue(s1.length, 0);
+
+verifyNotWritable(s1, 'length');
+verifyNotEnumerable(s1, 'length');
+verifyNotConfigurable(s1, 'length');
+
+var s2 = new S('test262');
+assert.sameValue(s2.length, 7);
+
+verifyNotWritable(s2, 'length');
+verifyNotEnumerable(s2, 'length');
+verifyNotConfigurable(s2, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/regular-subclassing.js
new file mode 100644
index 0000000000..b5c2ac34be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/regular-subclassing.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.1.1
+description: Subclassing the String object
+info: |
+ 21.1.1 The String Constructor
+
+ ...
+ The String constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified String behaviour must include a super call to
+ the String constructor to create and initialize the subclass instance with a
+ [[StringData]] internal slot.
+---*/
+
+class S extends String {}
+
+var s = new S(' test262 ');
+
+assert.sameValue(s.trim(), 'test262');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/super-must-be-called.js
new file mode 100644
index 0000000000..0c247e62db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/super-must-be-called.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.1.1
+description: Super need to be called to initialize internals
+info: |
+ 21.1.1 The String Constructor
+
+ ...
+ The String constructor is designed to be subclassable. It may be used as the
+ value of an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified String behaviour must include a super call to
+ the String constructor to create and initialize the subclass instance with a
+ [[StringData]] internal slot.
+---*/
+
+class S1 extends String {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new S1();
+});
+
+class S2 extends String {
+ constructor() {
+ super();
+ }
+}
+
+new S2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/new-symbol-with-super-throws.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/new-symbol-with-super-throws.js
new file mode 100644
index 0000000000..70cdae8717
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/new-symbol-with-super-throws.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.4.1
+description: Symbol subclass called with the new operator throws on super()
+info: |
+ 19.4.1 The Symbol Constructor
+
+ ...
+ The Symbol constructor is not intended to be used with the new operator or to
+ be subclassed. It may be used as the value of an extends clause of a class
+ definition but a super call to the Symbol constructor will cause an exception.
+
+ 19.4.1.1 Symbol ( [ description ] )
+
+ ...
+ 1. If NewTarget is not undefined, throw a TypeError exception.
+features: [Symbol]
+---*/
+
+class S1 extends Symbol {}
+
+assert.throws(TypeError, function() {
+ new S1();
+});
+
+class S2 extends Symbol {
+ constructor() {
+ super();
+ }
+}
+
+assert.throws(TypeError, function() {
+ new S2();
+});
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/symbol-valid-as-extends-value.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/symbol-valid-as-extends-value.js
new file mode 100644
index 0000000000..2ba5f953e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Symbol/symbol-valid-as-extends-value.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 19.4.1
+description: Symbol can be used as the value of an extends
+info: |
+ 19.4.1 The Symbol Constructor
+
+ ...
+ The Symbol constructor is not intended to be used with the new operator or to
+ be subclassed. It may be used as the value of an extends clause of a class
+ definition but a super call to the Symbol constructor will cause an exception.
+ ...
+features: [Symbol]
+---*/
+
+class S extends Symbol {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/regular-subclassing.js
new file mode 100644
index 0000000000..abc83cdf31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/regular-subclassing.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.2.4
+description: Subclassing TypedArrays
+info: |
+ 22.2.4 The TypedArray Constructors
+
+ ...
+
+ The TypedArray constructors are designed to be subclassable. They may be used
+ as the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified TypedArray behaviour must include a super
+ call to the TypedArray constructor to create and initialize the subclass
+ instance with the internal state necessary to support the
+ %TypedArray%.prototype built-in methods.
+---*/
+
+[
+ Int8Array,
+ Uint8Array,
+ Uint8ClampedArray,
+ Int16Array,
+ Uint16Array,
+ Int32Array,
+ Uint32Array,
+ Float32Array,
+ Float64Array
+].forEach(function(Constructor) {
+ class Typed extends Constructor {}
+
+ var arr = new Typed(2);
+
+ assert.sameValue(arr.length, 2);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/super-must-be-called.js
new file mode 100644
index 0000000000..5a8ae56122
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/TypedArray/super-must-be-called.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 22.2.4
+description: Super need to be called to initialize internals
+info: |
+ 22.2.4 The TypedArray Constructors
+
+ ...
+
+ The TypedArray constructors are designed to be subclassable. They may be used
+ as the value of an extends clause of a class definition. Subclass constructors
+ that intend to inherit the specified TypedArray behaviour must include a super
+ call to the TypedArray constructor to create and initialize the subclass
+ instance with the internal state necessary to support the
+ %TypedArray%.prototype built-in methods.
+---*/
+
+[
+ Int8Array,
+ Uint8Array,
+ Uint8ClampedArray,
+ Int16Array,
+ Uint16Array,
+ Int32Array,
+ Uint32Array,
+ Float32Array,
+ Float64Array
+].forEach(function(Constructor) {
+ class Typed extends Constructor {
+ constructor() {}
+ }
+
+ assert.throws(ReferenceError, function() {
+ new Typed();
+ });
+
+ class TypedWithSuper extends Constructor {
+ constructor() {
+ super();
+ }
+ }
+
+ new TypedWithSuper();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/regular-subclassing.js
new file mode 100644
index 0000000000..04e2258258
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/regular-subclassing.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.3.1
+description: Subclassing the WeakMap object
+info: |
+ 23.3.1 The WeakMap Constructor
+
+ ...
+
+ The WeakMap constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified WeakMap behaviour must include a super call to
+ the WeakMap constructor to create and initialize the subclass instance with
+ the internal state necessary to support the WeakMap.prototype built-in
+ methods.
+features: [WeakMap]
+---*/
+
+class WM extends WeakMap {}
+
+var map = new WM();
+var obj = {};
+
+assert.sameValue(map.has(obj), false);
+
+map.set(obj, 42);
+assert.sameValue(map.has(obj), true);
+assert.sameValue(map.get(obj), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/super-must-be-called.js
new file mode 100644
index 0000000000..ae4c4acf2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakMap/super-must-be-called.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.3.1
+description: Super need to be called to initialize internals
+info: |
+ 23.3.1 The WeakMap Constructor
+
+ ...
+
+ The WeakMap constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified WeakMap behaviour must include a super call to
+ the WeakMap constructor to create and initialize the subclass instance with
+ the internal state necessary to support the WeakMap.prototype built-in
+ methods.
+features: [WeakMap]
+---*/
+
+class M1 extends WeakMap {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new M1();
+});
+
+class M2 extends WeakMap {
+ constructor() {
+ super();
+ }
+}
+
+new M2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js
new file mode 100644
index 0000000000..9f8aa73318
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.4.1
+description: Subclassing the WeakSet object
+info: |
+ 23.4.1 The WeakSet Constructor
+
+ ...
+
+ The WeakSet constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified WeakSet behaviour must include a super call to
+ the WeakSet constructor to create and initialize the subclass instance with
+ the internal state necessary to support the WeakSet.prototype built-in
+ methods.
+features: [WeakSet]
+---*/
+
+class WS extends WeakSet {}
+
+var set = new WS();
+var obj = {};
+
+assert.sameValue(set.has(obj), false);
+
+set.add(obj);
+assert.sameValue(set.has(obj), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.js
new file mode 100644
index 0000000000..473bbf7c5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 23.4.1
+description: Super need to be called to initialize internals
+info: |
+ 23.4.1 The WeakSet Constructor
+
+ ...
+
+ The WeakSet constructor is designed to be subclassable. It may be used as the
+ value in an extends clause of a class definition. Subclass constructors that
+ intend to inherit the specified WeakSet behaviour must include a super call to
+ the WeakSet constructor to create and initialize the subclass instance with
+ the internal state necessary to support the WeakSet.prototype built-in
+ methods.
+features: [WeakSet]
+---*/
+
+class WS1 extends WeakSet {
+ constructor() {}
+}
+
+assert.throws(ReferenceError, function() {
+ new WS1();
+});
+
+class WS2 extends WeakSet {
+ constructor() {
+ super();
+ }
+}
+
+new WS2();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/browser.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/browser.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/shell.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtins.js b/js/src/tests/test262/language/statements/class/subclass/builtins.js
new file mode 100644
index 0000000000..dc95f7827a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/builtins.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class sublclassing builtins
+---*/
+class ExtendedUint8Array extends Uint8Array {
+ constructor() {
+ super(10);
+ this[0] = 255;
+ this[1] = 0xFFA;
+ }
+}
+
+var eua = new ExtendedUint8Array();
+assert.sameValue(eua.length, 10, "The value of `eua.length` is `10`");
+assert.sameValue(eua.byteLength, 10, "The value of `eua.byteLength` is `10`");
+assert.sameValue(eua[0], 0xFF, "The value of `eua[0]` is `0xFF`");
+assert.sameValue(eua[1], 0xFA, "The value of `eua[1]` is `0xFA`");
+assert.sameValue(
+ Object.getPrototypeOf(eua),
+ ExtendedUint8Array.prototype,
+ "`Object.getPrototypeOf(eua)` returns `ExtendedUint8Array.prototype`"
+);
+assert.sameValue(
+ Object.prototype.toString.call(eua),
+ "[object Uint8Array]",
+ "`Object.prototype.toString.call(eua)` returns `\"[object Uint8Array]\"`"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-evaluation-empty-constructor-heritage-present.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-evaluation-empty-constructor-heritage-present.js
new file mode 100644
index 0000000000..2039140be5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-evaluation-empty-constructor-heritage-present.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.14
+description: >
+ 10. If constructor is empty, then,
+ a. If ClassHeritageopt is present, then
+ i. Let constructor be the result of parsing the String "constructor(... args){ super (...args);}" using the syntactic grammar with the goal symbol MethodDefinition.
+---*/
+var args;
+
+class A {
+ constructor() {
+ args = arguments;
+ }
+}
+
+class B extends A {
+ /*
+ The missing constructor is created by the runtime:
+
+ constructor(...args) {
+ super(...args);
+ }
+
+ */
+}
+
+new B(0, 1, 2);
+
+
+assert.sameValue(args[0], 0);
+assert.sameValue(args[1], 1);
+assert.sameValue(args[2], 2);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-contains-return-override.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-contains-return-override.js
new file mode 100644
index 0000000000..5fc6aa0c29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-contains-return-override.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+es6id: 14.5.14
+description: >
+ The constructor of a null-extending class can contain an explicit return value.
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 15. If ClassHeritageopt is present, then set F's [[ConstructorKind]] internal slot to "derived".
+ [...]
+
+ 9.2.2 [[Construct]]
+
+ [...]
+ 13. If result.[[Type]] is return, then
+ a. If Type(result.[[Value]]) is Object, return NormalCompletion(result.[[Value]]).
+ [...]
+---*/
+var obj;
+
+class Foo extends null {
+ constructor() {
+ return obj = {};
+ }
+}
+
+var f = new Foo();
+
+assert.sameValue(f, obj);
+assert.sameValue(Object.getPrototypeOf(f), Object.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js
new file mode 100644
index 0000000000..efdb8d3299
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-missing-return-override.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ The `this` value of a null-extending class isn't automatically initialized,
+ which makes it necessary to have an explicit return value in the constructor.
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 5. If ClassHeritageopt is not present, then
+ [...]
+ 6. Else,
+ [...]
+ b. Let superclass be the result of evaluating ClassHeritage.
+ [...]
+ 15. If ClassHeritageopt is present, then set F's [[ConstructorKind]] internal slot to "derived".
+ [...]
+
+ 9.2.2 [[Construct]]
+
+ [...]
+ 15. Return ? envRec.GetThisBinding().
+
+ 8.1.1.3.4 GetThisBinding ( )
+ [...]
+ 3. If envRec.[[ThisBindingStatus]] is "uninitialized", throw a ReferenceError exception.
+ [...]
+---*/
+
+class Foo extends null {
+ constructor() {
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-super.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-super.js
new file mode 100644
index 0000000000..5270bb8c72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-super.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ Attempting to call `super()` in a null-extending class throws a TypeError,
+ because %FunctionPrototype% cannot be called as constructor function.
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 5. If ClassHeritageopt is not present, then
+ [...]
+ 6. Else,
+ [...]
+ b. Let superclass be the result of evaluating ClassHeritage.
+ [...]
+ e. If superclass is null, then
+ [...]
+ ii. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ [...]
+ 15. Let constructorInfo be the result of performing DefineMethod for constructor with arguments proto and constructorParent as the optional functionPrototype argument.
+ [...]
+
+ 12.3.5.1 Runtime Semantics: Evaluation
+
+ SuperCall : super Arguments
+
+ [...]
+ 3. Let func be ! GetSuperConstructor().
+ 4. Let argList be ? ArgumentListEvaluation of Arguments.
+ 5. If IsConstructor(func) is false, throw a TypeError exception.
+ [...]
+---*/
+
+var unreachable = 0;
+var reachable = 0;
+
+class C extends null {
+ constructor() {
+ reachable += 1;
+ super();
+ unreachable += 1;
+ }
+}
+
+assert.throws(TypeError, function() {
+ new C();
+});
+
+assert.sameValue(reachable, 1);
+assert.sameValue(unreachable, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-this.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-this.js
new file mode 100644
index 0000000000..e4d4b6a917
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto-this.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ The `this` value of a null-extending class isn't automatically initialized
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 15. If ClassHeritageopt is present, then set F's [[ConstructorKind]] internal slot to "derived".
+ [...]
+
+ 12.2.2.1 Runtime Semantics: Evaluation
+ PrimaryExpression : this
+ 1. Return ? ResolveThisBinding( ).
+
+ 8.3.4 ResolveThisBinding ( )
+ [...]
+ 2. Return ? envRec.GetThisBinding().
+
+ 8.1.1.3.4 GetThisBinding ( )
+ [...]
+ 3. If envRec.[[ThisBindingStatus]] is "uninitialized", throw a ReferenceError exception.
+ [...]
+---*/
+
+class C extends null {
+ constructor() {
+ // Use an arrow function to access the `this` binding of the class constructor.
+ assert.throws(ReferenceError, () => {
+ this;
+ });
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto.js
new file mode 100644
index 0000000000..da766ba6ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-null-proto.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+es6id: 14.5.14
+description: >
+ The prototype of a null-extending class is %FunctionPrototype%, the prototype of
+ its "prototype" property is `null`.
+info: |
+ Runtime Semantics: ClassDefinitionEvaluation
+
+ [...]
+ 5. If ClassHeritageopt is not present, then
+ [...]
+ 6. Else,
+ [...]
+ b. Let superclass be the result of evaluating ClassHeritage.
+ [...]
+ e. If superclass is null, then
+ i. Let protoParent be null.
+ ii. Let constructorParent be the intrinsic object %FunctionPrototype%.
+ [...]
+---*/
+
+class Foo extends null {}
+
+assert.sameValue(Object.getPrototypeOf(Foo.prototype), null);
+assert.sameValue(Object.getPrototypeOf(Foo.prototype.constructor), Function.prototype);
+assert.sameValue(Foo, Foo.prototype.constructor);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/class-definition-parent-proto-null.js b/js/src/tests/test262/language/statements/class/subclass/class-definition-parent-proto-null.js
new file mode 100644
index 0000000000..951b569c66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/class-definition-parent-proto-null.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: A class which extends a constructor with null .prototype is a derived class.
+---*/
+
+var invoked = false;
+var instance, savedArg;
+
+function A(arg) {
+ invoked = true;
+ savedArg = arg;
+ this.prop = 0;
+}
+A.prototype = null;
+
+class C extends A {}
+
+instance = new C(1);
+
+assert.sameValue(invoked, true);
+assert.sameValue(savedArg, 1);
+assert.sameValue(instance.prop, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/default-constructor-2.js b/js/src/tests/test262/language/statements/class/subclass/default-constructor-2.js
new file mode 100644
index 0000000000..e5a984401d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/default-constructor-2.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class default constructor 2
+---*/
+class Base1 { }
+assert.throws(TypeError, function() { Base1(); });
+
+class Subclass1 extends Base1 { }
+
+assert.throws(TypeError, function() { Subclass1(); });
+
+var s1 = new Subclass1();
+assert.sameValue(
+ Subclass1.prototype,
+ Object.getPrototypeOf(s1),
+ "The value of `Subclass1.prototype` is `Object.getPrototypeOf(s1)`, after executing `var s1 = new Subclass1();`"
+);
+
+class Base2 {
+ constructor(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+}
+
+class Subclass2 extends Base2 {};
+
+var s2 = new Subclass2(1, 2);
+
+assert.sameValue(
+ Subclass2.prototype,
+ Object.getPrototypeOf(s2),
+ "The value of `Subclass2.prototype` is `Object.getPrototypeOf(s2)`, after executing `var s2 = new Subclass2(1, 2);`"
+);
+assert.sameValue(s2.x, 1, "The value of `s2.x` is `1`");
+assert.sameValue(s2.y, 2, "The value of `s2.y` is `2`");
+
+var f = Subclass2.bind({}, 3, 4);
+var s2prime = new f();
+assert.sameValue(
+ Subclass2.prototype,
+ Object.getPrototypeOf(s2prime),
+ "The value of `Subclass2.prototype` is `Object.getPrototypeOf(s2prime)`"
+);
+assert.sameValue(s2prime.x, 3, "The value of `s2prime.x` is `3`");
+assert.sameValue(s2prime.y, 4, "The value of `s2prime.y` is `4`");
+
+
+var obj = {};
+class Base3 {
+ constructor() {
+ return obj;
+ }
+}
+
+class Subclass3 extends Base3 {};
+
+var s3 = new Subclass3();
+assert.sameValue(s3, obj, "The value of `s3` is `obj`");
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/default-constructor-spread-override.js b/js/src/tests/test262/language/statements/class/subclass/default-constructor-spread-override.js
new file mode 100644
index 0000000000..72d76c00a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/default-constructor-spread-override.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ Default class constructor does not use argument evaluation.
+features: [Symbol.iterator]
+---*/
+
+Array.prototype[Symbol.iterator] = function() {
+ throw new Test262Error('@@iterator invoked');
+};
+
+class Base {
+ constructor(value) {
+ this.value = value;
+ }
+}
+
+class Derived extends Base {}
+
+const instance = new Derived(5);
+
+assert.sameValue(instance.value, 5);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/default-constructor.js b/js/src/tests/test262/language/statements/class/subclass/default-constructor.js
new file mode 100644
index 0000000000..5976b13a8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/default-constructor.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ class default constructor
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ calls++;
+ }
+}
+class Derived extends Base {}
+var object = new Derived();
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+calls = 0;
+assert.throws(TypeError, function() { Derived(); });
+assert.sameValue(calls, 0, "The value of `calls` is `0`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally-arrow.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally-arrow.js
new file mode 100644
index 0000000000..f2bebd31f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally-arrow.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ `super()` in finally block is executed before checking for missing `super()`
+ call when `return` is in a catch block. The `super()` call is performed
+ through an arrow function.
+---*/
+
+class C extends class {} {
+ constructor() {
+ var f = () => super();
+
+ try {
+ throw null;
+ } catch(e) {
+ return;
+ } finally {
+ f();
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally.js
new file mode 100644
index 0000000000..e296a4642b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-finally.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ `super()` in finally block is executed before checking for missing `super()`
+ call when `return` is in a catch block.
+---*/
+
+class C extends class {} {
+ constructor() {
+ try {
+ throw null;
+ } catch(e) {
+ return;
+ } finally {
+ super();
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super-arrow.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super-arrow.js
new file mode 100644
index 0000000000..d7f4a4ef1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super-arrow.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ TypeError from `return 0` is not catchable with `super` called in catch block
+ from an arrow function.
+---*/
+
+class C extends class {} {
+ constructor() {
+ var f = () => super();
+
+ try {
+ return 0;
+ } catch(e) {
+ f();
+ }
+ }
+}
+
+assert.throws(TypeError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super.js
new file mode 100644
index 0000000000..6497f86914
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch-super.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ TypeError from `return 0` is not catchable with `super` in catch block.
+---*/
+
+class C extends class {} {
+ constructor() {
+ try {
+ return 0;
+ } catch(e) {
+ super();
+ }
+ }
+}
+
+assert.throws(TypeError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch.js
new file mode 100644
index 0000000000..253cc850e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-catch.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ TypeError from `return 0` is not catchable.
+---*/
+
+class C extends class {} {
+ constructor() {
+ super();
+
+ try {
+ return 0;
+ } catch(e) {
+ return;
+ }
+ }
+}
+
+assert.throws(TypeError, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super-arrow.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super-arrow.js
new file mode 100644
index 0000000000..b0b7246055
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super-arrow.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ `super()` in finally block is executed before checking for missing `super()`
+ call when `return` is in a try block. The `super()` call is performed
+ through an arrow function.
+---*/
+
+class C extends class {} {
+ constructor() {
+ var f = () => super();
+
+ try {
+ return;
+ } finally {
+ f();
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super.js
new file mode 100644
index 0000000000..5b7f585b62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-finally-super.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ `super()` in finally block is executed before checking for missing `super()`
+ call when `return` is in a try block.
+---*/
+
+class C extends class {} {
+ constructor() {
+ try {
+ return;
+ } finally {
+ super();
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of-arrow.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of-arrow.js
new file mode 100644
index 0000000000..020dcbb6d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of-arrow.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ ReferenceError when returning from a derived class constructor without calling
+ `super()` is thrown after the function body has been left, so an iterator
+ return handler can still call `super()`.
+---*/
+
+var iter = {
+ [Symbol.iterator]() {
+ return this;
+ },
+ next() {
+ return {done: false};
+ },
+ return() {
+ // Calls |super()|.
+ this.f();
+
+ return {done: true};
+ },
+};
+
+class C extends class {} {
+ constructor() {
+ iter.f = () => super();
+
+ for (var k of iter) {
+ return;
+ }
+ }
+}
+
+var o = new C();
+assert.sameValue(typeof o, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of.js
new file mode 100644
index 0000000000..c0bc4e153d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-for-of.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
+description: >
+ TypeError from `return 0` is thrown after the function body has been left, so
+ an error thrown from an iterator has precedence.
+---*/
+
+var error = new Test262Error();
+
+var iter = {
+ [Symbol.iterator]() {
+ return this;
+ },
+ next() {
+ return {done: false};
+ },
+ return() {
+ throw error;
+ },
+};
+
+class C extends class {} {
+ constructor() {
+ super();
+
+ for (var k of iter) {
+ return 0;
+ }
+ }
+}
+
+assert.throws(Test262Error, function() {
+ new C();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-boolean.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-boolean.js
new file mode 100644
index 0000000000..5e62e661da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-boolean.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return true;`
+
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return true;
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-empty.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-empty.js
new file mode 100644
index 0000000000..28bb88ecee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-empty.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, ...
+ 14. Else, ReturnIfAbrupt(result).
+ 15. Return envRec.GetThisBinding().
+
+ `return (empty);` Should be the same as `return undefined;`
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ this.prop = 1;
+ calls++;
+ }
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return;
+ }
+}
+
+var object = new Derived();
+
+// super is called
+assert.sameValue(calls, 1, "The value of `calls` is `1`, because `super()`");
+
+// undefined was returned
+assert.sameValue(object.prop, 1);
+assert.sameValue(object instanceof Derived, true);
+assert.sameValue(object instanceof Base, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-null.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-null.js
new file mode 100644
index 0000000000..9d1c0660d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-null.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return null;`
+
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return null;
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-number.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-number.js
new file mode 100644
index 0000000000..7dbb94394f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-number.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return 0;`
+
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return 0;
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-object.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-object.js
new file mode 100644
index 0000000000..a1581be078
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-object.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ a. If Type(result.[[value]]) is Object, return NormalCompletion(result.[[value]]).
+ ...
+ ...
+
+ `return {};`
+
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ this.prop = 1;
+ calls++;
+ }
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return {};
+ }
+}
+
+var object = new Derived();
+
+// super is called
+assert.sameValue(calls, 1, "The value of `calls` is `1`, because `super()`");
+
+// But the this object was discarded.
+assert.sameValue(typeof object.prop, "undefined");
+assert.sameValue(object instanceof Derived, false);
+assert.sameValue(object instanceof Base, false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-string.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-string.js
new file mode 100644
index 0000000000..c670fae177
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-string.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return "";`
+
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return "";
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-symbol.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-symbol.js
new file mode 100644
index 0000000000..d4b3315212
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-symbol.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, throw a TypeError exception.
+ ...
+
+ `return Symbol();`
+
+features: [Symbol]
+---*/
+class Base {
+ constructor() {}
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return Symbol();
+ }
+}
+
+assert.throws(TypeError, function() {
+ new Derived();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-this.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-this.js
new file mode 100644
index 0000000000..49cf683e04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-this.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ b. If kind is "base", return NormalCompletion(thisArgument).
+ ...
+ ...
+
+ `return this;`
+
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ this.prop = 1;
+ calls++;
+ }
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return this;
+ }
+}
+
+var object = new Derived();
+
+// super is called
+assert.sameValue(calls, 1, "The value of `calls` is `1`, because `super()`");
+
+// The this object was returned.
+assert.sameValue(object.prop, 1);
+assert.sameValue(object instanceof Derived, true);
+assert.sameValue(object instanceof Base, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-undefined.js b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-undefined.js
new file mode 100644
index 0000000000..882889c9b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/derived-class-return-override-with-undefined.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 9.2.2
+description: >
+ [[Construct]] ( argumentsList, newTarget)
+
+ ...
+ 13. If result.[[type]] is return, then
+ ...
+ c. If result.[[value]] is not undefined, ...
+ 14. Else, ReturnIfAbrupt(result).
+ 15. Return envRec.GetThisBinding().
+
+ `return undefined;`
+
+---*/
+var calls = 0;
+class Base {
+ constructor() {
+ this.prop = 1;
+ calls++;
+ }
+}
+class Derived extends Base {
+ constructor() {
+ super();
+
+ return undefined;
+ }
+}
+
+var object = new Derived();
+
+// super is called
+assert.sameValue(calls, 1, "The value of `calls` is `1`, because `super()`");
+
+// undefined was returned
+assert.sameValue(object.prop, 1);
+assert.sameValue(object instanceof Derived, true);
+assert.sameValue(object instanceof Base, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/shell.js b/js/src/tests/test262/language/statements/class/subclass/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/shell.js
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-arrow-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-arrow-function.js
new file mode 100644
index 0000000000..be59091134
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-arrow-function.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ IsConstructor check is performed before "prototype" lookup.
+ Arrow functions are not constructors (MakeConstructor is not called on them).
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ d. Let superclass be ? GetValue(superclassRef).
+ e. If superclass is null, then
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+features: [arrow-function, class, Proxy]
+---*/
+
+var fn = () => {};
+Object.defineProperty(fn, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class A extends fn {}
+});
+
+var bound = (() => {}).bind();
+Object.defineProperty(bound, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends bound {}
+});
+
+var proxy = new Proxy(() => {}, {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-async-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-async-function.js
new file mode 100644
index 0000000000..b9e71515ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-async-function.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ IsConstructor check is performed before "prototype" lookup.
+ Async functions are not constructors (MakeConstructor is not called on them).
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ d. Let superclass be ? GetValue(superclassRef).
+ e. If superclass is null, then
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+features: [async-functions, class, Proxy]
+---*/
+
+async function fn() {}
+Object.defineProperty(fn, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class A extends fn {}
+});
+
+var bound = (async function() {}).bind();
+Object.defineProperty(bound, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends bound {}
+});
+
+var proxy = new Proxy(async function() {}, {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-async-generator-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-async-generator-function.js
new file mode 100644
index 0000000000..d77acb6c90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-async-generator-function.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ IsConstructor check is performed before "prototype" lookup.
+ Async generator functions are not constructors (MakeConstructor is not called on them).
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ d. Let superclass be ? GetValue(superclassRef).
+ e. If superclass is null, then
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+features: [async-iteration, class, Proxy]
+---*/
+
+async function* fn() {}
+
+assert.throws(TypeError, function() {
+ class A extends fn {}
+});
+
+var bound = (async function* () {}).bind();
+Object.defineProperty(bound, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends bound {}
+});
+
+var proxy = new Proxy(async function* () {}, {});
+
+assert.throws(TypeError, function() {
+ class C extends proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-bound-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-bound-function.js
new file mode 100644
index 0000000000..2f95cc1ccf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-bound-function.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: SuperClass may be a bound function object
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+ g. Else,
+ i. Let protoParent be ? Get(superclass, "prototype").
+ ii. If Type(protoParent) is neither Object nor Null, throw a TypeError exception.
+ iii. Let constructorParent be superclass.
+features: [class]
+---*/
+
+var bound = function() {}.bind();
+bound.prototype = {};
+
+class C extends bound {}
+
+assert.sameValue(Object.getPrototypeOf(new C()), C.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-generator-function.js b/js/src/tests/test262/language/statements/class/subclass/superclass-generator-function.js
new file mode 100644
index 0000000000..c49a6be82a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-generator-function.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+ IsConstructor check is performed before "prototype" lookup.
+ Generator functions are not constructors (MakeConstructor is not called on them).
+info: |
+ ClassDefinitionEvaluation
+
+ [...]
+ 5. Else,
+ [...]
+ d. Let superclass be ? GetValue(superclassRef).
+ e. If superclass is null, then
+ [...]
+ f. Else if IsConstructor(superclass) is false, throw a TypeError exception.
+features: [generators, class, Proxy]
+---*/
+
+function* fn() {}
+
+assert.throws(TypeError, function() {
+ class A extends fn {}
+});
+
+var bound = (function* () {}).bind();
+Object.defineProperty(bound, "prototype", {
+ get: function() {
+ throw new Test262Error("`superclass.prototype` is unreachable");
+ },
+});
+
+assert.throws(TypeError, function() {
+ class C extends bound {}
+});
+
+var proxy = new Proxy(function* () {}, {});
+
+assert.throws(TypeError, function() {
+ class C extends proxy {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-constructor.js b/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-constructor.js
new file mode 100644
index 0000000000..04f3f34ced
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-constructor.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ superclass setter "constructor" override
+---*/
+function Base() {}
+
+Base.prototype = {
+ set constructor(_) {
+ throw new Test262Error("`Base.prototype.constructor` is unreachable.");
+ }
+};
+
+class C extends Base {}
+
+new C();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-method-override.js b/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-method-override.js
new file mode 100644
index 0000000000..f137ad2140
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-prototype-setter-method-override.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ superclass prototype override
+---*/
+function Base() {}
+
+Base.prototype = {
+ set m(_) {
+ throw new Test262Error("`Base.prototype.m` is unreachable.");
+ }
+};
+
+class C extends Base {
+ m() {
+ return 1;
+ }
+}
+
+assert.sameValue(new C().m(), 1, "`new C().m()` returns `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/subclass/superclass-static-method-override.js b/js/src/tests/test262/language/statements/class/subclass/superclass-static-method-override.js
new file mode 100644
index 0000000000..bd3d17d807
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/subclass/superclass-static-method-override.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ Static method override
+---*/
+function Base() {}
+Object.defineProperty(Base, 'staticM', {
+ set: function() {
+ throw new Test262Error("`Base.staticM` is unreachable.");
+ }
+});
+
+class C extends Base {
+ static staticM() {
+ return 1;
+ }
+}
+
+assert.sameValue(C.staticM(), 1, "`C.staticM()` returns `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/browser.js b/js/src/tests/test262/language/statements/class/super/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/browser.js
diff --git a/js/src/tests/test262/language/statements/class/super/in-constructor-superproperty-evaluation.js b/js/src/tests/test262/language/statements/class/super/in-constructor-superproperty-evaluation.js
new file mode 100644
index 0000000000..43ef9d6bc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-constructor-superproperty-evaluation.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2018 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ SuperProperty evaluation order: super() thisBinding initialization must occur first.
+---*/
+class Derived extends Object {
+ constructor() {
+ super[super()];
+ throw new Test262Error();
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ new Derived();
+}, '`super[super()]` via `new Derived()` throws a ReferenceError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-constructor.js b/js/src/tests/test262/language/statements/class/super/in-constructor.js
new file mode 100644
index 0000000000..e635c94ed4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-constructor.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in constructor
+---*/
+var calls = 0;
+class B {}
+B.prototype.x = 42;
+
+class C extends B {
+ constructor() {
+ super();
+ calls++;
+ assert.sameValue(super.x, 42, "The value of `super.x` is `42`");
+ }
+}
+
+new C;
+assert.sameValue(calls, 1, "The value of `calls` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-getter.js b/js/src/tests/test262/language/statements/class/super/in-getter.js
new file mode 100644
index 0000000000..b8be37b2a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-getter.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in getter
+---*/
+class B {
+ method() {
+ return 1;
+ }
+ get x() {
+ return 2;
+ }
+}
+class C extends B {
+ get y() {
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ return super.method();
+ }
+}
+assert.sameValue(new C().y, 1, "The value of `new C().y` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-methods.js b/js/src/tests/test262/language/statements/class/super/in-methods.js
new file mode 100644
index 0000000000..90d2e08c66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-methods.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in methods
+---*/
+class B {
+ method() {
+ return 1;
+ }
+ get x() {
+ return 2;
+ }
+}
+class C extends B {
+ method() {
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ return super.method();
+ }
+}
+assert.sameValue(new C().method(), 1, "`new C().method()` returns `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-setter.js b/js/src/tests/test262/language/statements/class/super/in-setter.js
new file mode 100644
index 0000000000..52cade7f64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-setter.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in setter
+---*/
+class B {
+ method() {
+ return 1;
+ }
+ get x() {
+ return 2;
+ }
+}
+class C extends B {
+ set y(v) {
+ assert.sameValue(v, 3, "The value of `v` is `3`");
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ assert.sameValue(super.method(), 1, "`super.method()` returns `1`");
+ }
+}
+assert.sameValue(new C().y = 3, 3, "`new C().y = 3` is `3`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-static-getter.js b/js/src/tests/test262/language/statements/class/super/in-static-getter.js
new file mode 100644
index 0000000000..edff783e68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-static-getter.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in static getter
+---*/
+class B {
+ static method() {
+ return 1;
+ }
+ static get x() {
+ return 2;
+ }
+}
+class C extends B {
+ static get x() {
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ return super.method();
+ }
+}
+assert.sameValue(C.x, 1, "The value of `C.x` is `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-static-methods.js b/js/src/tests/test262/language/statements/class/super/in-static-methods.js
new file mode 100644
index 0000000000..1d6808e0a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-static-methods.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in static methods
+---*/
+class B {
+ static method() {
+ return 1;
+ }
+ static get x() {
+ return 2;
+ }
+}
+class C extends B {
+ static method() {
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ return super.method();
+ }
+}
+assert.sameValue(C.method(), 1, "`C.method()` returns `1`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/in-static-setter.js b/js/src/tests/test262/language/statements/class/super/in-static-setter.js
new file mode 100644
index 0000000000..e870d302a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/in-static-setter.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-makesuperpropertyreference
+description: >
+ class super in static setter
+---*/
+class B {
+ static method() {
+ return 1;
+ }
+ static get x() {
+ return 2;
+ }
+}
+class C extends B {
+ static set x(v) {
+ assert.sameValue(v, 3, "The value of `v` is `3`");
+ assert.sameValue(super.x, 2, "The value of `super.x` is `2`");
+ assert.sameValue(super.method(), 1, "`super.method()` returns `1`");
+ }
+}
+assert.sameValue(C.x = 3, 3, "`C.x = 3` is `3`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/super/shell.js b/js/src/tests/test262/language/statements/class/super/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/super/shell.js
diff --git a/js/src/tests/test262/language/statements/class/syntax/browser.js b/js/src/tests/test262/language/statements/class/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/browser.js
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-body-has-direct-super-class-heritage.js b/js/src/tests/test262/language/statements/class/syntax/class-body-has-direct-super-class-heritage.js
new file mode 100644
index 0000000000..4c8a3a1499
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-body-has-direct-super-class-heritage.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.1
+description: >
+ The opposite of:
+
+ ClassTail : ClassHeritageopt { ClassBody }
+
+ It is a Syntax Error if ClassHeritage is not present and the following algorithm evaluates to true:
+ 1. Let constructor be ConstructorMethod of ClassBody.
+ 2. If constructor is empty, return false.
+ 3. Return HasDirectSuper of constructor.
+---*/
+class A {}
+class B extends A {
+ constructor() {
+ super();
+ }
+}
+
+
+assert.sameValue(typeof B, "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-body-method-definition-super-property.js b/js/src/tests/test262/language/statements/class/syntax/class-body-method-definition-super-property.js
new file mode 100644
index 0000000000..0d98925d67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-body-method-definition-super-property.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.1
+description: >
+ No restrictions on SuperProperty
+---*/
+class A {
+ constructor() {
+ super.toString();
+ }
+ dontDoThis() {
+ super.makeBugs = 1;
+ }
+}
+
+
+assert.sameValue(typeof A, "function");
+
+var a = new A();
+
+a.dontDoThis();
+assert.sameValue(a.makeBugs, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-declaration-binding-identifier-class-element-list.js b/js/src/tests/test262/language/statements/class/syntax/class-declaration-binding-identifier-class-element-list.js
new file mode 100644
index 0000000000..bebea48ef1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-declaration-binding-identifier-class-element-list.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ ClassDeclaration:
+ class BindingIdentifier ClassTail
+
+ ClassTail:
+ ... { ClassBodyopt }
+
+ ClassBody[Yield] :
+ ClassElementList[?Yield]
+
+
+ ClassElementList[Yield] :
+ ClassElement[?Yield]
+ ClassElementList[?Yield] ClassElement[?Yield]
+
+ ClassElement[Yield] :
+ MethodDefinition[?Yield]
+ static MethodDefinition[?Yield]
+ ;
+
+
+---*/
+class A {
+ method() {}
+ static method() {}
+ ;
+}
+
+assert.sameValue(typeof A, "function");
+assert.sameValue(typeof A.prototype.method, "function");
+assert.sameValue(typeof A.method, "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-declaration-computed-method-definition.js b/js/src/tests/test262/language/statements/class/syntax/class-declaration-computed-method-definition.js
new file mode 100644
index 0000000000..01baa0e028
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-declaration-computed-method-definition.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ ClassDeclaration:
+ class BindingIdentifier ClassTail
+
+ ClassTail:
+ ... { ClassBodyopt }
+
+ ClassBody[Yield] :
+ ClassElementList[?Yield]
+
+
+ ClassElementList[Yield] :
+ ClassElement[?Yield]
+ ClassElementList[?Yield] ClassElement[?Yield]
+
+ ClassElement[Yield] :
+ MethodDefinition[?Yield]
+ ...
+
+---*/
+class A {
+ [1]() {}
+}
+
+assert.sameValue(typeof A, "function");
+assert.sameValue(typeof A.prototype[1], "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-declaration-computed-method-generator-definition.js b/js/src/tests/test262/language/statements/class/syntax/class-declaration-computed-method-generator-definition.js
new file mode 100644
index 0000000000..1f209a0777
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-declaration-computed-method-generator-definition.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ ClassDeclaration:
+ class BindingIdentifier ClassTail
+
+ ClassTail:
+ ... { ClassBodyopt }
+
+ ClassBody[Yield] :
+ ClassElementList[?Yield]
+
+
+ ClassElementList[Yield] :
+ ClassElement[?Yield]
+ ClassElementList[?Yield] ClassElement[?Yield]
+
+ ClassElement[Yield] :
+ MethodDefinition[?Yield]
+ ...
+
+---*/
+class A {
+ *[1]() {}
+}
+
+assert.sameValue(typeof A, "function");
+assert.sameValue(typeof A.prototype[1], "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-declaration-heritage-identifier-reference-class-element-list.js b/js/src/tests/test262/language/statements/class/syntax/class-declaration-heritage-identifier-reference-class-element-list.js
new file mode 100644
index 0000000000..ddfca89cc9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-declaration-heritage-identifier-reference-class-element-list.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ ClassHeritage[Yield] :
+ extends LeftHandSideExpression[?Yield]
+
+ LeftHandSideExpression :
+ NewExpression
+ ...
+
+ NewExpression :
+ MemberExpression
+ ...
+
+ MemberExpression :
+ PrimaryExpression
+ ...
+
+ PrimaryExpression :
+ IdentifierReference
+ ...
+
+ ClassDeclaration:
+ class BindingIdentifier ClassTail
+
+ ClassTail:
+ ... { ClassBodyopt }
+
+ ClassBody[Yield] :
+ ClassElementList[?Yield]
+
+
+ ClassElementList[Yield] :
+ ClassElement[?Yield]
+ ClassElementList[?Yield] ClassElement[?Yield]
+
+ ClassElement[Yield] :
+ MethodDefinition[?Yield]
+ static MethodDefinition[?Yield]
+ ;
+
+---*/
+class A {}
+class B extends A {
+ method() {}
+ static method() {}
+ ;
+}
+
+assert.sameValue(typeof B, "function");
+assert.sameValue(typeof B.prototype.method, "function");
+assert.sameValue(typeof B.method, "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-expression-binding-identifier-opt-class-element-list.js b/js/src/tests/test262/language/statements/class/syntax/class-expression-binding-identifier-opt-class-element-list.js
new file mode 100644
index 0000000000..a0822488c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-expression-binding-identifier-opt-class-element-list.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ ClassExpression[Yield,GeneratorParameter] :
+ class BindingIdentifier[?Yield]opt ClassTail[?Yield,?GeneratorParameter]
+
+ ClassDeclaration:
+ class BindingIdentifier ClassTail
+
+ ClassTail:
+ ... { ClassBodyopt }
+
+ ClassBody[Yield] :
+ ClassElementList[?Yield]
+
+
+ ClassElementList[Yield] :
+ ClassElement[?Yield]
+ ClassElementList[?Yield] ClassElement[?Yield]
+
+ ClassElement[Yield] :
+ MethodDefinition[?Yield]
+ static MethodDefinition[?Yield]
+ ;
+
+---*/
+var A = class B {
+ method() {}
+ static method() {}
+ ;
+}
+
+assert.sameValue(typeof A, "function");
+assert.sameValue(typeof A.prototype.method, "function");
+assert.sameValue(typeof A.method, "function");
+
+assert.sameValue(typeof B, "undefined");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-expression-heritage-identifier-reference.js b/js/src/tests/test262/language/statements/class/syntax/class-expression-heritage-identifier-reference.js
new file mode 100644
index 0000000000..56c9faaa93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-expression-heritage-identifier-reference.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ ClassExpression[Yield,GeneratorParameter] :
+ class BindingIdentifier[?Yield]opt ClassTail[?Yield,?GeneratorParameter]
+
+ ClassTail[Yield,GeneratorParameter] :
+ [~GeneratorParameter] ClassHeritage[?Yield]opt { ClassBody[?Yield]opt }
+ [+GeneratorParameter] ClassHeritageopt { ClassBodyopt }
+---*/
+class A {}
+var B = class extends A {}
+
+assert.sameValue(typeof B, "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-expression.js b/js/src/tests/test262/language/statements/class/syntax/class-expression.js
new file mode 100644
index 0000000000..eb3207be4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-expression.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5
+description: >
+ ClassExpression
+---*/
+var A = class {}
+
+assert.sameValue(typeof A, "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/class-method-propname-constructor.js b/js/src/tests/test262/language/statements/class/syntax/class-method-propname-constructor.js
new file mode 100644
index 0000000000..36688dd52e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/class-method-propname-constructor.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.5.1
+description: >
+ The opposite of:
+
+ ClassBody : ClassElementList
+
+ It is a Syntax Error if PrototypePropertyNameList of ClassElementList contains more than one occurrence of "constructor".
+---*/
+class A {
+ constructor() {}
+}
+
+assert.sameValue(typeof A, "function");
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/syntax/early-errors/browser.js b/js/src/tests/test262/language/statements/class/syntax/early-errors/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/early-errors/browser.js
diff --git a/js/src/tests/test262/language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js b/js/src/tests/test262/language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js
new file mode 100644
index 0000000000..2217ee010e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1.1
+description: >
+ Block : { StatementList }
+
+ It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains any duplicate entries.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+{
+ class A {}
+ class A {}
+}
diff --git a/js/src/tests/test262/language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js b/js/src/tests/test262/language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js
new file mode 100644
index 0000000000..fa9fe2dbba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.1.1
+description: >
+ ScriptBody : StatementList
+
+ It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains any duplicate entries.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+class A {}
+class A {}
diff --git a/js/src/tests/test262/language/statements/class/syntax/early-errors/shell.js b/js/src/tests/test262/language/statements/class/syntax/early-errors/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/early-errors/shell.js
diff --git a/js/src/tests/test262/language/statements/class/syntax/escaped-static.js b/js/src/tests/test262/language/statements/class/syntax/escaped-static.js
new file mode 100644
index 0000000000..8c22111e0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/escaped-static.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-grammar-notation
+description: >
+ The `static` contextual keyword must not contain Unicode escape sequences.
+info: |
+ Terminal symbols are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ st\u0061tic m() {}
+}
diff --git a/js/src/tests/test262/language/statements/class/syntax/shell.js b/js/src/tests/test262/language/statements/class/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/syntax/shell.js
diff --git a/js/src/tests/test262/language/statements/const/block-local-closure-get-before-initialization.js b/js/src/tests/test262/language/statements/const/block-local-closure-get-before-initialization.js
new file mode 100644
index 0000000000..a510d9501c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/block-local-closure-get-before-initialization.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const: block local closure [[Get]] before initialization.
+ (TDZ, Temporal Dead Zone)
+---*/
+{
+ function f() { return x + 1; }
+
+ assert.throws(ReferenceError, function() {
+ f();
+ });
+
+ const x = 1;
+}
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/block-local-use-before-initialization-in-declaration-statement.js b/js/src/tests/test262/language/statements/const/block-local-use-before-initialization-in-declaration-statement.js
new file mode 100644
index 0000000000..44c9069984
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/block-local-use-before-initialization-in-declaration-statement.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const: block local use before initialization in declaration statement.
+ (TDZ, Temporal Dead Zone)
+---*/
+assert.throws(ReferenceError, function() {
+ {
+ const x = x + 1;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/block-local-use-before-initialization-in-prior-statement.js b/js/src/tests/test262/language/statements/const/block-local-use-before-initialization-in-prior-statement.js
new file mode 100644
index 0000000000..921b9e389a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/block-local-use-before-initialization-in-prior-statement.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const: block local use before initialization in prior statement.
+ (TDZ, Temporal Dead Zone)
+---*/
+
+assert.throws(ReferenceError, function() {
+ {
+ x; const x = 1;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/browser.js b/js/src/tests/test262/language/statements/const/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/browser.js
diff --git a/js/src/tests/test262/language/statements/const/cptn-value.js b/js/src/tests/test262/language/statements/const/cptn-value.js
new file mode 100644
index 0000000000..36560fb329
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/cptn-value.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+es6id: 13.3.1.4
+description: Returns an empty completion
+info: |
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+---*/
+
+assert.sameValue(
+ eval('const test262id1 = 1;'), undefined, 'Single declaration'
+);
+assert.sameValue(
+ eval('const test262id2 = 2, test262id3 = 3;'),
+ undefined,
+ 'Multiple declarations'
+);
+
+assert.sameValue(eval('4; const test262id5 = 5;'), 4);
+assert.sameValue(eval('6; let test262id7 = 7, test262id8 = 8;'), 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-close.js
new file mode 100644
index 0000000000..9a7bd72af7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-close.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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 {};
+ }
+ };
+};
+
+const [x] = iter;
+
+assert.sameValue(doneCallCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..29204bfad0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Abrupt completion returned by GetIterator (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ const [x, y, z] = [1, 2, 3];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-get-err.js
new file mode 100644
index 0000000000..33dc767fef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-get-err.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Abrupt completion returned by GetIterator (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ const [x] = iter;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-no-close.js
new file mode 100644
index 0000000000..195a24702e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-init-iter-no-close.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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 {};
+ }
+ };
+};
+
+const [x] = iter;
+
+assert.sameValue(doneCallCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/statements/const/dstr/ary-name-iter-val.js
new file mode 100644
index 0000000000..7d316d9e63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-name-iter-val.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: SingleNameBinding with normal value iteration (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [x, y, z] = [1, 2, 3];
+
+assert.sameValue(x, 1);
+assert.sameValue(y, 2);
+assert.sameValue(z, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..d00b90090c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const [[x, y, z] = [4, 5, 6]] = [];
+
+assert.sameValue(x, 4);
+assert.sameValue(y, 5);
+assert.sameValue(z, 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..7e5fa5633b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const [[x, y, z] = [4, 5, 6]] = [[7, 8, 9]];
+
+assert.sameValue(x, 7);
+assert.sameValue(y, 8);
+assert.sameValue(z, 9);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..88be25961c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+};
+
+const [[,] = g()] = [];
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..48bfffcd0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+};
+
+const [[,] = g()] = [[]];
+
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..ea6bb5f68c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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; }();
+
+const [[] = function() { initCount += 1; return iter; }()] = [];
+
+assert.sameValue(initCount, 1);
+assert.sameValue(iterCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..1cc79baa30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+const [[] = function() { initCount += 1; }()] = [[23]];
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..f2b899743f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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];
+
+const [[...x] = 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..b7272cf8f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+const [[...x] = function() { initCount += 1; }()] = [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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..3b94cbe498
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Nested array destructuring with a null value (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ const [[x]] = [null];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..53d87cdb38
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [x = 23] = [];
+
+assert.sameValue(x, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..e088e499f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,38 @@
+// 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/const-stmt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [arrow = () => {}] = [];
+
+assert.sameValue(arrow.name, 'arrow');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..57bbfba0f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,40 @@
+// 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/const-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = [];
+
+assert.sameValue(cls.name, 'cls');
+assert.notSameValue(xCls.name, 'xCls');
+assert.notSameValue(xCls2.name, 'xCls2');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..393e0209fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,39 @@
+// 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/const-stmt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [cover = (function () {}), xCover = (0, function() {})] = [];
+
+assert.sameValue(cover.name, 'cover');
+assert.notSameValue(xCover.name, 'xCover');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..ae22ac73c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,39 @@
+// 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/const-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [fn = function () {}, xFn = function x() {}] = [];
+
+assert.sameValue(fn.name, 'fn');
+assert.notSameValue(xFn.name, 'xFn');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..1352e09484
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,40 @@
+// 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/const-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+
+const [gen = function* () {}, xGen = function* x() {}] = [];
+
+assert.sameValue(gen.name, 'gen');
+assert.notSameValue(xGen.name, 'xGen');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..58abd5fde1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Destructuring initializer with a "hole" (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [x = 23] = [,];
+
+assert.sameValue(x, 23);
+// another statement
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..2afde0480a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+}
+
+const [w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, ''];
+
+assert.sameValue(w, null);
+assert.sameValue(x, 0);
+assert.sameValue(y, false);
+assert.sameValue(z, '');
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..6eab6e5aed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ const [x = (function() { throw new Test262Error(); })()] = [undefined];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..35793e89af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Destructuring initializer with an undefined value (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [x = 23] = [undefined];
+
+assert.sameValue(x, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..7e052d0cb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ const [ x = unresolvableReference ] = [];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..8b4fe992f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: SingleNameBinding when value iteration completes (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [x] = [];
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..36b8c01a70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [_, x] = [];
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..e50cc30803
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ const [x] = g;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..398da85705
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+const [x, y, z] = [1, 2, 3];
+
+assert.sameValue(x, 1);
+assert.sameValue(y, 2);
+assert.sameValue(z, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..404f8a0ce7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ const [x] = g;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..f884729cc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [x, y, z] = [1, 2, 3];
+
+assert.sameValue(x, 1);
+assert.sameValue(y, 2);
+assert.sameValue(z, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..3bf1d61f0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const [{ x, y, z } = { x: 44, y: 55, z: 66 }] = [];
+
+assert.sameValue(x, 44);
+assert.sameValue(y, 55);
+assert.sameValue(z, 66);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..47a06dd2fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-id.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const [{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }];
+
+assert.sameValue(x, 11);
+assert.sameValue(y, 22);
+assert.sameValue(z, 33);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..397879716f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [];
+
+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;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..cb37e16ae0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..08e3671b88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Nested object destructuring with a null value (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ const [{ x }] = [null];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..767b2f9f76
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ const [{ x }] = [];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..433991aa72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision-exhausted.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Elision accepts exhausted iterator (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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();
+
+const [,] = iter;
+
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..29de74290d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision-step-err.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ const [,] = iter;
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision.js
new file mode 100644
index 0000000000..8a5c0e44ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-elision.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Elision advances iterator (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+};
+
+const [,] = g();
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-empty.js
new file mode 100644
index 0000000000..9eb0b1270a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-empty.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+const [] = iter;
+
+assert.sameValue(iterations, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..784f739674
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const [...[x, y, z]] = [3, 4, 5];
+
+assert.sameValue(x, 3);
+assert.sameValue(y, 4);
+assert.sameValue(z, 5);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..b5de2c0cea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element containing an elision (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+};
+
+const [...[,]] = g();
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..4a90f996eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element containing an "empty" array pattern (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+}();
+
+const [...[]] = iter;
+
+assert.sameValue(iterations, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..d296e256ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element containing a rest element (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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];
+
+const [...[...x]] = 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);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..91115eb9a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-direct.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Lone rest element (direct binding) (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+const [...x] = [1];
+
+assert(Array.isArray(x));
+assert.compareArray(x, [1]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..682e01c23f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Rest element following elision elements (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ const [, ...x] = iter;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..0ff6c6985c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-elision.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element following elision elements (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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];
+
+const [ , , ...x] = 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..6df89f3ec5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: RestElement applied to an exhausted iterator (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+
+const [, , ...x] = [1, 2];
+
+assert(Array.isArray(x));
+assert.sameValue(x.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..fae90635ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ const [...x] = iter;
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..8ff072c031
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ const [...x] = iter;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..0b15751532
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-id.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Lone rest element (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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];
+
+const [...x] = 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..928ca0b939
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-ary.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+const [...[ x ] = []] = [];
+
+
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..3df0ad569c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-id.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element (identifier) does not support initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+const [...x = []] = [];
+
+
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..9fb68fbe7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-init-obj.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+const [...{ x } = []] = [];
+
+
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..2d45dd916a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+const [...[x], y] = [1, 2, 3];
+
+
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..4a91cb1d2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+const [...x, y] = [1, 2, 3];
+
+
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..2b0b7b3be6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+const [...{ x }, y] = [1, 2, 3];
+
+
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..2a0076c918
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-obj-id.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element containing an object binding pattern (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+ [...]
+---*/
+
+const [...{ length }] = [1, 2, 3];
+
+assert.sameValue(length, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..46ebf33e36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest element containing an object binding pattern (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+ [...]
+---*/
+let length = "outer";
+
+const [...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9];
+
+assert.sameValue(v, 7);
+assert.sameValue(w, 8);
+assert.sameValue(x, 9);
+assert.sameValue(y, undefined);
+assert.sameValue(z, 3);
+
+assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/browser.js b/js/src/tests/test262/language/statements/const/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-init-null.js b/js/src/tests/test262/language/statements/const/dstr/obj-init-null.js
new file mode 100644
index 0000000000..a52dfd5269
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-init-null.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ const {} = null;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-init-undefined.js b/js/src/tests/test262/language/statements/const/dstr/obj-init-undefined.js
new file mode 100644
index 0000000000..43b9d58043
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-init-undefined.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ const {} = undefined;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-empty.js
new file mode 100644
index 0000000000..56be45d381
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-empty.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+const {} = obj;
+
+assert.sameValue(accessCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..d419308bc1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-get-value-err.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ const { poisoned } = poisonedProperty;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..e689e4d2e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const { arrow = () => {} } = {};
+
+assert.sameValue(arrow.name, 'arrow');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..c56ad7e45f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {};
+
+assert.sameValue(cls.name, 'cls');
+assert.notSameValue(xCls.name, 'xCls');
+assert.notSameValue(xCls2.name, 'xCls2');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..f716599c0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const { cover = (function () {}), xCover = (0, function() {}) } = {};
+
+assert.sameValue(cover.name, 'cover');
+assert.notSameValue(xCover.name, 'xCover');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..884d4ec5a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+const { fn = function () {}, xFn = function x() {} } = {};
+
+assert.sameValue(fn.name, 'fn');
+assert.notSameValue(xFn.name, 'xFn');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..165992a539
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+
+const { gen = function* () {}, xGen = function* x() {} } = {};
+
+assert.sameValue(gen.name, 'gen');
+assert.notSameValue(xGen.name, 'xGen');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..72cf71c98d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-skipped.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+}
+
+const { w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..934b9c874c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-throws.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Error thrown when evaluating the initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ const { x = thrower() } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..08498ae163
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ const { x = unresolvableReference } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..6a9c17ebe8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+const { x, } = { x: 23 };
+
+assert.sameValue(x, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-list-err.js
new file mode 100644
index 0000000000..7792fd2c1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-list-err.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ const { a, b = thrower(), c = ++initCount } = {};
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..42a7c1c7fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-init.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const { w: [x, y, z] = [4, 5, 6] } = {};
+
+assert.sameValue(x, 4);
+assert.sameValue(y, 5);
+assert.sameValue(z, 6);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..f0d021ba40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+const { x: [y], } = { x: [45] };
+
+assert.sameValue(y,45);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..b0d8ba7aff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ const { w: [x, y, z] = [4, 5, 6] } = { w: null };
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..0ff0c2fc95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-ary.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const { w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] };
+
+assert.sameValue(x, 7);
+assert.sameValue(y, undefined);
+assert.sameValue(z, undefined);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..9681417aab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-eval-err.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ const { [thrower()]: x } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..d267102420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ const { poisoned: x = ++initEvalCount } = poisonedProperty;
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..1e2cf50e48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+}
+
+const { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..60c9865749
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Error thrown when evaluating the initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ const { x: y = thrower() } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..2e5a55585b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ const { x: y = unresolvableReference } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..44db061bd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-init.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+const { x: y = 33 } = { };
+
+assert.sameValue(y, 33);
+assert.throws(ReferenceError, function() {
+ x;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..709c49e24c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+const { x: y, } = { x: 23 };
+
+assert.sameValue(y, 23);
+
+assert.throws(ReferenceError, function() {
+ x;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..28b4a928ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-id.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Binding as specified via property name and identifier (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+const { x: y } = { x: 23 };
+
+assert.sameValue(y, 23);
+assert.throws(ReferenceError, function() {
+ x;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..1815863805
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-init.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined };
+
+assert.sameValue(x, 4);
+assert.sameValue(y, 5);
+assert.sameValue(z, 6);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..39540199ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null };
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..9d8d4fcac1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/const-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ const { w: { x, y, z } = undefined } = { };
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..b9b7368ccb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-prop-obj.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } };
+
+assert.sameValue(x, undefined);
+assert.sameValue(y, undefined);
+assert.sameValue(z, 7);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..2c03e4a31d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-getter.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+var count = 0;
+
+const {...x} = { get v() { count++; return 2; } };
+
+assert.sameValue(count, 1);
+
+verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..6ee26b1ec3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+const {...rest} = o;
+
+assert.sameValue(rest.x, undefined);
+
+verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+});
+
+verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..190851e87a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/obj-ptrn-rest-val-obj.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/const-stmt.template
+/*---
+description: Rest object contains just unextracted data (`const` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+
+const {a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3};
+
+assert.sameValue(rest.a, undefined);
+assert.sameValue(rest.b, undefined);
+
+verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+});
+
+verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/dstr/shell.js b/js/src/tests/test262/language/statements/const/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/const/fn-name-arrow.js b/js/src/tests/test262/language/statements/const/fn-name-arrow.js
new file mode 100644
index 0000000000..0c0e939667
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/fn-name-arrow.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: Assignment of function `name` attribute (ArrowFunction)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+---*/
+
+const arrow = () => {};
+
+assert.sameValue(arrow.name, 'arrow');
+verifyNotEnumerable(arrow, 'name');
+verifyNotWritable(arrow, 'name');
+verifyConfigurable(arrow, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/fn-name-class.js b/js/src/tests/test262/language/statements/const/fn-name-class.js
new file mode 100644
index 0000000000..b1b9f44024
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/fn-name-class.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: Assignment of function `name` attribute (ClassExpression)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+features: [class]
+---*/
+
+const xCls = class x {};
+const cls = class {};
+const xCls2 = class { static name() {} };
+
+assert.notSameValue(xCls.name, 'xCls');
+assert.notSameValue(xCls2.name, 'xCls2');
+
+assert.sameValue(cls.name, 'cls');
+verifyNotEnumerable(cls, 'name');
+verifyNotWritable(cls, 'name');
+verifyConfigurable(cls, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/fn-name-cover.js b/js/src/tests/test262/language/statements/const/fn-name-cover.js
new file mode 100644
index 0000000000..08f77bb6f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/fn-name-cover.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: >
+ Assignment of function `name` attribute (CoverParenthesizedExpression)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+---*/
+
+const xCover = (0, function() {});
+const cover = (function() {});
+
+assert(xCover.name !== 'xCover');
+
+assert.sameValue(cover.name, 'cover');
+verifyNotEnumerable(cover, 'name');
+verifyNotWritable(cover, 'name');
+verifyConfigurable(cover, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/fn-name-fn.js b/js/src/tests/test262/language/statements/const/fn-name-fn.js
new file mode 100644
index 0000000000..d9c8be1143
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/fn-name-fn.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: Assignment of function `name` attribute (FunctionExpression)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+---*/
+
+const xFn = function x() {};
+const fn = function() {};
+
+assert(xFn.name !== 'xFn');
+
+assert.sameValue(fn.name, 'fn');
+verifyNotEnumerable(fn, 'name');
+verifyNotWritable(fn, 'name');
+verifyConfigurable(fn, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/fn-name-gen.js b/js/src/tests/test262/language/statements/const/fn-name-gen.js
new file mode 100644
index 0000000000..37763eb368
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/fn-name-gen.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: Assignment of function `name` attribute (GeneratorExpression)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+features: [generators]
+---*/
+
+const xGen = function* x() {};
+const gen = function*() {};
+
+assert(xGen.name !== 'xGen');
+
+assert.sameValue(gen.name, 'gen');
+verifyNotEnumerable(gen, 'name');
+verifyNotWritable(gen, 'name');
+verifyConfigurable(gen, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/function-local-closure-get-before-initialization.js b/js/src/tests/test262/language/statements/const/function-local-closure-get-before-initialization.js
new file mode 100644
index 0000000000..60d5a712c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/function-local-closure-get-before-initialization.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const: function local closure [[Get]] before initialization.
+ (TDZ, Temporal Dead Zone)
+---*/
+(function() {
+ function f() { return x + 1; }
+
+ assert.throws(ReferenceError, function() {
+ f();
+ });
+
+ const x = 1;
+}());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/function-local-use-before-initialization-in-declaration-statement.js b/js/src/tests/test262/language/statements/const/function-local-use-before-initialization-in-declaration-statement.js
new file mode 100644
index 0000000000..c40f0f2ba5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/function-local-use-before-initialization-in-declaration-statement.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const: function local use before initialization in declaration statement.
+ (TDZ, Temporal Dead Zone)
+---*/
+assert.throws(ReferenceError, function() {
+ (function() {
+ const x = x + 1;
+ }());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/function-local-use-before-initialization-in-prior-statement.js b/js/src/tests/test262/language/statements/const/function-local-use-before-initialization-in-prior-statement.js
new file mode 100644
index 0000000000..5449899a32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/function-local-use-before-initialization-in-prior-statement.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const: function local use before initialization in prior statement.
+ (TDZ, Temporal Dead Zone)
+---*/
+assert.throws(ReferenceError, function() {
+ (function() {
+ x; const x = 1;
+ }());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/global-closure-get-before-initialization.js b/js/src/tests/test262/language/statements/const/global-closure-get-before-initialization.js
new file mode 100644
index 0000000000..3b8d314bbf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/global-closure-get-before-initialization.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const: global closure [[Get]] before initialization.
+ (TDZ, Temporal Dead Zone)
+---*/
+
+function f() { return x + 1; }
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+const x = 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/global-use-before-initialization-in-declaration-statement.js b/js/src/tests/test262/language/statements/const/global-use-before-initialization-in-declaration-statement.js
new file mode 100644
index 0000000000..ec187b6097
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/global-use-before-initialization-in-declaration-statement.js
@@ -0,0 +1,13 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const: global use before initialization in declaration statement.
+ (TDZ, Temporal Dead Zone)
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+const x = x + 1;
diff --git a/js/src/tests/test262/language/statements/const/global-use-before-initialization-in-prior-statement.js b/js/src/tests/test262/language/statements/const/global-use-before-initialization-in-prior-statement.js
new file mode 100644
index 0000000000..7c8d5f4a00
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/global-use-before-initialization-in-prior-statement.js
@@ -0,0 +1,13 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const: global use before initialization in prior statement.
+ (TDZ, Temporal Dead Zone)
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+x; const x = 1;
diff --git a/js/src/tests/test262/language/statements/const/redeclaration-error-from-within-strict-mode-function-const.js b/js/src/tests/test262/language/statements/const/redeclaration-error-from-within-strict-mode-function-const.js
new file mode 100644
index 0000000000..5ef1bab449
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/redeclaration-error-from-within-strict-mode-function-const.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ Redeclaration error within strict mode function inside non-strict code.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+(function() { 'use strict'; { const f = 1; var f; } })
+
diff --git a/js/src/tests/test262/language/statements/const/shell.js b/js/src/tests/test262/language/statements/const/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/shell.js
diff --git a/js/src/tests/test262/language/statements/const/static-init-await-binding-invalid.js b/js/src/tests/test262/language/statements/const/static-init-await-binding-invalid.js
new file mode 100644
index 0000000000..8d4c534fbc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/static-init-await-binding-invalid.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: BindingIdentifier may not be `await` within class static blocks
+info: |
+ BindingIdentifier : Identifier
+
+ [...]
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ const await = 0;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/const/static-init-await-binding-valid.js b/js/src/tests/test262/language/statements/const/static-init-await-binding-valid.js
new file mode 100644
index 0000000000..4b7b1260f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/static-init-await-binding-valid.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The `await` keyword is interpreted as an identifier within arrow function bodies
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ [...]
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+features: [class-static-block]
+---*/
+
+class C {
+ static {
+ (() => { const await = 0; });
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js b/js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js
new file mode 100644
index 0000000000..a8fd7d4631
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations mixed: with, without initialiser
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+const x = 1, y;
+
diff --git a/js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js b/js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js
new file mode 100644
index 0000000000..7d4840678c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations mixed: without, with initialiser
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+const x, y = 1;
+
diff --git a/js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-without-initialiser.js b/js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-without-initialiser.js
new file mode 100644
index 0000000000..ca9d9b24b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/block-scope-syntax-const-declarations-without-initialiser.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations without initialiser
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+const x;
+
diff --git a/js/src/tests/test262/language/statements/const/syntax/browser.js b/js/src/tests/test262/language/statements/const/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/browser.js
diff --git a/js/src/tests/test262/language/statements/const/syntax/const-declaring-let-split-across-two-lines.js b/js/src/tests/test262/language/statements/const/syntax/const-declaring-let-split-across-two-lines.js
new file mode 100644
index 0000000000..c5d571e713
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/const-declaring-let-split-across-two-lines.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2015 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Jeff Walden
+es6id: 13.3.1.1
+description: >
+ const: |const let| split across two lines is a static semantics early error.
+info: |
+ Lexical declarations may not declare a binding named "let".
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+const
+let = "irrelevant initializer";
diff --git a/js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-next-expression-for.js b/js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-next-expression-for.js
new file mode 100644
index 0000000000..a48a261239
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-next-expression-for.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2015 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.3.7_S5.a.i
+description: >
+ const: invalid assignment in next expression
+---*/
+
+assert.throws(TypeError, function() {
+ for (const i = 0; i < 1; i++) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-statement-body-for-in.js b/js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-statement-body-for-in.js
new file mode 100644
index 0000000000..3c2c66c4c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-statement-body-for-in.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.10_S1.a.i
+description: >
+ const: invalid assignment in Statement body
+---*/
+
+assert.throws(TypeError, function() {
+ for (const x in [1, 2, 3]) { x++ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-statement-body-for-of.js b/js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-statement-body-for-of.js
new file mode 100644
index 0000000000..a0c6ae502c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/const-invalid-assignment-statement-body-for-of.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.10_S1.a.i
+description: >
+ const: invalid assignment in Statement body
+---*/
+
+assert.throws(TypeError, function() {
+ for (const x of [1, 2, 3]) { x++ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/syntax/const-outer-inner-let-bindings.js b/js/src/tests/test262/language/statements/const/syntax/const-outer-inner-let-bindings.js
new file mode 100644
index 0000000000..eaa85ea045
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/const-outer-inner-let-bindings.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ outer const binding unchanged by for-loop const binding
+---*/
+//
+
+const x = "outer_x";
+const y = "outer_y";
+var i = 0;
+
+for (const x = "inner_x"; i < 1; i++) {
+ const y = "inner_y";
+
+ assert.sameValue(x, "inner_x");
+ assert.sameValue(y, "inner_y");
+}
+assert.sameValue(x, "outer_x");
+assert.sameValue(y, "outer_y");
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/syntax/const.js b/js/src/tests/test262/language/statements/const/syntax/const.js
new file mode 100644
index 0000000000..0727dea9fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/const.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ global and block scope const
+---*/
+const z = 4;
+
+// Block local
+{
+ const z = 5;
+}
+
+assert.sameValue(z, 4);
+
+if (true) {
+ const z = 1;
+ assert.sameValue(z, 1);
+}
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/syntax/shell.js b/js/src/tests/test262/language/statements/const/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/shell.js
diff --git a/js/src/tests/test262/language/statements/const/syntax/with-initializer-case-expression-statement-list.js b/js/src/tests/test262/language/statements/const/syntax/with-initializer-case-expression-statement-list.js
new file mode 100644
index 0000000000..ebf239f7b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/with-initializer-case-expression-statement-list.js
@@ -0,0 +1,11 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations with initialisers in statement positions:
+ case Expression : StatementList
+---*/
+switch (true) { case true: const x = 1; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/syntax/with-initializer-default-statement-list.js b/js/src/tests/test262/language/statements/const/syntax/with-initializer-default-statement-list.js
new file mode 100644
index 0000000000..2b2790c84b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/with-initializer-default-statement-list.js
@@ -0,0 +1,11 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations with initialisers in statement positions:
+ default : StatementList
+---*/
+switch (true) { default: const x = 1; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/const/syntax/with-initializer-do-statement-while-expression.js b/js/src/tests/test262/language/statements/const/syntax/with-initializer-do-statement-while-expression.js
new file mode 100644
index 0000000000..a2f30531b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/with-initializer-do-statement-while-expression.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations with initialisers in statement positions:
+ do Statement while ( Expression )
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+do const x = 1; while (false)
diff --git a/js/src/tests/test262/language/statements/const/syntax/with-initializer-for-statement.js b/js/src/tests/test262/language/statements/const/syntax/with-initializer-for-statement.js
new file mode 100644
index 0000000000..82e437428a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/with-initializer-for-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations with initialisers in statement positions:
+ for ( ;;) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+for (;false;) const x = 1;
diff --git a/js/src/tests/test262/language/statements/const/syntax/with-initializer-if-expression-statement-else-statement.js b/js/src/tests/test262/language/statements/const/syntax/with-initializer-if-expression-statement-else-statement.js
new file mode 100644
index 0000000000..1153ecae41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/with-initializer-if-expression-statement-else-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations with initialisers in statement positions:
+ if ( Expression ) Statement else Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+if (true) {} else const x = 1;
diff --git a/js/src/tests/test262/language/statements/const/syntax/with-initializer-if-expression-statement.js b/js/src/tests/test262/language/statements/const/syntax/with-initializer-if-expression-statement.js
new file mode 100644
index 0000000000..578b84f316
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/with-initializer-if-expression-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations with initialisers in statement positions:
+ if ( Expression ) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+if (true) const x = 1;
diff --git a/js/src/tests/test262/language/statements/const/syntax/with-initializer-label-statement.js b/js/src/tests/test262/language/statements/const/syntax/with-initializer-label-statement.js
new file mode 100644
index 0000000000..2bd15c778f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/with-initializer-label-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations with initialisers in statement positions:
+ label: Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+label: const x = 1;
diff --git a/js/src/tests/test262/language/statements/const/syntax/with-initializer-while-expression-statement.js b/js/src/tests/test262/language/statements/const/syntax/with-initializer-while-expression-statement.js
new file mode 100644
index 0000000000..4c9d9e6827
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/with-initializer-while-expression-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations with initialisers in statement positions:
+ while ( Expression ) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+while (false) const x = 1;
diff --git a/js/src/tests/test262/language/statements/const/syntax/without-initializer-case-expression-statement-list.js b/js/src/tests/test262/language/statements/const/syntax/without-initializer-case-expression-statement-list.js
new file mode 100644
index 0000000000..e8c367c32e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/without-initializer-case-expression-statement-list.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations without initialisers in statement positions:
+ case Expression : StatementList
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+switch (true) { case true: const x; }
diff --git a/js/src/tests/test262/language/statements/const/syntax/without-initializer-default-statement-list.js b/js/src/tests/test262/language/statements/const/syntax/without-initializer-default-statement-list.js
new file mode 100644
index 0000000000..ff8f429de4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/without-initializer-default-statement-list.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations without initialisers in statement positions:
+ default : StatementList
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+switch (true) { default: const x; }
diff --git a/js/src/tests/test262/language/statements/const/syntax/without-initializer-do-statement-while-expression.js b/js/src/tests/test262/language/statements/const/syntax/without-initializer-do-statement-while-expression.js
new file mode 100644
index 0000000000..6e3a086964
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/without-initializer-do-statement-while-expression.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations without initialisers in statement positions:
+ do Statement while ( Expression )
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+do const x; while (false)
diff --git a/js/src/tests/test262/language/statements/const/syntax/without-initializer-for-statement.js b/js/src/tests/test262/language/statements/const/syntax/without-initializer-for-statement.js
new file mode 100644
index 0000000000..2a7c84ccc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/without-initializer-for-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations without initialisers in statement positions:
+ for ( ;;) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+for (;false;) const x;
diff --git a/js/src/tests/test262/language/statements/const/syntax/without-initializer-if-expression-statement-else-statement.js b/js/src/tests/test262/language/statements/const/syntax/without-initializer-if-expression-statement-else-statement.js
new file mode 100644
index 0000000000..1a5e3d1a67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/without-initializer-if-expression-statement-else-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations without initialisers in statement positions:
+ if ( Expression ) Statement else Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+if (true) {} else const x;
diff --git a/js/src/tests/test262/language/statements/const/syntax/without-initializer-if-expression-statement.js b/js/src/tests/test262/language/statements/const/syntax/without-initializer-if-expression-statement.js
new file mode 100644
index 0000000000..4d894bbe11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/without-initializer-if-expression-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations without initialisers in statement positions:
+ if ( Expression ) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+if (true) const x;
diff --git a/js/src/tests/test262/language/statements/const/syntax/without-initializer-label-statement.js b/js/src/tests/test262/language/statements/const/syntax/without-initializer-label-statement.js
new file mode 100644
index 0000000000..a3b71f12f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/without-initializer-label-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations without initialisers in statement positions:
+ label: Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+label: const x;
diff --git a/js/src/tests/test262/language/statements/const/syntax/without-initializer-while-expression-statement.js b/js/src/tests/test262/language/statements/const/syntax/without-initializer-while-expression-statement.js
new file mode 100644
index 0000000000..31aea3f9a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/const/syntax/without-initializer-while-expression-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ const declarations without initialisers in statement positions:
+ while ( Expression ) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+while (false) const x;
diff --git a/js/src/tests/test262/language/statements/continue/12.7-1.js b/js/src/tests/test262/language/statements/continue/12.7-1.js
new file mode 100644
index 0000000000..ea88550833
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/12.7-1.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.7-1
+description: >
+ The continue Statement - a continue statement without an
+ identifier may have a LineTerminator before the semi-colon
+---*/
+
+var sum = 0;
+for (var i = 1; i <= 10; i++) {
+ if (true) continue
+ ; else {}
+ sum += i;
+}
+
+assert.sameValue(sum, 0, 'sum');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A1_T1.js b/js/src/tests/test262/language/statements/continue/S12.7_A1_T1.js
new file mode 100644
index 0000000000..1d042a048c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A1_T1.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of continue without an IterationStatement leads to syntax error
+es5id: 12.7_A1_T1
+description: >
+ Checking if execution of single "continue" without any
+ IterationStatement fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x=1;
+continue;
+var y=2;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A1_T2.js b/js/src/tests/test262/language/statements/continue/S12.7_A1_T2.js
new file mode 100644
index 0000000000..6212c359a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A1_T2.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of continue without an IterationStatement leads to syntax error
+es5id: 12.7_A1_T2
+description: >
+ Checking if single "continue" with Label but without any
+ IterationStatement fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+LABEL : x=3.14;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x=1;
+continue LABEL;
+var y=2;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A1_T3.js b/js/src/tests/test262/language/statements/continue/S12.7_A1_T3.js
new file mode 100644
index 0000000000..2a3b03a664
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A1_T3.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of continue without an IterationStatement leads to syntax error
+es5id: 12.7_A1_T3
+description: >
+ Checking if laballed "continue" with no IterationStatement, placed
+ into a block, fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+LABEL : x=3.14;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+{
+ var x=1;
+ continue LABEL;
+ var y=2;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A1_T4.js b/js/src/tests/test262/language/statements/continue/S12.7_A1_T4.js
new file mode 100644
index 0000000000..140ace8ff7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A1_T4.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of continue without an IterationStatement leads to syntax error
+es5id: 12.7_A1_T4
+description: >
+ Checking if execution of "continue" with no IterationStatement,
+ placed into a block, fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+{
+ var x=1;
+ continue;
+ var y=2;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A5_T1.js b/js/src/tests/test262/language/statements/continue/S12.7_A5_T1.js
new file mode 100644
index 0000000000..467801e7bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A5_T1.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "continue Identifier" is evaluated Identifier must be label in the
+ label set of an enclosing (but not crossing function boundaries)
+ IterationStatement
+es5id: 12.7_A5_T1
+description: Trying to continue another labeled loop
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+LABEL_OUT : var x=0, y=0;
+LABEL_DO_LOOP : do {
+ LABEL_IN : x++;
+ if(x===10)break;
+ continue LABEL_ANOTHER_LOOP;
+ LABEL_IN_2 : y++;
+ function IN_DO_FUNC(){}
+} while(0);
+
+LABEL_ANOTHER_LOOP : do {
+ ;
+} while(0);
+
+function OUT_FUNC(){}
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A5_T2.js b/js/src/tests/test262/language/statements/continue/S12.7_A5_T2.js
new file mode 100644
index 0000000000..2a189f9fe6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A5_T2.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "continue Identifier" is evaluated Identifier must be label in the
+ label set of an enclosing (but not crossing function boundaries)
+ IterationStatement
+es5id: 12.7_A5_T2
+description: Identifier is a function name
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+LABEL_OUT : var x=0, y=0;
+LABEL_DO_LOOP : do {
+ LABEL_IN : x++;
+ if(x===10)break;
+ continue IN_DO_FUNC;
+ LABEL_IN_2 : y++;
+ function IN_DO_FUNC(){}
+} while(0);
+
+LABEL_ANOTHER_LOOP : do {
+ ;
+} while(0);
+
+function OUT_FUNC(){};
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A5_T3.js b/js/src/tests/test262/language/statements/continue/S12.7_A5_T3.js
new file mode 100644
index 0000000000..ab3d4eeed6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A5_T3.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "continue Identifier" is evaluated Identifier must be label in the
+ label set of an enclosing (but not crossing function boundaries)
+ IterationStatement
+es5id: 12.7_A5_T3
+description: Identifier is within loop label
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+LABEL_OUT : var x=0, y=0;
+
+LABEL_DO_LOOP : do {
+ LABEL_IN : x++;
+ if(x===10)break;
+ continue LABEL_IN;
+ LABEL_IN_2 : y++;
+ function IN_DO_FUNC(){}
+} while(0);
+
+LABEL_ANOTHER_LOOP : do {
+ ;
+} while(0);
+
+function OUT_FUNC(){}
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A6.js b/js/src/tests/test262/language/statements/continue/S12.7_A6.js
new file mode 100644
index 0000000000..c9991d1f1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A6.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Appearing of "continue" within a function call that is within an
+ IterationStatement yields SyntaxError
+es5id: 12.7_A6
+description: Using labaled "continue Identifier" within a function body
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var x=0,y=0;
+
+LABEL1 : do {
+ x++;
+ (function(){continue LABEL1;})();
+ y++;
+} while(0);
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A7.js b/js/src/tests/test262/language/statements/continue/S12.7_A7.js
new file mode 100644
index 0000000000..c0670718bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A7.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Appearing of continue within eval statement that is within an
+ IterationStatement yields SyntaxError
+es5id: 12.7_A7
+description: Using eval "eval("continue LABEL1")"
+---*/
+
+var x=0,y=0;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ LABEL1 : do {
+ x++;
+ eval("continue LABEL1");
+ y++;
+ } while(0);
+ throw new Test262Error('#1: eval("continue LABEL1") does not lead to throwing exception');
+} catch(e){
+ if(!(e instanceof SyntaxError)){
+ throw new Test262Error("1.1: Appearing of continue within eval statement inside of IterationStatement yields SyntaxError");
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A8_T1.js b/js/src/tests/test262/language/statements/continue/S12.7_A8_T1.js
new file mode 100644
index 0000000000..74f72b2182
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A8_T1.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "continue" within a "try/catch" Block yields SyntaxError
+es5id: 12.7_A8_T1
+description: >
+ Checking if execution of "continue Identifier" within catch Block
+ fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try{
+} catch(e){
+ continue LABEL2;
+ LABEL2 : do {
+ } while(0);
+};
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A8_T2.js b/js/src/tests/test262/language/statements/continue/S12.7_A8_T2.js
new file mode 100644
index 0000000000..474a118776
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A8_T2.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "continue" within a "try/catch" Block yields SyntaxError
+es5id: 12.7_A8_T2
+description: Checking if execution of "continue" within catch Block fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try{
+} catch(e){
+ continue;
+};
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A9_T1.js b/js/src/tests/test262/language/statements/continue/S12.7_A9_T1.js
new file mode 100644
index 0000000000..7672328da5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A9_T1.js
@@ -0,0 +1,34 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Continue inside of try-catch nested in a loop is allowed
+es5id: 12.7_A9_T1
+description: >
+ Using "continue Identifier" within catch Block that is within a
+ loop
+---*/
+
+var x=0,y=0;
+
+(function(){
+FOR : for(;;){
+ try{
+ x++;
+ if(x===10)return;
+ throw 1;
+ } catch(e){
+ continue FOR;
+ }
+}
+})();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x!==10) {
+ throw new Test262Error('#1: Continue inside of try-catch nested in loop is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/S12.7_A9_T2.js b/js/src/tests/test262/language/statements/continue/S12.7_A9_T2.js
new file mode 100644
index 0000000000..8a447aeb2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/S12.7_A9_T2.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Continue inside of try-catch nested in a loop is allowed
+es5id: 12.7_A9_T2
+description: Using "continue" within catch Block that is within a loop
+---*/
+
+var x=0,y=0;
+
+(function(){
+FOR : for(;;){
+ try{
+ x++;
+ if(x===10)return;
+ throw 1;
+ } catch(e){
+ continue;
+ }
+}
+})();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x!==10) {
+ throw new Test262Error('#1: Continue inside of try-catch nested in loop is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/browser.js b/js/src/tests/test262/language/statements/continue/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/browser.js
diff --git a/js/src/tests/test262/language/statements/continue/labeled-continue.js b/js/src/tests/test262/language/statements/continue/labeled-continue.js
new file mode 100644
index 0000000000..3925c189e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/labeled-continue.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12
+description: >
+ labeled continue
+---*/
+var count = 0;
+label: for (let x = 0; x < 10;) {
+ while (true) {
+ x++;
+ count++;
+ continue label;
+ }
+}
+assert.sameValue(count, 10, "The value of `count` is `10`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/line-terminators.js b/js/src/tests/test262/language/statements/continue/line-terminators.js
new file mode 100644
index 0000000000..6790dfc859
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/line-terminators.js
@@ -0,0 +1,46 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Since LineTerminator between "continue" and Identifier is not allowed,
+ "continue" is evaluated without label
+es5id: 12.7_A2
+description: >
+ Checking by using eval, inserting LineTerminator between continue
+ and Identifier
+---*/
+
+FOR1 : for(var i=1;i<2;i++){
+ FOR1NESTED : for(var j=1;j<2;j++) {
+ continue
+FOR1;
+ } while(0);
+}
+
+assert.sameValue(j, 2, '#1: Since LineTerminator(U-000A) between continue and Identifier not allowed continue evaluates without label');
+
+FOR2 : for(var i=1;i<2;i++){
+ FOR2NESTED : for(var j=1;j<2;j++) {
+ continue FOR2;
+ } while(0);
+}
+
+assert.sameValue(j, 2, '#2: Since LineTerminator(U-000D) between continue and Identifier not allowed continue evaluates without label');
+
+FOR3 : for(var i=1;i<2;i++){
+ FOR3NESTED : for(var j=1;j<2;j++) {
+ continue
FOR3;
+ } while(0);
+}
+assert.sameValue(j, 2, '#3: Since LineTerminator(U-2028) between continue and Identifier not allowed continue evaluates without label');
+
+FOR4 : for(var i=1;i<2;i++){
+ FOR4NESTED : for(var j=1;j<2;j++) {
+ continue
FOR4;
+ } while(0);
+}
+
+assert.sameValue(j, 2, '#4: Since LineTerminator(U-2029) between continue and Identifier not allowed continue evaluates without label');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-inner-continue.js b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-inner-continue.js
new file mode 100644
index 0000000000..be9d804e46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-inner-continue.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12
+description: >
+ nested let bound for loops inner continue
+---*/
+var count = 0;
+for (let x = 0; x < 10;) {
+ x++;
+ for (let y = 0; y < 2;) {
+ y++;
+ count++;
+ continue;
+ }
+}
+assert.sameValue(count, 20, "The value of `count` is `20`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-labeled-continue.js b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-labeled-continue.js
new file mode 100644
index 0000000000..7d7942b100
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-labeled-continue.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12
+description: >
+ nested let bound for loops labeled continue
+---*/
+var count = 0;
+outer: for (let x = 0; x < 10;) {
+ x++;
+ for (let y = 0; y < 2;) {
+ y++;
+ count++;
+ if (y == 2) continue outer;
+ }
+}
+assert.sameValue(count, 20, "The value of `count` is `20`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-outer-continue.js b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-outer-continue.js
new file mode 100644
index 0000000000..9319624961
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/nested-let-bound-for-loops-outer-continue.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12
+description: >
+ nested let bound for loops outer continue
+---*/
+var count = 0;
+for (let x = 0; x < 10;) {
+ x++;
+ for (let y = 0; y < 2;) {
+ y++;
+ count++;
+ }
+ continue;
+}
+assert.sameValue(count, 20, "The value of `count` is `20`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/no-label-continue.js b/js/src/tests/test262/language/statements/continue/no-label-continue.js
new file mode 100644
index 0000000000..f05b38861a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/no-label-continue.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12
+description: >
+ no label continue
+---*/
+var count = 0;
+for (let x = 0; x < 10;) {
+ x++;
+ count++;
+ continue;
+}
+assert.sameValue(count, 10, "The value of `count` is `10`");
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/shadowing-loop-variable-in-same-scope-as-continue.js b/js/src/tests/test262/language/statements/continue/shadowing-loop-variable-in-same-scope-as-continue.js
new file mode 100644
index 0000000000..a216e1487e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/shadowing-loop-variable-in-same-scope-as-continue.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12
+description: >
+ shadowing loop variable in same scope as continue
+---*/
+var count = 0;
+for (let x = 0; x < 10;) {
+ x++;
+ count++;
+ {
+ let x = "hello";
+ continue;
+ }
+}
+assert.sameValue(count, 10, "The value of `count` is `10`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/shell.js b/js/src/tests/test262/language/statements/continue/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/shell.js
diff --git a/js/src/tests/test262/language/statements/continue/simple-and-labeled.js b/js/src/tests/test262/language/statements/continue/simple-and-labeled.js
new file mode 100644
index 0000000000..c372dfb5c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/simple-and-labeled.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12
+description: >
+ basic labeled for loop with continue
+---*/
+var count = 0;
+label: for (let x = 0; x < 10;) {
+ x++;
+ count++;
+ continue label;
+}
+assert.sameValue(count, 10, "The value of `count` is `10`");
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/continue/static-init-with-label.js b/js/src/tests/test262/language/statements/continue/static-init-with-label.js
new file mode 100644
index 0000000000..cb9d9b0c3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/static-init-with-label.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-continue-statement
+description: IterationStatement search does not traverse static initialization block boundaries (label specified)
+info: |
+ 4.1.1 Static Semantics: Early Errors
+ ContinueStatement : continue ;
+ ContinueStatement : continue LabelIdentifier ;
+
+ - It is a Syntax Error if this ContinueStatement is not nested, directly or
+ indirectly (but not crossing function or static initialization block
+ boundaries), within an IterationStatement.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+label: while(false) {
+ class C {
+ static {
+ continue label;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/continue/static-init-without-label.js b/js/src/tests/test262/language/statements/continue/static-init-without-label.js
new file mode 100644
index 0000000000..9d4da1774a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/continue/static-init-without-label.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-continue-statement
+description: IterationStatement search does not traverse static initialization block boundaries (no label specified)
+info: |
+ 4.1.1 Static Semantics: Early Errors
+ ContinueStatement : continue ;
+ ContinueStatement : continue LabelIdentifier ;
+
+ - It is a Syntax Error if this ContinueStatement is not nested, directly or
+ indirectly (but not crossing function or static initialization block
+ boundaries), within an IterationStatement.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+label: while(false) {
+ class C {
+ static {
+ continue;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/statements/debugger/browser.js b/js/src/tests/test262/language/statements/debugger/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/debugger/browser.js
diff --git a/js/src/tests/test262/language/statements/debugger/expression.js b/js/src/tests/test262/language/statements/debugger/expression.js
new file mode 100644
index 0000000000..7b4c4f5b86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/debugger/expression.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The `debugger` token may not occupy an expression position
+esid: sec-debugger-statement
+es6id: 13.16
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+(debugger);
diff --git a/js/src/tests/test262/language/statements/debugger/shell.js b/js/src/tests/test262/language/statements/debugger/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/debugger/shell.js
diff --git a/js/src/tests/test262/language/statements/debugger/statement.js b/js/src/tests/test262/language/statements/debugger/statement.js
new file mode 100644
index 0000000000..8e2a8cd64b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/debugger/statement.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The `debugger` token may occupy a statement position
+esid: sec-debugger-statement
+es6id: 13.16
+---*/
+
+// Expressing within a `while` statement ensures that the `debugger keyword is
+// not erroneously interpreted as a declaration. It also avoids statement
+// evaluation, which is host-defined an may interrupt test execution.
+while (false) debugger;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A1.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A1.js
new file mode 100644
index 0000000000..e64f0f00f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A1.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the production "do Statement while ( Expression )" is evaluated,
+ Statement is evaluated first
+es5id: 12.6.1_A1
+description: Evaluating various Expressions
+---*/
+
+var __in__do;
+
+do __in__do=1; while ( false );
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do!==1) {
+ throw new Test262Error('#1: the inner statement of a do-loop should be evaluated before the expression: false evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+do __in__do=2; while ( 0 );
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__in__do!==2) {
+ throw new Test262Error('#2: the inner statement of a do-loop should be evaluated before the expression: 0 evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+do __in__do=3; while ( "" );
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__in__do!==3) {
+ throw new Test262Error('#3: the inner statement of a do-loop should be evaluated before the expression: "" evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A10.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A10.js
new file mode 100644
index 0000000000..64c23bfb0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A10.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ FunctionExpression within a "do-while" statement is allowed, but no
+ function with the given name will appear in the global context
+es5id: 12.6.1_A10
+description: Also this a test on FunctionExpression
+---*/
+
+var check = 0;
+do {
+ if(typeof(f) === "function"){
+ check = -1;
+ break;
+ } else {
+ check = 1;
+ break;
+ }
+} while(function f(){});
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (check !== 1) {
+ throw new Test262Error('#1: FunctionExpression within a "do-while" statement is allowed, but no function with the given name will appear in the global context');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A11.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A11.js
new file mode 100644
index 0000000000..76852700b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A11.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Block "{}" in a "do-while" Expression is evaluated to true
+es5id: 12.6.1_A11
+description: Checking if execution of "do {} while({})" passes
+---*/
+
+do {
+ var __in__do=1;
+ if(__in__do)break;
+} while({});
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do !== 1) {
+ throw new Test262Error('#1: "{}" in do-while expression evaluates to true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A12.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A12.js
new file mode 100644
index 0000000000..cb4a56be30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A12.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Any statement within "do-while" construction must be a compound
+es5id: 12.6.1_A12
+description: Checking if execution of "do var x=1; var y =2; while (0)" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do var x=1; var y =2; while (0);
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T1.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T1.js
new file mode 100644
index 0000000000..84901de992
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T1.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression within a "do-while" Expression is allowed
+es5id: 12.6.1_A14_T1
+description: >
+ Using FunctionExpression "function __func(){return 0;}" as an
+ Expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+do{
+ var __reached = 1;
+ break;
+}while(function __func(){return 0;});
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__reached !== 1) {
+ throw new Test262Error('#2: function expession inside of do-while expression is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T2.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T2.js
new file mode 100644
index 0000000000..489c70a1e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A14_T2.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression within a "do-while" Expression is allowed
+es5id: 12.6.1_A14_T2
+description: >
+ Using FunctionExpression "function __func(){return 0;}()" as an
+ Expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+do{
+ var __reached = 1;
+ break;
+}while(function __func(){return 0;}());
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__reached !== 1) {
+ throw new Test262Error('#2: function expession inside of do-while expression is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A15.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A15.js
new file mode 100644
index 0000000000..95cae56e65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A15.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Block within a "do-while" Expression is not allowed
+es5id: 12.6.1_A15
+description: Using "{0}" Block as an Expression
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+do{
+ ;
+}while({0});
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A2.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A2.js
new file mode 100644
index 0000000000..cd9c75047a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A2.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ While evaluating "do Statement while ( Expression )", Statement is
+ evaluated first and only after it is done Expression is checked
+es5id: 12.6.1_A2
+description: Evaluating Statement with error Expression
+---*/
+
+var __in__do;
+
+try {
+ do __in__do = "reached"; while (abbracadabra);
+ throw new Test262Error('#1: \'do __in__do = "reached"; while (abbracadabra)\' lead to throwing exception');
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do !== "reached") {
+ throw new Test262Error('#1.1: __in__do === "reached". Actual: __in__do ==='+ __in__do );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A3.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A3.js
new file mode 100644
index 0000000000..2a15fb2ceb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A3.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the production "do Statement while ( Expression )" is evaluated,
+ then (normal, V, empty) is returned
+es5id: 12.6.1_A3
+description: Using eval "eval("do __in__do=1; while (false)")"
+---*/
+
+var __evaluated, __in__do;
+
+__evaluated = eval("do __in__do=1; while (false)");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+if (__in__do !== 1) {
+ throw new Test262Error('#1: __in__do === 1. Actual: __in__do ==='+ __in__do );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== 1) {
+ throw new Test262Error('#2: __evaluated === 1. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T1.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T1.js
new file mode 100644
index 0000000000..e1a7bbb3a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T1.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T1
+description: Using "break" within a "do-while" loop
+---*/
+
+var __in__do__before__break, __in__do__after__break;
+
+do {
+ __in__do__before__break="reached";
+ break;
+ __in__do__after__break="where am i";
+} while(2===1);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do__before__break !== "reached") {
+ throw new Test262Error('#1: __in__do__before__break === "reached". Actual: __in__do__before__break ==='+ __in__do__before__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __in__do__after__break !== "undefined") {
+ throw new Test262Error('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T2.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T2.js
new file mode 100644
index 0000000000..96b89c9678
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T2.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T2
+description: "\"break\" and VariableDeclaration within a \"do-while\" statement"
+---*/
+
+do_out : do {
+ var __in__do__before__break="black";
+ do_in : do {
+ var __in__do__IN__before__break="hole";
+ break do_in;
+ var __in__do__IN__after__break="sun";
+ } while (0);
+ var __in__do__after__break="won't you come";
+} while(2==1);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) {
+ throw new Test262Error('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break) );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T3.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T3.js
new file mode 100644
index 0000000000..033acdc94e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T3.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T3
+description: "\"break\" and VariableDeclaration within a \"do-while\" statement"
+---*/
+
+do_out : do {
+ var __in__do__before__break="once";
+ do_in : do {
+ var __in__do__IN__before__break="in";
+ break do_out;
+ var __in__do__IN__after__break="the";
+ } while (0);
+ var __in__do__after__break="lifetime";
+} while(2===1);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)) {
+ throw new Test262Error('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break) );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T4.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T4.js
new file mode 100644
index 0000000000..b8d50678f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T4.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T4
+description: "\"break\" and VariableDeclaration within a \"do-while\" statement"
+---*/
+
+do_out : do {
+ var __in__do__before__break="reached";
+ do_in : do {
+ var __in__do__IN__before__break="reached";
+ break;
+ var __in__do__IN__after__break="where am i";
+ } while (0);
+ var __in__do__after__break="where am i";
+} while(2===1);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) {
+ throw new Test262Error('#1: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)===true. Actual: (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)==='+ (__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break) );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T5.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T5.js
new file mode 100644
index 0000000000..c844659070
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A4_T5.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "do-while" Statement is allowed and performed as
+ described in 12.8
+es5id: 12.6.1_A4_T5
+description: Using labeled "break" in order to continue a loop
+---*/
+
+var i = 0;
+woohoo:{
+ do {
+ i++;
+ if ( i == 10 ) {
+ break woohoo;
+ throw new Test262Error('#1.1: "break woohoo" must break loop');
+ }
+ } while ( true );
+ throw new Test262Error('This code should be unreacheable');
+}
+assert.sameValue(i, 10);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A5.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A5.js
new file mode 100644
index 0000000000..4ac0097fca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A5.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: After "do-while" is broken, (normal, V, empty) is returned
+es5id: 12.6.1_A5
+description: Using eval
+---*/
+
+var __evaluated, __in__do__before__break, __in__do__after__break;
+
+__evaluated = eval("do {__in__do__before__break=1; break; __in__do__after__break=2;} while(0)");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do__before__break !== 1) {
+ throw new Test262Error('#1: __in__do__before__break === 1. Actual: __in__do__before__break ==='+ __in__do__before__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __in__do__after__break !== "undefined") {
+ throw new Test262Error('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__evaluated !== 1) {
+ throw new Test262Error('#3: __evaluated === 1. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T1.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T1.js
new file mode 100644
index 0000000000..39ca929015
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T1.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T1
+description: Checking if execution of "do{} while 1" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while 1;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T2.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T2.js
new file mode 100644
index 0000000000..8811244140
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T2.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T2
+description: Checking if execution of "do{} while 0" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while 0;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T3.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T3.js
new file mode 100644
index 0000000000..5359a7fdb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T3.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T3
+description: Checking if execution of "do{}while true" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while true;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T4.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T4.js
new file mode 100644
index 0000000000..ee6a831710
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T4.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T4
+description: Checking if execution of "do{}while false" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while false;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T5.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T5.js
new file mode 100644
index 0000000000..f378c8d8ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T5.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T5
+description: Checking if execution of "do{}while ''" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while '';
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T6.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T6.js
new file mode 100644
index 0000000000..11c9eaa4ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A6_T6.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "do-while" IterationStatement is bracketed with braces
+es5id: 12.6.1_A6_T6
+description: Checking if execution of "do{}while 'hood'" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do break; while 'hood';
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A7.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A7.js
new file mode 100644
index 0000000000..b36adeb89d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A7.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The "do-while" Statement is evaluted according to 12.6.1 and returns
+ (normal, V, empty)
+es5id: 12.6.1_A7
+description: Using eval
+---*/
+
+var __evaluated;
+var __condition=0
+
+__evaluated = eval("do eval(\"__condition++\"); while (__condition<5)");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__condition !== 5) {
+ throw new Test262Error('#1: The "do-while" statement is evaluted according to the Standard ');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== 4) {
+ throw new Test262Error('#2: The "do-while" statement returns (normal, V, empty)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A8.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A8.js
new file mode 100644
index 0000000000..4c4c3bc0d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A8.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"continue\" statement within a \"do-while\" Statement is allowed"
+es5id: 12.6.1_A8
+description: Using eval
+---*/
+
+var __evaluated;
+var __condition = 0, __odds=0;
+
+__evaluated = eval("do { __condition++; if (((''+__condition/2).split('.')).length>1) continue; __odds++;} while(__condition < 10)");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__odds !== 5) {
+ throw new Test262Error('#1: __odds === 5. Actual: __odds ==='+ __odds );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== 4) {
+ throw new Test262Error('#2: __evaluated === 4. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/S12.6.1_A9.js b/js/src/tests/test262/language/statements/do-while/S12.6.1_A9.js
new file mode 100644
index 0000000000..2f7797fa22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/S12.6.1_A9.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"do-while\" Statement is evaluated without syntax checks"
+es5id: 12.6.1_A9
+description: Throwing system exception whithin a "do-while" loop
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ do {
+ var x = 1;
+ abaracadabara;
+ } while(0);
+ throw new Test262Error('#1: "abbracadabra" lead to throwing exception');
+
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+
+if (x !== 1) {
+ throw new Test262Error('#1.1: x === 1. Actual: x ==='+ x );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/browser.js b/js/src/tests/test262/language/statements/do-while/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/browser.js
diff --git a/js/src/tests/test262/language/statements/do-while/cptn-abrupt-empty.js b/js/src/tests/test262/language/statements/do-while/cptn-abrupt-empty.js
new file mode 100644
index 0000000000..9a92df2acf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/cptn-abrupt-empty.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.2.6
+description: >
+ Completion value when iteration completes due to an empty abrupt completion
+info: |
+ IterationStatement : do Statement while ( Expression ) ;
+
+ 1. Let V = undefined.
+ 2. Repeat
+ a. Let stmt be the result of evaluating Statement.
+ b. If LoopContinues(stmt, labelSet) is false, return
+ Completion(UpdateEmpty(stmt, V)).
+---*/
+
+assert.sameValue(eval('1; do { break; } while (false)'), undefined);
+assert.sameValue(eval('2; do { 3; break; } while (false)'), 3);
+
+assert.sameValue(eval('4; do { continue; } while (false)'), undefined);
+assert.sameValue(eval('5; do { 6; continue; } while (false)'), 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/cptn-normal.js b/js/src/tests/test262/language/statements/do-while/cptn-normal.js
new file mode 100644
index 0000000000..d7ec585dc9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/cptn-normal.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.2.6
+description: >
+ Completion value when iteration completes due to expression value
+info: |
+ IterationStatement : do Statement while ( Expression ) ;
+
+ 1. Let V = undefined.
+ 2. Repeat
+ a. Let stmt be the result of evaluating Statement.
+ b. If LoopContinues(stmt, labelSet) is false, return
+ Completion(UpdateEmpty(stmt, V)).
+ c. If stmt.[[value]] is not empty, let V = stmt.[[value]].
+ d. Let exprRef be the result of evaluating Expression.
+ e. Let exprValue be GetValue(exprRef).
+ f. ReturnIfAbrupt(exprValue).
+ g. If ToBoolean(exprValue) is false, return NormalCompletion(V).
+---*/
+
+assert.sameValue(eval('1; do { } while (false)'), undefined);
+assert.sameValue(eval('2; do { 3; } while (false)'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/do-while/decl-async-fun.js b/js/src/tests/test262/language/statements/do-while/decl-async-fun.js
new file mode 100644
index 0000000000..52c1ba75de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-async-fun.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-do-while-statement
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+do async function f() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-async-gen.js b/js/src/tests/test262/language/statements/do-while/decl-async-gen.js
new file mode 100644
index 0000000000..1315a2e7ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-async-gen.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-do-while-statement
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+do async function* g() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-cls.js b/js/src/tests/test262/language/statements/do-while/decl-cls.js
new file mode 100644
index 0000000000..401d86cc0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-cls.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do class C {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-const.js b/js/src/tests/test262/language/statements/do-while/decl-const.js
new file mode 100644
index 0000000000..d60a5a45cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-const.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do const x = null; while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-fun.js b/js/src/tests/test262/language/statements/do-while/decl-fun.js
new file mode 100644
index 0000000000..66395ee5cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-fun.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Function declaration not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do function f() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-gen.js b/js/src/tests/test262/language/statements/do-while/decl-gen.js
new file mode 100644
index 0000000000..2a716ad42c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+do function* g() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/decl-let.js b/js/src/tests/test262/language/statements/do-while/decl-let.js
new file mode 100644
index 0000000000..96d3a7da14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/decl-let.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-do-while-statement
+es6id: 13.7.2
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do let x; while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/labelled-fn-stmt.js b/js/src/tests/test262/language/statements/do-while/labelled-fn-stmt.js
new file mode 100644
index 0000000000..cdbb8b5efe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/labelled-fn-stmt.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+do label1: label2: function f() {} while (false)
diff --git a/js/src/tests/test262/language/statements/do-while/let-array-with-newline.js b/js/src/tests/test262/language/statements/do-while/let-array-with-newline.js
new file mode 100644
index 0000000000..5432938f52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/let-array-with-newline.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-do-while-statement
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+do let
+[x] = 0
+while (false);
diff --git a/js/src/tests/test262/language/statements/do-while/shell.js b/js/src/tests/test262/language/statements/do-while/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/do-while/tco-body-strict.js b/js/src/tests/test262/language/statements/do-while/tco-body-strict.js
new file mode 100644
index 0000000000..9db9f3abd9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/do-while/tco-body-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ do {
+ return f(n - 1);
+ } while (false)
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/empty/S12.3_A1.js b/js/src/tests/test262/language/statements/empty/S12.3_A1.js
new file mode 100644
index 0000000000..793c4a9551
--- /dev/null
+++ b/js/src/tests/test262/language/statements/empty/S12.3_A1.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production EmptyStatement ; is evaluated as follows Return (normal,
+ empty, empty)
+es5id: 12.3_A1
+description: Using EmptyStatement ;
+---*/
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;; ;;;;;; ;; ;; ;;;;;; ;;;;;;;; ;; ;; ;;;;;
+;;;;; ;; ;;;; ;;;; ;; ;; ;; ;; ;; ;;;;;
+;;;;; ;;;; ;; ;;;; ;; ;;;;;; ;; ;;;; ;;;;;
+;;;;; ;; ;; ;; ;; ;; ;; ;; ;;;;;
+;;;;; ;;;;;; ;; ;; ;; ;; ;; ;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/empty/browser.js b/js/src/tests/test262/language/statements/empty/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/empty/browser.js
diff --git a/js/src/tests/test262/language/statements/empty/cptn-value.js b/js/src/tests/test262/language/statements/empty/cptn-value.js
new file mode 100644
index 0000000000..d8acf25766
--- /dev/null
+++ b/js/src/tests/test262/language/statements/empty/cptn-value.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-empty-statement-runtime-semantics-evaluation
+es6id: 13.4.1
+description: Returns an empty completion
+info: |
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.sameValue(eval(';'), undefined);
+assert.sameValue(eval('2;;'), 2);
+assert.sameValue(eval('3;;;'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/empty/shell.js b/js/src/tests/test262/language/statements/empty/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/empty/shell.js
diff --git a/js/src/tests/test262/language/statements/expression/S12.4_A1.js b/js/src/tests/test262/language/statements/expression/S12.4_A1.js
new file mode 100644
index 0000000000..5e51babb1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/expression/S12.4_A1.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ An ExpressionStatement can not start with the function keyword because
+ that might make it ambiguous with a FunctionDeclaration
+es5id: 12.4_A1
+description: Checking if execution of "function(){}()" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+function(){}();
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/expression/S12.4_A2_T1.js b/js/src/tests/test262/language/statements/expression/S12.4_A2_T1.js
new file mode 100644
index 0000000000..352e4b7f02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/expression/S12.4_A2_T1.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production ExpressionStatement : [lookahead \notin {{, function}] Expression; is evaluated as follows:
+ 1. Evaluate Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Return (normal, Result(2), empty)
+es5id: 12.4_A2_T1
+description: Checking by using eval "(eval("x+1+x==1"))"
+---*/
+
+var x, __evaluated;
+
+x=1;
+
+__evaluated = eval("x+1+x==1");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__evaluated !== false) {
+ throw new Test262Error('#1: __evaluated === false. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__evaluated = eval("1+1+1==1");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== false) {
+ throw new Test262Error('#2: __evaluated === false. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/expression/S12.4_A2_T2.js b/js/src/tests/test262/language/statements/expression/S12.4_A2_T2.js
new file mode 100644
index 0000000000..0d423346ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/expression/S12.4_A2_T2.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production ExpressionStatement : [lookahead \notin {{, function}] Expression; is evaluated as follows:
+ 1. Evaluate Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Return (normal, Result(2), empty)
+es5id: 12.4_A2_T2
+description: Checking by using eval(eval(x), where x is any string)
+---*/
+
+var x, __evaluated;
+
+x="5+1|0===0";
+
+__evaluated = eval(x);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__evaluated !== 7) {
+ throw new Test262Error('#1: __evaluated === 7. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__evaluated = eval("2*"+x+">-1");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== 11) {
+ throw new Test262Error('#2: __evaluated === 11. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/expression/browser.js b/js/src/tests/test262/language/statements/expression/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/expression/browser.js
diff --git a/js/src/tests/test262/language/statements/expression/shell.js b/js/src/tests/test262/language/statements/expression/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/expression/shell.js
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-from-sync-iterator-continuation-abrupt-completion-get-constructor.js b/js/src/tests/test262/language/statements/for-await-of/async-from-sync-iterator-continuation-abrupt-completion-get-constructor.js
new file mode 100644
index 0000000000..132f8e80f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-from-sync-iterator-continuation-abrupt-completion-get-constructor.js
@@ -0,0 +1,55 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncfromsynciteratorcontinuation
+description: >
+ Reject promise when PromiseResolve in AsyncFromSyncIteratorContinuation throws.
+info: |
+ 25.1.4.4 AsyncFromSyncIteratorContinuation ( result, promiseCapability )
+ ...
+ 5. Let valueWrapper be PromiseResolve(%Promise%, « value »).
+ 6. IfAbruptRejectPromise(valueWrapper, promiseCapability).
+ ...
+
+includes: [compareArray.js]
+flags: [async]
+features: [async-iteration]
+---*/
+
+var expected = [
+ "start",
+
+ // `valueWrapper` promise rejected.
+ "tick 1",
+
+ // `Await(nextResult)` in 13.7.5.13 done.
+ "tick 2",
+
+ // catch handler executed.
+ "catch",
+];
+
+var actual = [];
+
+async function f() {
+ var p = Promise.resolve(0);
+ Object.defineProperty(p, "constructor", {
+ get() {
+ throw new Error();
+ }
+ });
+ actual.push("start");
+ for await (var x of [p]);
+ actual.push("never reached");
+}
+
+Promise.resolve(0)
+ .then(() => actual.push("tick 1"))
+ .then(() => actual.push("tick 2"))
+ .then(() => {
+ assert.compareArray(actual, expected);
+}).then($DONE, $DONE);
+
+f().catch(() => actual.push("catch"));
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-assignment.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-assignment.js
new file mode 100644
index 0000000000..d9f6199e3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-assignment.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-assignment.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let v2, vNull, vHole, vUndefined, vOob;
+
+let iterCount = 0;
+async function fn() {
+ for await ([v2 = 10, vNull = 11, vHole = 12, vUndefined = 13, vOob = 14] of [[2, null, , undefined]]) {
+ assert.sameValue(v2, 2);
+ assert.sameValue(vNull, null);
+ assert.sameValue(vHole, 12);
+ assert.sameValue(vUndefined, 13);
+ assert.sameValue(vOob, 14);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-evaluation.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-evaluation.js
new file mode 100644
index 0000000000..10584a9fd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-evaluation.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-evaluation.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The Initializer should only be evaluated if v is undefined. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let flag1 = false, flag2 = false;
+let _;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ _ = flag1 = true, _ = flag2 = true ] of [[14]]) {
+ assert.sameValue(flag1, false);
+ assert.sameValue(flag2, true);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-arrow.js
new file mode 100644
index 0000000000..47b71f01a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-arrow.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-arrow.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (ArrowFunction) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let arrow;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ arrow = () => {} ] of [[]]) {
+ verifyProperty(arrow, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'arrow'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-class.js
new file mode 100644
index 0000000000..b448a69d86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-class.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-class.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (ClassExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let xCls, cls, xCls2;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } ] of [[]]) {
+ assert(xCls.name !== 'xCls');
+ assert(xCls2.name !== 'xCls2');
+
+ verifyProperty(cls, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cls'
+ });
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-cover.js
new file mode 100644
index 0000000000..4a83164729
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-cover.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-cover.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (CoverParenthesizedExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let xCover, cover;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ xCover = (0, function() {}), cover = (function() {}) ] of [[]]) {
+ assert(xCover.name !== 'xCover');
+
+ verifyProperty(cover, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cover'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-fn.js
new file mode 100644
index 0000000000..62dc6819e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-fn.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-fn.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (FunctionExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let xFnexp, fnexp;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ xFnexp = function x() {}, fnexp = function() {} ] of [[]]) {
+ assert(xFnexp.name !== 'xFnexp');
+
+ verifyProperty(fnexp, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'fnexp'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-gen.js
new file mode 100644
index 0000000000..be35a917b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-fn-name-gen.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-gen.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (GeneratorExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let xGen, gen;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ xGen = function* x() {}, gen = function*() {} ] of [[]]) {
+ assert.notSameValue(xGen.name, 'xGen');
+
+ verifyProperty(gen, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'gen'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-in.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-in.js
new file mode 100644
index 0000000000..15a9714702
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-in.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-in.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The Initializer in an AssignmentElement may be an `in` expression. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ x = 'x' in {} ] of [[]]) {
+ assert.sameValue(x, false);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-order.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-order.js
new file mode 100644
index 0000000000..5676cf70e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-order.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-order.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Initializer values should be assigned in left-to-right order. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = 0;
+let a, b;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ a = x += 1, b = x *= 2 ] of [[]]) {
+ assert.sameValue(a, 1);
+ assert.sameValue(b, 2);
+ assert.sameValue(x, 2);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-simple-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-simple-no-strict.js
new file mode 100644
index 0000000000..b8da6c954f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-simple-no-strict.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-simple-no-strict.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let argument, eval;
+
+let iterCount = 0;
+async function fn() {
+ for await ([arguments = 4, eval = 5] of [[]]) {
+ assert.sameValue(arguments, 4);
+ assert.sameValue(eval, 5);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..370cf97c5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-yield-ident-invalid-strict.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-yield-ident-invalid.case
+// - src/dstr-assignment-for-await/error-async-function-syntax/async-func-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+async function fn() {
+ for await ([ x = yield ] of [[]]) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-yield-ident-valid.js
new file mode 100644
index 0000000000..47d5619581
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-init-yield-ident-valid.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 4;
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ x = yield ] of [[]]) {
+ assert.sameValue(x, 4);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-iter-nrml-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-iter-nrml-close.js
new file mode 100644
index 0000000000..238119431d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-iter-nrml-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-iter-nrml-close.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: IteratorClose is called when assignment evaluation has not exhausted the iterator (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
+ 5. Return result.
+
+ 7.4.6 IteratorClose ( iterator, completion )
+
+ [...]
+ 5. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let thisValue = null;
+let args = null;
+let _;
+let iterable = {};
+let iterator = {
+ next() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+let iterCount = 0;
+async function fn() {
+ for await ([ _ ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-invalid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-invalid.js
new file mode 100644
index 0000000000..bbbd8f0805
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-invalid.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-invalid.case
+// - src/dstr-assignment-for-await/error-async-function-syntax/async-func-decl.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+async function fn() {
+ for await ([[(x, y)]] of [[[]]]) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-null.js
new file mode 100644
index 0000000000..eb8b410368
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-null.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-null.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is `null`, a TypeError should be thrown. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let _;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ([[ _ ]] of [[null]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined-hole.js
new file mode 100644
index 0000000000..913138eb2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined-hole.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-undefined-hole.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is a "hole", a TypeError should be thrown. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let _;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ([[ _ ]] of [[ , ]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined-own.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined-own.js
new file mode 100644
index 0000000000..6bada38c5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined-own.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-undefined-own.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is `undefined`, a TypeError should be thrown. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let _;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ([[ x ]] of [[undefined]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined.js
new file mode 100644
index 0000000000..d688ad3a4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-undefined.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-undefined.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and no value is defined, a TypeError should be thrown. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let _;
+
+let iterCount = 0;
+async function fn() {
+ for await ([[ x ]] of [[]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..c733558621
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-yield-ident-invalid-strict.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-yield-ident-invalid.case
+// - src/dstr-assignment-for-await/error-async-function-syntax/async-func-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+async function fn() {
+ for await ([[x[yield]]] of [[[]]]) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-yield-ident-valid.js
new file mode 100644
index 0000000000..e17d7978db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array-yield-ident-valid.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 'prop';
+let x = {};
+
+let iterCount = 0;
+async function fn() {
+ for await ([[x[yield]]] of [[[22]]]) {
+ assert.sameValue(x.prop, 22);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array.js
new file mode 100644
index 0000000000..5ceb6c4785
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-array.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([[x]] of [[[1]]]) {
+ assert.sameValue(x, 1);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-invalid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-invalid.js
new file mode 100644
index 0000000000..199ea6ddc1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-invalid.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-invalid.case
+// - src/dstr-assignment-for-await/error-async-function-syntax/async-func-decl.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+async function fn() {
+ for await ([{ get x() {} }] of [[{}]]) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-null.js
new file mode 100644
index 0000000000..6986b9d0bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-null.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-null.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is `null`, a TypeError should be thrown. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([{ x }] of [[null]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined-hole.js
new file mode 100644
index 0000000000..5cca476000
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined-hole.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-undefined-hole.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is a "hole", a TypeError should be thrown. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ([{ x }] of [[ , ]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined-own.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined-own.js
new file mode 100644
index 0000000000..e2c68273a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined-own.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-undefined-own.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is `undefined`, a TypeError should be thrown. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ([{ x }] of [[undefined]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined.js
new file mode 100644
index 0000000000..7592b67c7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-undefined.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-undefined.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and no value is defined, a TypeError should be thrown. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ([{ x }] of [[]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..5f4b574b53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-yield-ident-invalid-strict.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-yield-ident-invalid.case
+// - src/dstr-assignment-for-await/error-async-function-syntax/async-func-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment outside of a generator function body, it behaves as a IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+async function fn() {
+ for await ([{ x = yield }] of [[{}]]) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-yield-ident-valid.js
new file mode 100644
index 0000000000..2d4d252280
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj-yield-ident-valid.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment outside of a generator function body, it behaves as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 2;
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([{ x = yield }] of [[{}]]) {
+ assert.sameValue(x, 2);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj.js
new file mode 100644
index 0000000000..78b632797f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-nested-obj.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([{ x }] of [[{ x: 2 }]]) {
+ assert.sameValue(x, 2);
+
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-const.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-const.js
new file mode 100644
index 0000000000..6aa0f9f4dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-const.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-const.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The assignment target should obey `const` semantics. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [const, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+const c = null;
+
+let iterCount = 0;
+async function fn() {
+ for await ([ c ] of [[1]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref-no-get.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref-no-get.js
new file mode 100644
index 0000000000..5f167e380c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref-no-get.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-prop-ref-no-get.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, setValue;
+x = {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+};
+
+let iterCount = 0;
+async function fn() {
+ for await ([x.y] of [[23]]) {
+ assert.sameValue(setValue, 23);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref-user-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref-user-err.js
new file mode 100644
index 0000000000..5fd9a391ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref-user-err.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-prop-ref-user-err.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Any error raised as a result of setting the value should be forwarded to the runtime. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {
+ set y(val) {
+ throw new Test262Error();
+ }
+};
+
+let iterCount = 0;
+async function fn() {
+ for await ([x.y] of [[23]
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, Test262Error);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref.js
new file mode 100644
index 0000000000..8820acde6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-prop-ref.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-prop-ref.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {};
+
+let iterCount = 0;
+async function fn() {
+ for await ([x.y] of [[4]]) {
+ assert.sameValue(x.y, 4);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..a0adcc8f9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-unresolvable-no-strict.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-unresolvable-no-strict.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ([ unresolvable ] of [[]]) {
+ assert.sameValue(unresolvable, undefined);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-unresolvable-strict-strict.js
new file mode 100644
index 0000000000..06f7890500
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-put-unresolvable-strict-strict.js
@@ -0,0 +1,44 @@
+// |reftest| async
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-unresolvable-strict.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, onlyStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ([ unresolvable ] of [[]
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, ReferenceError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-identifier.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-identifier.js
new file mode 100644
index 0000000000..f666630b8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-identifier.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-target-identifier.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, y, z;
+
+let iterCount = 0;
+async function fn() {
+ for await ([x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-simple-strict-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-simple-strict-strict.js
new file mode 100644
index 0000000000..aafbf570a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-simple-strict-strict.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-target-simple-strict.case
+// - src/dstr-assignment-for-await/error-async-function-syntax/async-func-decl.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is false. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+async function fn() {
+ for await ([arguments] of [[]]) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-yield-invalid-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-yield-invalid-strict.js
new file mode 100644
index 0000000000..4f444fcbd2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-yield-invalid-strict.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-target-yield-invalid.case
+// - src/dstr-assignment-for-await/error-async-function-syntax/async-func-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it behaves as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+async function fn() {
+ for await ([ x[yield] ] of [[]]) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-yield-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-yield-valid.js
new file mode 100644
index 0000000000..b47dfa58f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-yield-valid.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-target-yield-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 'prop';
+let x = {};
+
+let iterCount = 0;
+async function fn() {
+ for await ([ x[yield] ] of [[33]]) {
+ assert.sameValue(x.prop, 33);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-null.js
new file mode 100644
index 0000000000..4ef1ff107c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-null.js
@@ -0,0 +1,85 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-elision-iter-nrml-close-null.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 6. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+ [...]
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+ 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
+ exception.
+
+---*/
+let x;
+let nextCount = 0;
+let iterator = {
+ next() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ return null;
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+
+let iterCount = 0;
+async function fn() {
+ for await ([ x , , ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(nextCount, 2);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elision-val-array.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elision-val-array.js
new file mode 100644
index 0000000000..8a1e62fdc3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elision-val-array.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elision-val-array.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ([,] of [[]
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elision-val-string.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elision-val-string.js
new file mode 100644
index 0000000000..f56014a5b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-elision-val-string.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elision-val-string.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ([,] of ['string literal'
+
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-empty-val-array.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-empty-val-array.js
new file mode 100644
index 0000000000..3bae15002d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-empty-val-array.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-empty-val-array.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ([] of [[]
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-empty-val-string.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-empty-val-string.js
new file mode 100644
index 0000000000..da8449375d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-empty-val-string.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-empty-val-string.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ([] of ['string literal'
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-after-element.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-after-element.js
new file mode 100644
index 0000000000..e6443e2206
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-after-element.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-after-element.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An AssignmentRestElement following an AssignmentElement consumes all remaining iterable values. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, y;
+
+let iterCount = 0;
+async function fn() {
+ for await ([x, ...y] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y.length, 2);
+ assert.sameValue(y[0], 2);
+ assert.sameValue(y[1], 3);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-after-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-after-elision.js
new file mode 100644
index 0000000000..2804426bba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-after-elision.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-after-elision.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An AssignmentRestElement following an elision consumes all remaining iterable values. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([, ...x] of [[1, 2, 3]]) {
+ assert.sameValue(x.length, 2);
+ assert.sameValue(x[0], 2);
+ assert.sameValue(x[1], 3);
+
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-elision.js
new file mode 100644
index 0000000000..f4e946849d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-elision.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-elision.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: ArrayAssignmentPattern may include elisions at any position preceding a AssignmentRestElement in a AssignmentElementList. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, y;
+
+let iterCount = 0;
+async function fn() {
+ for await ([, , x, , ...y] of [[1, 2, 3, 4, 5, 6]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y.length, 2);
+ assert.sameValue(y[0], 5);
+ assert.sameValue(y[1], 6);
+
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-iteration.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-iteration.js
new file mode 100644
index 0000000000..48802ac3f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-iteration.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-iteration.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: In the presense of an AssignmentRestElement, value iteration exhausts the iterable value; (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let count = 0;
+let g = function*() {
+ count += 1;
+ yield;
+ count += 1;
+ yield;
+ count += 1;
+}
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...x] of [g()]) {
+ assert.sameValue(count, 3);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-null.js
new file mode 100644
index 0000000000..08606b68d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-null.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-null.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable emits `null` as the only value, an array with a single `null` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, y;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...[x, y]] of [[null]]) {
+ assert.sameValue(x, null);
+ assert.sameValue(y, undefined);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined-hole.js
new file mode 100644
index 0000000000..342c884fb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined-hole.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-undefined-hole.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable is an array with a "hole", an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...[x]] of [[ , ]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined-own.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined-own.js
new file mode 100644
index 0000000000..dbd04e18ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined-own.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-undefined-own.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable emits `undefined` as the only value, an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...[x]] of [[undefined]]) {
+ assert.sameValue(x, undefined);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined.js
new file mode 100644
index 0000000000..8c98ddc93f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-undefined.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-undefined.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable is emits no values, an empty array should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...[x]] of [[]]) {
+ assert.sameValue(x, undefined);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-yield-ident-valid.js
new file mode 100644
index 0000000000..d9372d0a72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array-yield-ident-valid.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 'prop';
+let x = {};
+
+let iterCount = 0;
+async function fn() {
+ for await ([...[x[yield]]] of [[86]]) {
+ assert.sameValue(x.prop, 86);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array.js
new file mode 100644
index 0000000000..56fc56585f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-array.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...[x]] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-null.js
new file mode 100644
index 0000000000..02a920044f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-null.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-null.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the iterable emits `null` as the only value, an array with a single `null` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, length;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...{ 0: x, length }] of [[null]]) {
+ assert.sameValue(x, null);
+ assert.sameValue(length, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined-hole.js
new file mode 100644
index 0000000000..0879e1803b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined-hole.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-undefined-hole.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable is an array with a "hole", an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
+// where length and name are properties of WindowProxy
+let length;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...{ 0: x, length }] of [[ , ]]) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(length, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined-own.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined-own.js
new file mode 100644
index 0000000000..64ef636388
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined-own.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-undefined-own.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable emits `undefined` as the only value, an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
+// where length and name are properties of WindowProxy
+let length;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...{ 0: x, length }] of [[undefined]]) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(length, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined.js
new file mode 100644
index 0000000000..cf07d69030
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-undefined.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-undefined.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an obect literal and the iterable is emits no values, an empty array should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
+// where length and name are properties of WindowProxy
+let length;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...{ 0: x, length }] of [[]]) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(length, 0);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-yield-ident-valid.js
new file mode 100644
index 0000000000..8e32afb31e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj-yield-ident-valid.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 2;
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...{ x = yield }] of [[{}]]) {
+ assert.sameValue(x, 2);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj.js
new file mode 100644
index 0000000000..02dac3a16f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-nested-obj.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ([...{ 1: x }] of [[1, 2, 3]]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-prop-ref-no-get.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-prop-ref-no-get.js
new file mode 100644
index 0000000000..20fd6eb688
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-prop-ref-no-get.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-put-prop-ref-no-get.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let setValue;
+let x = {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+};
+
+let iterCount = 0;
+async function fn() {
+ for await ([...x.y] of [[23, 45, 99]]) {
+ assert.sameValue(setValue.length, 3);
+ assert.sameValue(setValue[0], 23);
+ assert.sameValue(setValue[1], 45);
+ assert.sameValue(setValue[2], 99);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-prop-ref.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-prop-ref.js
new file mode 100644
index 0000000000..1b85b75ce0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-prop-ref.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-put-prop-ref.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {};
+
+let iterCount = 0;
+async function fn() {
+ for await ([...x.y] of [[4, 3, 2]]) {
+ assert.sameValue(x.y.length, 3);
+ assert.sameValue(x.y[0], 4);
+ assert.sameValue(x.y[1], 3);
+ assert.sameValue(x.y[2], 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..d3537fc3f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-put-unresolvable-no-strict.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-put-unresolvable-no-strict.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ([ ...unresolvable ] of [[]]) {
+ assert.sameValue(unresolvable.length, 0);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-yield-ident-valid.js
new file mode 100644
index 0000000000..6774bfd24c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-array-rest-yield-ident-valid.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentRestElement and outside of a generator function body, it should behave as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 'prop';
+let x = {};
+
+let iterCount = 0;
+async function fn() {
+ for await ([...x[yield]] of [[33, 44, 55]]) {
+ assert.sameValue(x.prop.length, 3);
+ assert.sameValue(x.prop[0], 33);
+ assert.sameValue(x.prop[1], 44);
+ assert.sameValue(x.prop[2], 55);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-bool.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-bool.js
new file mode 100644
index 0000000000..11559a1ad8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-bool.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-bool.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (boolean value) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ({} of [false]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-num.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-num.js
new file mode 100644
index 0000000000..545d619e56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-num.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-num.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (number value) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ({} of [0
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-obj.js
new file mode 100644
index 0000000000..bf0a73d59b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-obj.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-obj.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (object value) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ({} of [{}]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-string.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-string.js
new file mode 100644
index 0000000000..bae132d096
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-string.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-string.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (string value) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function fn() {
+ for await ({} of ['']) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-symbol.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-symbol.js
new file mode 100644
index 0000000000..cc882e7bff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-empty-symbol.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-symbol.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (symbol value) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let s = Symbol();
+
+let iterCount = 0;
+async function fn() {
+ for await ({} of [s]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-first.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-first.js
new file mode 100644
index 0000000000..1984d5d48e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-first.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-first.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (first of many) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let y;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x, y } of [{ x: 3 }]) {
+ assert.sameValue(x, 3);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-last.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-last.js
new file mode 100644
index 0000000000..2462d21723
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-last.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-last.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (last of many) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let w;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ w, x } of [{ x: 4 }]) {
+ assert.sameValue(x, 4);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-lone.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-lone.js
new file mode 100644
index 0000000000..0f3e520df7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-lone.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-lone.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone identifier) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x, } of [{ x: 2 }]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-middle.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-middle.js
new file mode 100644
index 0000000000..138a134e48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-middle.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-middle.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (within many) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let w, y;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ w, x, y } of [{ x: 5 }]) {
+ assert.sameValue(x, 5);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-trlng.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-trlng.js
new file mode 100644
index 0000000000..20036be82b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-identifier-resolution-trlng.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-trlng.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone identifier with trailing comma) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x } of [{ x: 1 }]) {
+ assert.sameValue(x, 1);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-missing.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-missing.js
new file mode 100644
index 0000000000..cf28c8fb0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-missing.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-assignment-missing.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (no corresponding property defined). (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x = 1 } of [{}]) {
+ assert.sameValue(x, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-null.js
new file mode 100644
index 0000000000..f1dde95c25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-null.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-assignment-null.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (null property value defined). (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x = 1 } of [{ x: null }]) {
+ assert.sameValue(x, null);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-truthy.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-truthy.js
new file mode 100644
index 0000000000..4418fcbc33
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-truthy.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-assignment-truthy.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (truthy property value defined). (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x = 1 } of [{ x: 2 }]) {
+ assert.sameValue(x, 2);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-undef.js
new file mode 100644
index 0000000000..df2ba6cb76
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-assignment-undef.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-assignment-undef.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference ("undefined" property value defined). (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x = 1 } of [{ x: undefined }]) {
+ assert.sameValue(x, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-evaluation.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-evaluation.js
new file mode 100644
index 0000000000..aabc0a8742
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-evaluation.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-evaluation.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The Initializer should only be evaluated if v is undefined. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let flag1 = false;
+let flag2 = false;
+let x, y;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x = flag1 = true, y = flag2 = true } of [{ y: 1 }]) {
+ assert.sameValue(flag1, true);
+ assert.sameValue(flag2, false);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..b9ba69c7e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-arrow.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-arrow.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (ArrowFunction) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let arrow;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ arrow = () => {} } of [{}]) {
+ verifyProperty(arrow, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'arrow'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-class.js
new file mode 100644
index 0000000000..00d16aa4ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-class.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-class.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (ClassExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let xCls, cls, xCls2;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } } of [{}]) {
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ verifyProperty(cls, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cls'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2e6d0dad01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-cover.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-cover.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (CoverParenthesizedExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let xCover, cover;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ xCover = (0, function() {}), cover = (function() {}) } of [{}]) {
+ assert.notSameValue(xCover.name, 'xCover');
+
+ verifyProperty(cover, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cover'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..cec9dec8fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-fn.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-fn.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (FunctionExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let xFnexp, fnexp;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ xFnexp = function x() {}, fnexp = function() {} } of [{}]) {
+ assert.notSameValue(xFnexp.name, 'xFnexp');
+
+ verifyProperty(fnexp, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'fnexp'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..5abb352ff1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-fn-name-gen.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-gen.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (GeneratorExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let xGen, gen;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ xGen = function* x() {}, gen = function*() {} } of [{}]) {
+ assert.notSameValue(xGen.name, 'xGen');
+
+ verifyProperty(gen, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'gen'
+ });
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-in.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-in.js
new file mode 100644
index 0000000000..4c83f67d5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-in.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-in.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The Initializer in an AssignmentProperty may be an `in` expression. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let prop;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ prop = 'x' in {} } of [{}]) {
+ assert.sameValue(prop, false);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-order.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-order.js
new file mode 100644
index 0000000000..dc4f34f859
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-order.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-order.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Initializer values should be assigned in left-to-right order. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = 0;
+let a, b;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ a = x += 1, b = x *= 2 } of [{}]) {
+ assert.sameValue(a, 1);
+ assert.sameValue(b, 2);
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-simple-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-simple-no-strict.js
new file mode 100644
index 0000000000..fa798ee61e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-simple-no-strict.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-simple-no-strict.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let eval, arguments;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ eval = 3, arguments = 4 } of [{}]) {
+ assert.sameValue(eval, 3);
+ assert.sameValue(arguments, 4);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-yield-ident-valid.js
new file mode 100644
index 0000000000..69b6631586
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-init-yield-ident-valid.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentProperty and outside of a generator function body, it should behave as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 3;
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x = yield } of [{}]) {
+ assert.sameValue(x, 3);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..e98e99ea9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-put-unresolvable-no-strict.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-put-unresolvable-no-strict.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+{
+
+let iterCount = 0;
+async function fn() {
+ for await ({ unresolvable } of [{}]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => {
+ assert.sameValue(unresolvable, undefined);
+ assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+ }, $DONE)
+ .then($DONE, $DONE);
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-simple-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-simple-no-strict.js
new file mode 100644
index 0000000000..0ca0171f9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-id-simple-no-strict.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-simple-no-strict.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let eval;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ eval } of [{ eval: 1 }]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => {
+ assert.sameValue(eval, 1);
+ assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+ }, $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-missing.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-missing.js
new file mode 100644
index 0000000000..81ee5d33e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-missing.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-assignment-missing.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (non-existent property) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ y: x = 1 } of [{}]) {
+ assert.sameValue(x, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-null.js
new file mode 100644
index 0000000000..34c9d3923f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-null.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-assignment-null.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the Initializer is present and v is not undefined, the Initializer should be evaluated and the result assigned to the target reference (null value) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ y: x = 1 } of [{ y: null }]) {
+ assert.sameValue(x, null);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-truthy.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-truthy.js
new file mode 100644
index 0000000000..9f509fca1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-truthy.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-assignment-truthy.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the Initializer is present and v is not undefined, the Initializer should be evaluated and the result assigned to the target reference (truthy value) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ y: x = 1 } of [{ y: 2 }]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-undef.js
new file mode 100644
index 0000000000..62bca21f4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-assignment-undef.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-assignment-undef.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (undefined value) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ y: x = 1 } of [{ y: undefined }]) {
+ assert.sameValue(x, 1);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-evaluation.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-evaluation.js
new file mode 100644
index 0000000000..71e8d2c189
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-evaluation.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-evaluation.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The Initializer should only be evaluated if v is undefined. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let flag1 = false;
+let flag2 = false;
+let x, y;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: x = flag1 = true, y: y = flag2 = true } of [{ y: 1 }]) {
+ assert.sameValue(x, true, 'value of `x`');
+ assert.sameValue(flag1, true, 'value of `flag1`');
+ assert.sameValue(y, 1, 'value of `y`');
+ assert.sameValue(flag2, false, 'value of `flag2`');
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-arrow.js
new file mode 100644
index 0000000000..b64e025e55
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-arrow.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-arrow.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (ArrowFunction) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let arrow;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: arrow = () => {} } of [{}]) {
+ verifyProperty(arrow, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'arrow'
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-class.js
new file mode 100644
index 0000000000..e18bfb47f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-class.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-class.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (ClassExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let xCls, cls, xCls2;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: xCls = class x {}, x: cls = class {}, x: xCls2 = class { static name() {} } } of [{}]) {
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ verifyProperty(cls, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cls'
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-cover.js
new file mode 100644
index 0000000000..fec8257e89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-cover.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-cover.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (CoverParenthesizedExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let xCover, cover;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: xCover = (0, function() {}), x: cover = (function() {}) } of [{}]) {
+ assert.notSameValue(xCover.name, 'xCover');
+
+ verifyProperty(cover, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cover'
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-fn.js
new file mode 100644
index 0000000000..db0ef4055f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-fn.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-fn.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (FunctionExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let xFnexp, fnexp;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: xFnexp = function x() {}, x: fnexp = function() {} } of [{}]) {
+ assert.notSameValue(xFnexp.name, 'xFnexp');
+
+ verifyProperty(fnexp, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'fnexp'
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-gen.js
new file mode 100644
index 0000000000..720fa3e05f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-fn-name-gen.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-gen.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Assignment of function `name` attribute (GeneratorExpression) (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let xGen, gen;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: xGen = function* x() {}, x: gen = function*() {} } of [{}]) {
+ assert.notSameValue(xGen.name, 'xGen');
+
+ verifyProperty(gen, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'gen'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-in.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-in.js
new file mode 100644
index 0000000000..6185a66bd2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-in.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-in.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The Initializer in an AssignmentElement may be an `in` expression. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let prop;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: prop = 'x' in {} } of [{}]) {
+ assert.sameValue(prop, false);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-yield-ident-valid.js
new file mode 100644
index 0000000000..4685795345
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-init-yield-ident-valid.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 4;
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: x = yield } of [{}]) {
+ assert.sameValue(x, 4);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-target-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-target-yield-ident-valid.js
new file mode 100644
index 0000000000..a22c6ec7e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-elem-target-yield-ident-valid.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-target-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 'prop';
+let x = {};
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: x[yield] } of [{ x: 23 }]) {
+ assert.sameValue(x.prop, 23);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-first.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-first.js
new file mode 100644
index 0000000000..8c29dcea97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-first.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-first.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (first of many). (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let y;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ a: x, y } of [{ a: 3 }]) {
+ assert.sameValue(x, 3);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-last.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-last.js
new file mode 100644
index 0000000000..70d4939c28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-last.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-last.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (last of many). (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let w;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ w, a: x } of [{ a: 4 }]) {
+ assert.sameValue(x, 4);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-lone.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-lone.js
new file mode 100644
index 0000000000..3d5ab19eb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-lone.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-lone.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone element). (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ a: x } of [{ a: 1 }]) {
+ assert.sameValue(x, 1);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-middle.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-middle.js
new file mode 100644
index 0000000000..a04952f5ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-middle.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-middle.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (within many). (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let w, y;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ w, a: x, y } of [{ a: 5 }]) {
+ assert.sameValue(x, 5);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-trlng.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-trlng.js
new file mode 100644
index 0000000000..5a63f61ac1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-identifier-resolution-trlng.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-trlng.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone element with trailing comma). (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ a: x, } of [{ a: 2 }]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-name-evaluation.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-name-evaluation.js
new file mode 100644
index 0000000000..5265532217
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-name-evaluation.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-name-evaluation.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: PropertyName of an AssignmentProperty may be a ComputedPropertyName. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, y, xy;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ ['x' + 'y']: x } of [{ x: 1, xy: 23, y: 2 }]) {
+ assert.sameValue(x, 23);
+ assert.sameValue(y, undefined);
+ assert.sameValue(xy, undefined);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-array-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-array-yield-ident-valid.js
new file mode 100644
index 0000000000..80b839a402
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-array-yield-ident-valid.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-nested-array-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 22;
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: [x = yield] } of [{ x: [] }]) {
+ assert.sameValue(x, 22);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-array.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-array.js
new file mode 100644
index 0000000000..a7c8de9f17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-array.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-nested-array.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let y;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: [y] } of [{ x: [321] }]) {
+ assert.sameValue(y, 321);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-obj-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-obj-yield-ident-valid.js
new file mode 100644
index 0000000000..3b91a8fe9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-obj-yield-ident-valid.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-nested-obj-yield-ident-valid.case
+// - src/dstr-assignment-for-await/async-function/async-func-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let yield = 2;
+let result, x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: { x = yield } } of [{ x: {} }]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-obj.js
new file mode 100644
index 0000000000..1255b403cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-nested-obj.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-nested-obj.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let result, y;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: { y } } of [{ x: { y: 2 } }]) {
+ assert.sameValue(y, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-order.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-order.js
new file mode 100644
index 0000000000..0930026efa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-order.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-put-order.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The AssignmentElements in an AssignmentElementList are evaluated in left- to-right order. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ z: x, a: x } of [{ a: 2, z: 1 }]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-prop-ref-no-get.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-prop-ref-no-get.js
new file mode 100644
index 0000000000..521720a5de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-prop-ref-no-get.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-put-prop-ref-no-get.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let setValue;
+let x = {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+};
+
+let iterCount = 0;
+async function fn() {
+ for await ({ a: x.y } of [{ a: 23 }]) {
+ assert.sameValue(setValue, 23);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-prop-ref.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-prop-ref.js
new file mode 100644
index 0000000000..a53b50335f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-prop-ref.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-put-prop-ref.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {};
+
+let iterCount = 0;
+async function fn() {
+ for await ({ xy: x.y } of [{ xy: 4 }]) {
+ assert.sameValue(x.y, 4);
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..9a520c00d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-prop-put-unresolvable-no-strict.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-put-unresolvable-no-strict.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+{
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x: unresolvable } of [{}]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => {
+ assert.sameValue(unresolvable, undefined);
+ assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+ }, $DONE)
+ .then($DONE, $DONE);
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-descriptors.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-descriptors.js
new file mode 100644
index 0000000000..9d1f5ae8c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-descriptors.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-descriptors.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Object created from rest deconstruction doesn't copy source object property descriptors. (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+let obj = {};
+Object.defineProperty(obj, "a", { value: 3, configurable: false, enumerable: true });
+Object.defineProperty(obj, "b", { value: 4, writable: false, enumerable: true });
+
+let iterCount = 0;
+async function fn() {
+ for await ({...rest} of [obj]) {
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-empty-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-empty-obj.js
new file mode 100644
index 0000000000..10170c8afc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-empty-obj.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-empty-obj.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: RestBindingInitialization creates a new object even if lhs is an empty object (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ({...rest} of [{}]) {
+ assert.notSameValue(rest, undefined);
+ assert.notSameValue(rest, null);
+ assert.sameValue(typeof rest, "object");
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-getter.js
new file mode 100644
index 0000000000..9e068fccce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-getter.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-getter.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+let count = 0;
+
+let iterCount = 0;
+async function fn() {
+ for await ({...x} of [{ get v() { count++; return 2; } }]) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-number.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-number.js
new file mode 100644
index 0000000000..4b60a029a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-number.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-number.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: RestBindingInitialization creates a new object even if lhs is a Number (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ({...rest} of [51]) {
+ assert.notSameValue(rest, undefined);
+ assert.notSameValue(rest, null);
+ assert(rest instanceof Object);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-same-name.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-same-name.js
new file mode 100644
index 0000000000..9c1d664feb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-same-name.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-same-name.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Proper setting in the values for rest name equal to a property name. (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let o = {
+ x: 42,
+ y: 39,
+ z: 'cheeseburger'
+};
+
+let x, y, z;
+
+let iterCount = 0;
+async function fn() {
+ for await ({ x, ...z } of [o]) {
+ assert.sameValue(x, 42);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z.y, 39);
+ assert.sameValue(z.z, 'cheeseburger');
+
+ let keys = Object.getOwnPropertyNames(z);
+ assert.sameValue(keys.length, 2);
+ assert.sameValue(keys[0], 'y');
+ assert.sameValue(keys[1], 'z');
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..f219395561
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-skip-non-enumerable.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-skip-non-enumerable.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+let obj = {a: 3, b: 4};
+Object.defineProperty(obj, "x", { value: 4, enumerable: false });
+
+let iterCount = 0;
+async function fn() {
+ for await ({...rest} of [obj]) {
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "x"), undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-str-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-str-val.js
new file mode 100644
index 0000000000..2f74cf157c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-str-val.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-str-val.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: RestBindingInitialization creats an object with indexes as property name (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ({...rest} of ["foo"]) {
+ assert.sameValue(rest["0"], "f");
+ assert.sameValue(rest["1"], "o");
+ assert.sameValue(rest["2"], "o");
+ assert(rest instanceof Object);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-symbol-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-symbol-val.js
new file mode 100644
index 0000000000..89e4f89d0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-symbol-val.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-symbol-val.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: RestBindingInitialization creates a new object if lhs is a Symbol (for-await-of statement in an async function declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, Symbol, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ({...rest} of [Symbol("foo")]) {
+ assert.notSameValue(rest, undefined);
+ assert.notSameValue(rest, null);
+ assert(rest instanceof Object);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-to-property-with-setter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-to-property-with-setter.js
new file mode 100644
index 0000000000..3570cf1d11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-to-property-with-setter.js
@@ -0,0 +1,55 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-to-property-with-setter.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object property setter, its value should be binded as rest object. (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let settedValue;
+let executedGetter = false;
+let src = {
+ get y() {
+ executedGetter = true;
+ },
+ set y(v) {
+ settedValue = v;
+ },
+};
+src.y = undefined;
+
+let iterCount = 0;
+async function fn() {
+ for await ({...src.y} of [{ x: 1, y: 2}]) {
+ assert.sameValue(settedValue.x, 1);
+ assert.sameValue(settedValue.y, 2);
+ assert(!executedGetter, "The property should not be accessed");
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-to-property.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-to-property.js
new file mode 100644
index 0000000000..434595ea24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-to-property.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-to-property.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object property, its value should be binded as rest object. (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let src = {};
+
+let iterCount = 0;
+async function fn() {
+ for await ({...src.y} of [{ x: 1, y: 2}]) {
+ assert.sameValue(src.y.x, 1);
+ assert.sameValue(src.y.y, 2);
+
+ verifyProperty(src, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-valid-object.js b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-valid-object.js
new file mode 100644
index 0000000000..33a7219ba2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-decl-dstr-obj-rest-valid-object.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-valid-object.case
+// - src/dstr-assignment-for-await/default/async-func-decl.template
+/*---
+description: Rest object contains just unextracted data (for-await-of statement in an async function declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest, a, b;
+
+
+let iterCount = 0;
+async function fn() {
+ for await ({a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-close.js
new file mode 100644
index 0000000000..8f22becec0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-close.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [x] of [iter]) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..81e54394c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-get-err.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-get-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Abrupt completion returned by GetIterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ 1. Let iterator be ? GetIterator(value).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+async function fn() {
+ for await (const [x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..b19e968f92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-init-iter-no-close.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [x] of [iter]) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-name-iter-val.js
new file mode 100644
index 0000000000..9c8617e260
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-name-iter-val.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..9e43c81257
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..e1aaca9de4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..0b9e2fef5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..71de673889
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..94de9fc3d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..4b2944747d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..1c7235ff89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..c5feb0f1d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..27cb241101
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Nested array destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be ? GetIterator(value).
+---*/
+
+async function fn() {
+ for await (const [[x]] of [[null]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..35e3f1bc7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [x = 23] of [[]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..9e00d52430
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [arrow = () => {}] of [[]]) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..34fd8d304e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..32208d9420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..76b0b46ac0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..be5f635c89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..b43f7aac81
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..6124458ee4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..910554aa72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Destructuring initializer returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+
+async function fn() {
+ for await (const [x = (function() { throw new Test262Error(); })()] of [[undefined]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..63c376a0ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [x = 23] of [[undefined]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..26ff5de4ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function fn() {
+ for await (const [ x = unresolvableReference ] of [[]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..39afc5d8df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..60df0e48da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [_, x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..226d1296ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ throw new Test262Error();
+ }
+ };
+};
+
+async function fn() {
+ for await (const [x] of [g]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..c8aaa6d454
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function fn() {
+ for await (const [x] of [g]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..25bb07a3cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..c0fd2aeb40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..9a9e131114
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..4ff8652aa3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..de52ec1bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..33dfeab157
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Nested object destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function fn() {
+ for await (const [{ x }] of [[null]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..efd18dce88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Nested object destructuring with a value of `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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function fn() {
+ for await (const [{ x }] of [[]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..d1ed8ad5dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..6ccb652379
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-func-const.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for-await-of statement in an async function)
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+
+async function fn() {
+ for await (const [,] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..25ec629ac5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision-step-err.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+
+---*/
+var following = 0;
+var iter = function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+async function fn() {
+ for await (const [,] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+ assert.sameValue(following, 0, "iterator is properly closed");
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision.js
new file mode 100644
index 0000000000..9732ae1da4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-elision.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-empty.js
new file mode 100644
index 0000000000..28c763af98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-empty.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..b630a40eec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..44cf0a06b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,93 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..f2821c7e45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..fc58ef8457
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..05fedaa896
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding-for-await/error/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 iter = (function*() { throw new Test262Error(); })();
+
+async function fn() {
+ for await (const [, ...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..bbb79b8f0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..b0ddb463ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..8fe38d2d61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-func-const.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for-await-of statement in an async function)
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+
+async function fn() {
+ for await (const [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..af1d3314fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+async function fn() {
+ for await (const [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..81311aaf7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function fn() {
+ for await (const [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..d30020f5e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..90091aa851
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [...[ x ] = []] of [[]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..666b9983a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-id.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [...x = []] of [[]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..693a803d1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [...{ x } = []] of [[]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..5ababb2ab4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/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
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [...[x], y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..ab883d5173
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/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
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [...x, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..0e4f9725d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/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
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (const [...{ x }, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..c4398e4e43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..0faf104cd0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+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.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-init-iter-close.js
new file mode 100644
index 0000000000..725060354b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (const [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..f306dd5842
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (const [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-name-iter-val.js
new file mode 100644
index 0000000000..474fe89735
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-name-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (const [x, y, z] of asyncIter) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..dda0b9a98f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..00e169b5e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[7, 8, 9]]];
+})();
+
+async function fn() {
+ for await (const [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..85843facba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [[,] = g()] of asyncIter) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..c6cd48b91c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[]]];
+})();
+
+async function fn() {
+ for await (const [[,] = g()] of asyncIter) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..dce673ae02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [[] = function() { initCount += 1; return iter; }()] of asyncIter) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..24e10a7c86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[23]]];
+})();
+
+async function fn() {
+ for await (const [[] = function() { initCount += 1; }()] of asyncIter) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..1226460b51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [[...x] = values] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..03c61ae850
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[values]];
+})();
+
+async function fn() {
+ for await (const [[...x] = function() { initCount += 1; }()] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..3729fd8d1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..91733877f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [arrow = () => {}] of asyncIter) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..22eaf10400
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] of asyncIter) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..d539676a97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [cover = (function () {}), xCover = (0, function() {})] of asyncIter) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..800d69b794
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [fn = function () {}, xFn = function x() {}] of asyncIter) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..d35b728b07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [gen = function* () {}, xGen = function* x() {}] of asyncIter) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..a45009a602
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[,]];
+})();
+
+async function fn() {
+ for await (const [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+ // another statement
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..208c7da6a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[null, 0, false, '']];
+})();
+
+async function fn() {
+ for await (const [w = counter(), x = counter(), y = counter(), z = counter()] of asyncIter) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..09a499e6f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[undefined]];
+})();
+
+async function fn() {
+ for await (const [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..432ab192ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..c8c635724d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [_, x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..8983a1ba7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (const [x, y, z] of asyncIter) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..b3003dc0b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..3e32b0dcf2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ x: 11, y: 22, z: 33 }]];
+})();
+
+async function fn() {
+ for await (const [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..1689bf2401
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..c78a9a8aab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ u: 777, w: 888, y: 999 }]];
+})();
+
+async function fn() {
+ for await (const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..b74ae085a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.template
+/*---
+description: Elision accepts exhausted iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (const [,] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elision.js
new file mode 100644
index 0000000000..088c3f1ba3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.template
+/*---
+description: Elision advances iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function fn() {
+ for await (const [,] of asyncIter) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-empty.js
new file mode 100644
index 0000000000..a932db724a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (const [] of asyncIter) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..4e0c8465ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[3, 4, 5]];
+})();
+
+async function fn() {
+ for await (const [...[x, y, z]] of asyncIter) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..26f73986fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function fn() {
+ for await (const [...[,]] of asyncIter) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..957663382b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (const [...[]] of asyncIter) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..8750641d06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function fn() {
+ for await (const [...[...x]] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..2e393b4fea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function fn() {
+ for await (const [ , , ...x] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..6adc39564a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2]];
+})();
+
+async function fn() {
+ for await (const [, , ...x] of asyncIter) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..a8066035df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function fn() {
+ for await (const [...x] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..75e0b26ee8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [...[ x ] = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..821aabe6db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [...x = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..12a71dfba3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (const [...{ x } = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..4b4ef09d43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (const [...[x], y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..bb57e4b17e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (const [...x, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..5b011925bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (const [...{ x }, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..238d59a412
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (const [...{ length }] of asyncIter) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..e8eb69cd7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[7, 8, 9]];
+})();
+
+async function fn() {
+ for await (const [...{ 0: v, 1: w, 2: x, 3: y, length: z }] of asyncIter) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-empty.js
new file mode 100644
index 0000000000..7ad1910a90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [obj];
+})();
+
+async function fn() {
+ for await (const {} of asyncIter) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..9530628be4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (const { arrow = () => {} } of asyncIter) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..385663466d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (const { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } of asyncIter) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..27ecfa9b21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (const { cover = (function () {}), xCover = (0, function() {}) } of asyncIter) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..0fc48366a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (const { fn = function () {}, xFn = function x() {} } of asyncIter) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..18396a9319
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (const { gen = function* () {}, xGen = function* x() {} } of asyncIter) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..052d82dc83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: null, x: 0, y: false, z: '' }];
+})();
+
+async function fn() {
+ for await (const { w = counter(), x = counter(), y = counter(), z = counter() } of asyncIter) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..3cf0d734f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function fn() {
+ for await (const { x, } of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..cd707f0b14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (const { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..ade4b90c6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: [45] }];
+})();
+
+async function fn() {
+ for await (const { x: [y], } of asyncIter) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..4d39972bb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: [7, undefined, ] }];
+})();
+
+async function fn() {
+ for await (const { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..913df967bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ s: null, u: 0, w: false, y: '' }];
+})();
+
+async function fn() {
+ for await (const { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..16ea4aa191
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ }];
+})();
+
+async function fn() {
+ for await (const { x: y = 33 } of asyncIter) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..af124bc277
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function fn() {
+ for await (const { x: y, } of asyncIter) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..d4b900ed8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function fn() {
+ for await (const { x: y } of asyncIter) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..e7cf8e94a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: undefined }];
+})();
+
+async function fn() {
+ for await (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..2b05dc444f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: { x: undefined, z: 7 } }];
+})();
+
+async function fn() {
+ for await (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..bc970bc1c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-getter.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ get v() { count++; return 2; } }];
+})();
+
+async function fn() {
+ for await (const {...x} of asyncIter) {
+ assert.sameValue(x.v, 2);
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..e4a3df8f4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [o];
+})();
+
+async function fn() {
+ for await (const {...rest} of asyncIter) {
+ assert.sameValue(rest.a, 3);
+ assert.sameValue(rest.b, 4);
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..d2682a3fe0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-async-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{x: 1, y: 2, a: 5, b: 3}];
+})();
+
+async function fn() {
+ for await (const {a, b, ...rest} of asyncIter) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-init-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-init-null.js
new file mode 100644
index 0000000000..8c4a83c068
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-init-null.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function fn() {
+ for await (const {} of [null]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-init-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-init-undefined.js
new file mode 100644
index 0000000000..d661c1e474
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-init-undefined.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-undefined.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function fn() {
+ for await (const {} of [undefined]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-empty.js
new file mode 100644
index 0000000000..58b9ea53f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-empty.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..8bd3ee5381
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function fn() {
+ for await (const { poisoned } of [poisonedProperty]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..930aa3bd16
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..c1729d6aba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..c81bf7b908
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..cbd7dfee3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..ea8932f178
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..beaaa664d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..5b7192dd2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-throws.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (const { x = thrower() } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..4293aefe73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function fn() {
+ for await (const { x = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..8bd239b3fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..a8b7a73b3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-list-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-list-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (const { a, b = thrower(), c = ++initCount } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..55eca251f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..ae961f46d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..b5fac1fbfe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function fn() {
+ for await (const { w: [x, y, z] = [4, 5, 6] } of [{ w: null }]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..fc8736f248
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-ary.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..1f22426a69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Evaluation of property name returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (const { [thrower()]: x } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..fc4f176f48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function fn() {
+ for await (const { poisoned: x = ++initEvalCount } of [poisonedProperty]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..3d2f8baba1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..13b3b11890
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (const { x: y = thrower() } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..d963af6e1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function fn() {
+ for await (const { x: y = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..4eba86c84d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-init.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..55557a596a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..0435cd3e64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-id.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..821c8b71b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..4d5fe76888
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function fn() {
+ for await (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: null }]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..79ee455724
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function fn() {
+ for await (const { w: { x, y, z } = undefined } of [{ }]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..621b5ffac3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-prop-obj.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..33c2dbcc73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-getter.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..7b7ff100dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..91ebd839a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-const-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-close.js
new file mode 100644
index 0000000000..6b06e8c0a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-close.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [x] of [iter]) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..f74d9531da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-get-err.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-get-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Abrupt completion returned by GetIterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ 1. Let iterator be ? GetIterator(value).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+async function fn() {
+ for await (let [x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..ae5a4e0bed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-init-iter-no-close.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [x] of [iter]) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-name-iter-val.js
new file mode 100644
index 0000000000..17b2fea0bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-name-iter-val.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..1bca9befba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..ea43552f92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..4ae2828174
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..f32b0acfcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..c3b49708f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..e261bb9858
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..d35bcecbe1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..e8f117980b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..80dd73dc97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Nested array destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be ? GetIterator(value).
+---*/
+
+async function fn() {
+ for await (let [[x]] of [[null]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..bd05e11478
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [x = 23] of [[]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..4091d0ade6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [arrow = () => {}] of [[]]) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..b7e9803f27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..4207d078ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..7adb183626
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..25f5498e43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..8de9a8a8b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..3a4a94df71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..ae41a49441
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Destructuring initializer returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+
+async function fn() {
+ for await (let [x = (function() { throw new Test262Error(); })()] of [[undefined]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..e7ec30c4aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [x = 23] of [[undefined]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..6d14254f67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function fn() {
+ for await (let [ x = unresolvableReference ] of [[]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..4c929da0f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..5a7bf170a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [_, x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..b8ce4e2b0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ throw new Test262Error();
+ }
+ };
+};
+
+async function fn() {
+ for await (let [x] of [g]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..fb683d05cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function fn() {
+ for await (let [x] of [g]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..db942d0fea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..adc6f46d6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..fe0cd57fb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..02ec6caed3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..05f2e157d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..87a8f06fcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Nested object destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function fn() {
+ for await (let [{ x }] of [[null]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..846967279f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Nested object destructuring with a value of `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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function fn() {
+ for await (let [{ x }] of [[]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..ad682d1160
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..cde9f9bfb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-func-let.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function fn() {
+ for await (let [,] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..4d250f00ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision-step-err.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+
+---*/
+var following = 0;
+var iter = function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+async function fn() {
+ for await (let [,] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+ assert.sameValue(following, 0, "iterator is properly closed");
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision.js
new file mode 100644
index 0000000000..d10d5ce7b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-elision.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-empty.js
new file mode 100644
index 0000000000..f435cb9903
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-empty.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..3223cdbe0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..7c53baa06a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,94 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..41e5ffa77b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..84ace75a77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..d066552a3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding-for-await/error/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 iter = (function*() { throw new Test262Error(); })();
+
+async function fn() {
+ for await (let [, ...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..8c8d639556
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..6ab10508b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..2e1cbd6d7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-func-let.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function fn() {
+ for await (let [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..d4239d145c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+async function fn() {
+ for await (let [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..ca3566bb33
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function fn() {
+ for await (let [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..e78d345248
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-id.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..3fb7d69957
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [...[ x ] = []] of [[]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..1b6c269247
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-id.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [...x = []] of [[]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..5fca922302
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [...{ x } = []] of [[]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..e3b8ce461a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/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
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [...[x], y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..527bfb7769
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/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
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [...x, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..cce68de75e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/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
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (let [...{ x }, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..dea34094e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..87e31b2f24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+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.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-init-iter-close.js
new file mode 100644
index 0000000000..2c12803cf7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (let [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..2184bcda14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (let [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-name-iter-val.js
new file mode 100644
index 0000000000..bfd65c558f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-name-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (let [x, y, z] of asyncIter) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..2766da1d4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..34c058130d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[7, 8, 9]]];
+})();
+
+async function fn() {
+ for await (let [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..1d104ca257
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [[,] = g()] of asyncIter) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..b1f8ad96b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[]]];
+})();
+
+async function fn() {
+ for await (let [[,] = g()] of asyncIter) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..586d125470
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [[] = function() { initCount += 1; return iter; }()] of asyncIter) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..7382b80419
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[23]]];
+})();
+
+async function fn() {
+ for await (let [[] = function() { initCount += 1; }()] of asyncIter) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..5c61b8dd7b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [[...x] = values] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..2dad1b779e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[values]];
+})();
+
+async function fn() {
+ for await (let [[...x] = function() { initCount += 1; }()] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..30f620de44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..9a16fb16f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [arrow = () => {}] of asyncIter) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..46d3a44ef5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] of asyncIter) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2f9f5e907f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [cover = (function () {}), xCover = (0, function() {})] of asyncIter) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..2a0df7eb4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [fn = function () {}, xFn = function x() {}] of asyncIter) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..6dfa8cc773
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [gen = function* () {}, xGen = function* x() {}] of asyncIter) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..4dd91bd901
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[,]];
+})();
+
+async function fn() {
+ for await (let [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+ // another statement
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..d1ffd57f8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[null, 0, false, '']];
+})();
+
+async function fn() {
+ for await (let [w = counter(), x = counter(), y = counter(), z = counter()] of asyncIter) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..1bf414da2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[undefined]];
+})();
+
+async function fn() {
+ for await (let [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..355fde2704
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..098c6a56bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [_, x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..b8910d2ff7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (let [x, y, z] of asyncIter) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..5ad039e006
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..73bc1eb8c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ x: 11, y: 22, z: 33 }]];
+})();
+
+async function fn() {
+ for await (let [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..5294a30bec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..91489c0466
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ u: 777, w: 888, y: 999 }]];
+})();
+
+async function fn() {
+ for await (let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..d50ff7feeb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.template
+/*---
+description: Elision accepts exhausted iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (let [,] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elision.js
new file mode 100644
index 0000000000..54e9aa732d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.template
+/*---
+description: Elision advances iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function fn() {
+ for await (let [,] of asyncIter) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-empty.js
new file mode 100644
index 0000000000..1412548d25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (let [] of asyncIter) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..80b839b34f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[3, 4, 5]];
+})();
+
+async function fn() {
+ for await (let [...[x, y, z]] of asyncIter) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..98cc27fa93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function fn() {
+ for await (let [...[,]] of asyncIter) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..df7cda990a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (let [...[]] of asyncIter) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..c02d9edb22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function fn() {
+ for await (let [...[...x]] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..2d0f072732
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function fn() {
+ for await (let [ , , ...x] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..eb3b77a5d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2]];
+})();
+
+async function fn() {
+ for await (let [, , ...x] of asyncIter) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..a0e3d197ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function fn() {
+ for await (let [...x] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..70196a5c7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [...[ x ] = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..e92b94f566
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [...x = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..11783bfbe5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (let [...{ x } = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..b9ac9ec762
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (let [...[x], y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..6c88048761
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (let [...x, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..a44f20aa89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (let [...{ x }, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..1c3d70aa6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (let [...{ length }] of asyncIter) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..9bd5d8e561
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[7, 8, 9]];
+})();
+
+async function fn() {
+ for await (let [...{ 0: v, 1: w, 2: x, 3: y, length: z }] of asyncIter) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-empty.js
new file mode 100644
index 0000000000..2f800465d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [obj];
+})();
+
+async function fn() {
+ for await (let {} of asyncIter) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..978ff88e80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (let { arrow = () => {} } of asyncIter) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..ea7a8e93b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (let { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } of asyncIter) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..8d809eba94
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (let { cover = (function () {}), xCover = (0, function() {}) } of asyncIter) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..58af128faa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (let { fn = function () {}, xFn = function x() {} } of asyncIter) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..3dab3ca931
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (let { gen = function* () {}, xGen = function* x() {} } of asyncIter) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..76164457df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: null, x: 0, y: false, z: '' }];
+})();
+
+async function fn() {
+ for await (let { w = counter(), x = counter(), y = counter(), z = counter() } of asyncIter) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..1bb45428a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function fn() {
+ for await (let { x, } of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..723b10f800
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (let { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..7bfcefb058
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: [45] }];
+})();
+
+async function fn() {
+ for await (let { x: [y], } of asyncIter) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..f5419463c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: [7, undefined, ] }];
+})();
+
+async function fn() {
+ for await (let { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..ea3a1ff91e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ s: null, u: 0, w: false, y: '' }];
+})();
+
+async function fn() {
+ for await (let { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..941aef4d56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ }];
+})();
+
+async function fn() {
+ for await (let { x: y = 33 } of asyncIter) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..c0e670d6b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function fn() {
+ for await (let { x: y, } of asyncIter) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..312666e1fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function fn() {
+ for await (let { x: y } of asyncIter) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..9ef3856ecf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: undefined }];
+})();
+
+async function fn() {
+ for await (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..846ee5bbcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: { x: undefined, z: 7 } }];
+})();
+
+async function fn() {
+ for await (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..e0e7b90086
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-getter.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ get v() { count++; return 2; } }];
+})();
+
+async function fn() {
+ for await (let {...x} of asyncIter) {
+ assert.sameValue(x.v, 2);
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..3d0cceb4c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [o];
+})();
+
+async function fn() {
+ for await (let {...rest} of asyncIter) {
+ assert.sameValue(rest.a, 3);
+ assert.sameValue(rest.b, 4);
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..c4439f08a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-async-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{x: 1, y: 2, a: 5, b: 3}];
+})();
+
+async function fn() {
+ for await (let {a, b, ...rest} of asyncIter) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-init-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-init-null.js
new file mode 100644
index 0000000000..3fb5bcb541
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-init-null.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function fn() {
+ for await (let {} of [null]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-init-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-init-undefined.js
new file mode 100644
index 0000000000..49bab4b83d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-init-undefined.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-undefined.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function fn() {
+ for await (let {} of [undefined]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-empty.js
new file mode 100644
index 0000000000..ad61c089e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-empty.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..94ca615a63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function fn() {
+ for await (let { poisoned } of [poisonedProperty]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..e8ad4d887b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..cc8eee4ee4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..29508617bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..e200a2ee9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..1f8a286b74
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..e987b36a07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..f52c10fb02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-throws.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (let { x = thrower() } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..5e491f763d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function fn() {
+ for await (let { x = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..1dc4057c6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..629ef0ea8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-list-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-list-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (let { a, b = thrower(), c = ++initCount } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..49b32ed8dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..d6031925a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..e26dc3722c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function fn() {
+ for await (let { w: [x, y, z] = [4, 5, 6] } of [{ w: null }]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..80d9fc026a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-ary.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..947d617028
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Evaluation of property name returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (let { [thrower()]: x } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..2e8977b2f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function fn() {
+ for await (let { poisoned: x = ++initEvalCount } of [poisonedProperty]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..46c30af3ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..cdbab8e6d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (let { x: y = thrower() } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..f46d6d5abe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function fn() {
+ for await (let { x: y = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..0716115e94
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-init.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..1652da3f6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..bc8953ff47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-id.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..727e856636
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..80ee10948e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function fn() {
+ for await (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: null }]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..f6ce1ad197
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function fn() {
+ for await (let { w: { x, y, z } = undefined } of [{ }]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..12472646ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-prop-obj.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..91fb8b1065
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-getter.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..ce8dff6cbf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..8e6054101e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-let-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-close.js
new file mode 100644
index 0000000000..26b5bcf376
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-close.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [x] of [iter]) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..81e058dcd4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-get-err.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-get-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Abrupt completion returned by GetIterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ 1. Let iterator be ? GetIterator(value).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+async function fn() {
+ for await (var [x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..5072dc9c53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-init-iter-no-close.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [x] of [iter]) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-name-iter-val.js
new file mode 100644
index 0000000000..066fd1e445
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-name-iter-val.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..ffad66eea0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..8bf634f7bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..b8634948d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..ab16b2e1d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..7f944b95a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..b7b169f347
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..088ad41542
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..8af8a1979a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..c557e9d433
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Nested array destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be ? GetIterator(value).
+---*/
+
+async function fn() {
+ for await (var [[x]] of [[null]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..8105d0ce19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [x = 23] of [[]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..c38a52f8ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [arrow = () => {}] of [[]]) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..abdadc9f49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..1a6d611578
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..5846b64e36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..891530e078
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..cad6486c31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..e28047e1a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..c49994d415
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Destructuring initializer returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+
+async function fn() {
+ for await (var [x = (function() { throw new Test262Error(); })()] of [[undefined]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..b264770d37
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [x = 23] of [[undefined]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..cf636d7a2e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function fn() {
+ for await (var [ x = unresolvableReference ] of [[]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..e64d354e95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..739bb48158
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [_, x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..7d57f363a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ throw new Test262Error();
+ }
+ };
+};
+
+async function fn() {
+ for await (var [x] of [g]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..d91b0135a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function fn() {
+ for await (var [x] of [g]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..e74fb6774c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..1b8cfb331b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..7fafa23296
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..575118b691
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..cbfd541c03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..b021321fdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Nested object destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function fn() {
+ for await (var [{ x }] of [[null]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..d3ac9206d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Nested object destructuring with a value of `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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function fn() {
+ for await (var [{ x }] of [[]]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..0c79532e9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..decc9af81c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-func-var.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function fn() {
+ for await (var [,] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..9cd0b776e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision-step-err.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+
+---*/
+var following = 0;
+var iter = function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+async function fn() {
+ for await (var [,] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+ assert.sameValue(following, 0, "iterator is properly closed");
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision.js
new file mode 100644
index 0000000000..8df07cdec2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-elision.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-empty.js
new file mode 100644
index 0000000000..d650f9b862
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-empty.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..6805be6f11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..3738643618
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,91 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..6a99e37fe8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..59869b0c60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..8b8aaf4af6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding-for-await/error/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 iter = (function*() { throw new Test262Error(); })();
+
+async function fn() {
+ for await (var [, ...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..b30aa70e2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..3434568917
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..fbb941c0e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-func-var.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function fn() {
+ for await (var [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..5420a02533
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+async function fn() {
+ for await (var [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..19c5cffbcf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function fn() {
+ for await (var [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..dac2d39a7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-id.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..0f9cab368a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [...[ x ] = []] of [[]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..d1c6118774
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-id.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [...x = []] of [[]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..59b0bec6a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [...{ x } = []] of [[]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..cbcef9096a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/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
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [...[x], y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..4c442a32ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/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
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [...x, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..c11cd1e2b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/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
+features: [destructuring-binding, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+async function fn() {
+ for await (var [...{ x }, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..36155c51b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..7a0ec789c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+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.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-init-iter-close.js
new file mode 100644
index 0000000000..0f3b483569
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (var [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..b3efd2ace2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (var [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-name-iter-val.js
new file mode 100644
index 0000000000..c07b541a84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-name-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (var [x, y, z] of asyncIter) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..d28f01aff2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..92e97133c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[7, 8, 9]]];
+})();
+
+async function fn() {
+ for await (var [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..23e85da9f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [[,] = g()] of asyncIter) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..e86c02a621
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[]]];
+})();
+
+async function fn() {
+ for await (var [[,] = g()] of asyncIter) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..c040c9e34b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [[] = function() { initCount += 1; return iter; }()] of asyncIter) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..4e62a83478
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[23]]];
+})();
+
+async function fn() {
+ for await (var [[] = function() { initCount += 1; }()] of asyncIter) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..c4569ed3f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [[...x] = values] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..a6fe729989
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[values]];
+})();
+
+async function fn() {
+ for await (var [[...x] = function() { initCount += 1; }()] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..c11407299b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..065bcf0066
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [arrow = () => {}] of asyncIter) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..ab076ab31f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] of asyncIter) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..b167a39ee2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [cover = (function () {}), xCover = (0, function() {})] of asyncIter) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..3ea0e025eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [fn = function () {}, xFn = function x() {}] of asyncIter) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..54f22820f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [gen = function* () {}, xGen = function* x() {}] of asyncIter) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..5276dcf6ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[,]];
+})();
+
+async function fn() {
+ for await (var [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+ // another statement
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..6fe00cd9e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[null, 0, false, '']];
+})();
+
+async function fn() {
+ for await (var [w = counter(), x = counter(), y = counter(), z = counter()] of asyncIter) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..16a6aa2a75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[undefined]];
+})();
+
+async function fn() {
+ for await (var [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..08bffc62bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..4589986582
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [_, x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..1fe2e32cf2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (var [x, y, z] of asyncIter) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..52a1935e46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..7d08ae79c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ x: 11, y: 22, z: 33 }]];
+})();
+
+async function fn() {
+ for await (var [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..4566b35187
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..ef5ae3fda6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ u: 777, w: 888, y: 999 }]];
+})();
+
+async function fn() {
+ for await (var [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..bebe950c0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.template
+/*---
+description: Elision accepts exhausted iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (var [,] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elision.js
new file mode 100644
index 0000000000..ecd0b28c80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.template
+/*---
+description: Elision advances iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function fn() {
+ for await (var [,] of asyncIter) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-empty.js
new file mode 100644
index 0000000000..ef42e42961
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (var [] of asyncIter) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..e1aca14e3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[3, 4, 5]];
+})();
+
+async function fn() {
+ for await (var [...[x, y, z]] of asyncIter) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..f5ecdeb98e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function fn() {
+ for await (var [...[,]] of asyncIter) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..9498b9025b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function fn() {
+ for await (var [...[]] of asyncIter) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..bc3dcafc1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function fn() {
+ for await (var [...[...x]] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..c678f2fea5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function fn() {
+ for await (var [ , , ...x] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..526b778b9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2]];
+})();
+
+async function fn() {
+ for await (var [, , ...x] of asyncIter) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..694de9c966
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function fn() {
+ for await (var [...x] of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..8d6ea4b7c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [...[ x ] = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..aba8fc38d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [...x = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..21d02c1534
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function fn() {
+ for await (var [...{ x } = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..9fd265fb5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (var [...[x], y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..44f77eebe8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (var [...x, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..1147b4ac6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (var [...{ x }, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..9b9295f030
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function fn() {
+ for await (var [...{ length }] of asyncIter) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..d28f85bb82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[7, 8, 9]];
+})();
+
+async function fn() {
+ for await (var [...{ 0: v, 1: w, 2: x, 3: y, length: z }] of asyncIter) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-empty.js
new file mode 100644
index 0000000000..dcb75fb088
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [obj];
+})();
+
+async function fn() {
+ for await (var {} of asyncIter) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..a799e6c3e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (var { arrow = () => {} } of asyncIter) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..be1f66f282
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (var { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } of asyncIter) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..67122fcca1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (var { cover = (function () {}), xCover = (0, function() {}) } of asyncIter) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..fe4d937394
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (var { fn = function () {}, xFn = function x() {} } of asyncIter) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..29cb95d428
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (var { gen = function* () {}, xGen = function* x() {} } of asyncIter) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..ed8a23a970
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: null, x: 0, y: false, z: '' }];
+})();
+
+async function fn() {
+ for await (var { w = counter(), x = counter(), y = counter(), z = counter() } of asyncIter) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..9d5b467d66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function fn() {
+ for await (var { x, } of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..7576067d19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function fn() {
+ for await (var { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..e82be30f10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: [45] }];
+})();
+
+async function fn() {
+ for await (var { x: [y], } of asyncIter) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..cd233bba5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: [7, undefined, ] }];
+})();
+
+async function fn() {
+ for await (var { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..f0fa636031
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ s: null, u: 0, w: false, y: '' }];
+})();
+
+async function fn() {
+ for await (var { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } of asyncIter) {
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..408cd38e19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ }];
+})();
+
+async function fn() {
+ for await (var { x: y = 33 } of asyncIter) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..0ee2bb4680
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function fn() {
+ for await (var { x: y, } of asyncIter) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..77129a4e9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function fn() {
+ for await (var { x: y } of asyncIter) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..de7aee268f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: undefined }];
+})();
+
+async function fn() {
+ for await (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..e6197ffd3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: { x: undefined, z: 7 } }];
+})();
+
+async function fn() {
+ for await (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..028b098e1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-getter.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ get v() { count++; return 2; } }];
+})();
+
+async function fn() {
+ for await (var {...x} of asyncIter) {
+ assert.sameValue(x.v, 2);
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..b296c76684
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [o];
+})();
+
+async function fn() {
+ for await (var {...rest} of asyncIter) {
+ assert.sameValue(rest.a, 3);
+ assert.sameValue(rest.b, 4);
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..260669b53f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-async-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-func-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{x: 1, y: 2, a: 5, b: 3}];
+})();
+
+async function fn() {
+ for await (var {a, b, ...rest} of asyncIter) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-init-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-init-null.js
new file mode 100644
index 0000000000..d0c035361d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-init-null.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function fn() {
+ for await (var {} of [null]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-init-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-init-undefined.js
new file mode 100644
index 0000000000..292c3dc196
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-init-undefined.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-undefined.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function fn() {
+ for await (var {} of [undefined]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-empty.js
new file mode 100644
index 0000000000..da7d82f965
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-empty.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..4c43fda5c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function fn() {
+ for await (var { poisoned } of [poisonedProperty]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..cdd5bad606
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..180deff0f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..03cc5c9b2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..7e4a863d69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..6aeae53c91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..cb71ca490c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..6f6f8df34f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-throws.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (var { x = thrower() } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..69ef5f75ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function fn() {
+ for await (var { x = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..78bea5ca5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..5bcbd0d6a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-list-err.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-list-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (var { a, b = thrower(), c = ++initCount } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..6b3df9dbb9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..a12cc2cd05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..827a8a9a93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function fn() {
+ for await (var { w: [x, y, z] = [4, 5, 6] } of [{ w: null }]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..93ac81ff5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-ary.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..3693581ae5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Evaluation of property name returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (var { [thrower()]: x } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..5edac98684
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function fn() {
+ for await (var { poisoned: x = ++initEvalCount } of [poisonedProperty]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..620981233a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..3497bcc6d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function fn() {
+ for await (var { x: y = thrower() } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..a9bfe10c6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function fn() {
+ for await (var { x: y = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..75bd40967a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-init.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..8a48ffe8a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..3012b769ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-id.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..e188ec0aec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..f3a234a025
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function fn() {
+ for await (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: null }]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..09f903fcd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-func-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function fn() {
+ for await (var { w: { x, y, z } = undefined } of [{ }]) {
+ return;
+ }
+}
+
+fn()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..d317904880
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-prop-obj.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..bb588ec81a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-getter.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..843a85325d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..8d0cdb775e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-func-dstr-var-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/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
+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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-assignment.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-assignment.js
new file mode 100644
index 0000000000..a62872d7d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-assignment.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-assignment.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let v2, vNull, vHole, vUndefined, vOob;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([v2 = 10, vNull = 11, vHole = 12, vUndefined = 13, vOob = 14] of [[2, null, , undefined]]) {
+ assert.sameValue(v2, 2);
+ assert.sameValue(vNull, null);
+ assert.sameValue(vHole, 12);
+ assert.sameValue(vUndefined, 13);
+ assert.sameValue(vOob, 14);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-evaluation.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-evaluation.js
new file mode 100644
index 0000000000..96b72fb272
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-evaluation.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-evaluation.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The Initializer should only be evaluated if v is undefined. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let flag1 = false, flag2 = false;
+let _;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ _ = flag1 = true, _ = flag2 = true ] of [[14]]) {
+ assert.sameValue(flag1, false);
+ assert.sameValue(flag2, true);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-arrow.js
new file mode 100644
index 0000000000..bc074cd5c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-arrow.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-arrow.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (ArrowFunction) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let arrow;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ arrow = () => {} ] of [[]]) {
+ verifyProperty(arrow, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'arrow'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-class.js
new file mode 100644
index 0000000000..f2c70ad77b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-class.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-class.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (ClassExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let xCls, cls, xCls2;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } ] of [[]]) {
+ assert(xCls.name !== 'xCls');
+ assert(xCls2.name !== 'xCls2');
+
+ verifyProperty(cls, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cls'
+ });
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-cover.js
new file mode 100644
index 0000000000..5eb7b7618e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-cover.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-cover.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (CoverParenthesizedExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let xCover, cover;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ xCover = (0, function() {}), cover = (function() {}) ] of [[]]) {
+ assert(xCover.name !== 'xCover');
+
+ verifyProperty(cover, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cover'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-fn.js
new file mode 100644
index 0000000000..af0d772a74
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-fn.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-fn.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (FunctionExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let xFnexp, fnexp;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ xFnexp = function x() {}, fnexp = function() {} ] of [[]]) {
+ assert(xFnexp.name !== 'xFnexp');
+
+ verifyProperty(fnexp, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'fnexp'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-gen.js
new file mode 100644
index 0000000000..0efad4abd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-fn-name-gen.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-fn-name-gen.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (GeneratorExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(v, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(v, GetReferencedName(lref)).
+
+---*/
+let xGen, gen;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ xGen = function* x() {}, gen = function*() {} ] of [[]]) {
+ assert.notSameValue(xGen.name, 'xGen');
+
+ verifyProperty(gen, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'gen'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-in.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-in.js
new file mode 100644
index 0000000000..93cc08e217
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-in.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-in.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The Initializer in an AssignmentElement may be an `in` expression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x = 'x' in {} ] of [[]]) {
+ assert.sameValue(x, false);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-order.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-order.js
new file mode 100644
index 0000000000..691c66fbf1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-order.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-order.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Initializer values should be assigned in left-to-right order. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = 0;
+let a, b;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ a = x += 1, b = x *= 2 ] of [[]]) {
+ assert.sameValue(a, 1);
+ assert.sameValue(b, 2);
+ assert.sameValue(x, 2);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-simple-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-simple-no-strict.js
new file mode 100644
index 0000000000..b8298c1963
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-simple-no-strict.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-simple-no-strict.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let argument, eval;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([arguments = 4, eval = 5] of [[]]) {
+ assert.sameValue(arguments, 4);
+ assert.sameValue(eval, 5);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-yield-expr.js
new file mode 100644
index 0000000000..4ef1de9687
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-init-yield-expr.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-init-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement within a generator function body, it behaves as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let value = [];
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x = yield ] of [[]]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, false);
+ assert.sameValue(x, undefined);
+
+ iter.next(4).then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, true);
+ assert.sameValue(x, 4);
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-get-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-get-err.js
new file mode 100644
index 0000000000..ef6a190929
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-get-err.js
@@ -0,0 +1,54 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-iter-get-err.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: Abrupt completion returned from GetIterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ 1. Let iterator be ? GetIterator(value).
+
+---*/
+let iterable = {
+ [Symbol.iterator]() {
+ throw new Test262Error();
+ }
+};
+let _;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ _ ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-err.js
new file mode 100644
index 0000000000..1046dac206
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-err.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-iter-nrml-close-err.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: Abrupt completion returned from IteratorClose (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let _;
+let iterator = {
+ next() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ returnCount += 1;
+ throw new Test262Error();
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ _ ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(constructor, Test262Error);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-null.js
new file mode 100644
index 0000000000..72040af2d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-null.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-iter-nrml-close-null.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
+ 5. Return result.
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 5. Let innerResult be Call(return, iterator, « »).
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+ 8. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception.
+
+---*/
+let _;
+let nextCount = 0;
+let iterator = {
+ next() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ return null;
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ _ ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-skip.js
new file mode 100644
index 0000000000..037f78f5d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close-skip.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-iter-nrml-close-skip.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose is not called when assignment evaluation has exhausted the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
+ 5. Return result.
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let _;
+let iterator = {
+ next() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return() {
+ returnCount += 1;
+ return {};
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ _ ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(() => {
+ assert.sameValue(iterCount, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close.js
new file mode 100644
index 0000000000..ae28397bbc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-nrml-close.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-iter-nrml-close.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: IteratorClose is called when assignment evaluation has not exhausted the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
+ 5. Return result.
+
+ 7.4.6 IteratorClose ( iterator, completion )
+
+ [...]
+ 5. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let thisValue = null;
+let args = null;
+let _;
+let iterable = {};
+let iterator = {
+ next() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ _ ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-rtrn-close-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-rtrn-close-null.js
new file mode 100644
index 0000000000..84616ef77d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-rtrn-close-null.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-iter-rtrn-close-null.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
+ 5. Return result.
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 5. Let innerResult be Call(return, iterator, « »).
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+ 8. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception.
+
+---*/
+let unreachable = 0;
+let nextCount = 0;
+let returnCount = 0;
+let iterator = {
+ next() {
+ nextCount += 1;
+ return {done: false, value: undefined};
+ },
+ return() {
+ returnCount += 1;
+ return null;
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ {} = yield ] of [iterable]) {
+ unreachable += 1;
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(result => {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, false);
+
+ iter.return().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(unreachable, 0);
+ assert.sameValue(constructor, TypeError);
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-thrw-close-skip.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-thrw-close-skip.js
new file mode 100644
index 0000000000..cf1f8a4307
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-iter-thrw-close-skip.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-iter-thrw-close-skip.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose is not called when iteration produces an abrupt completion (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
+ 5. Return result.
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let iterator = {
+ next() {
+ nextCount += 1;
+ throw new Test262Error();
+ },
+ return() {
+ returnCount += 1;
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+let _;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-null.js
new file mode 100644
index 0000000000..7afe07801c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-null.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-null.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is `null`, a TypeError should be thrown. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let _;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([[ _ ]] of [[null]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined-hole.js
new file mode 100644
index 0000000000..b244c1e20a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined-hole.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-undefined-hole.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is a "hole", a TypeError should be thrown. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let _;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([[ _ ]] of [[ , ]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined-own.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined-own.js
new file mode 100644
index 0000000000..6256d66ec4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined-own.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-undefined-own.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is `undefined`, a TypeError should be thrown. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let _;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([[ x ]] of [[undefined]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined.js
new file mode 100644
index 0000000000..ac8c22c22d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-undefined.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-undefined.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and no value is defined, a TypeError should be thrown. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let _;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([[ x ]] of [[]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-yield-expr.js
new file mode 100644
index 0000000000..f31bda2f65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-array-yield-expr.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-array-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and within a generator function body, it behaves as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let value = [[22]];
+let x = {};
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([[x[yield]]] of [value]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, false);
+ assert.sameValue(x.prop, undefined);
+
+ iter.next('prop').then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, true);
+ assert.sameValue(x.prop, 22);
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-null.js
new file mode 100644
index 0000000000..a70c3dc021
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-null.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-null.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is `null`, a TypeError should be thrown. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([{ x }] of [[null]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined-hole.js
new file mode 100644
index 0000000000..0de7721145
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined-hole.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-undefined-hole.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is a "hole", a TypeError should be thrown. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([{ x }] of [[ , ]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined-own.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined-own.js
new file mode 100644
index 0000000000..996b41e5b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined-own.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-undefined-own.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is `undefined`, a TypeError should be thrown. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([{ x }] of [[undefined]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined.js
new file mode 100644
index 0000000000..d768f7cb5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-undefined.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-undefined.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and no value is defined, a TypeError should be thrown. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([{ x }] of [[]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-yield-expr.js
new file mode 100644
index 0000000000..53610bed18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj-yield-expr.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it behaves as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([{ x = yield }] of [[{}]]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, false);
+ assert.sameValue(x, undefined);
+
+ iter.next(4).then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, true);
+ assert.sameValue(x, 4);
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj.js
new file mode 100644
index 0000000000..0fe44214d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-nested-obj.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-nested-obj.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([{ x }] of [[{ x: 2 }]]) {
+ assert.sameValue(x, 2);
+
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-const.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-const.js
new file mode 100644
index 0000000000..f98c976527
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-const.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-const.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The assignment target should obey `const` semantics. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [const, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+const c = null;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ c ] of [[1]]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref-no-get.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref-no-get.js
new file mode 100644
index 0000000000..699fa733ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref-no-get.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-prop-ref-no-get.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, setValue;
+x = {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([x.y] of [[23]]) {
+ assert.sameValue(setValue, 23);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref-user-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref-user-err.js
new file mode 100644
index 0000000000..3880421c06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref-user-err.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-prop-ref-user-err.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Any error raised as a result of setting the value should be forwarded to the runtime. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {
+ set y(val) {
+ throw new Test262Error();
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([x.y] of [[23]
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, Test262Error);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref.js
new file mode 100644
index 0000000000..8fa0bdd32d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-prop-ref.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-prop-ref.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([x.y] of [[4]]) {
+ assert.sameValue(x.y, 4);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..d9484d887e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-unresolvable-no-strict.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-unresolvable-no-strict.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ unresolvable ] of [[]]) {
+ assert.sameValue(unresolvable, undefined);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-unresolvable-strict-strict.js
new file mode 100644
index 0000000000..f6df9eafce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-put-unresolvable-strict-strict.js
@@ -0,0 +1,44 @@
+// |reftest| async
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-put-unresolvable-strict.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, onlyStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ unresolvable ] of [[]
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, ReferenceError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-target-simple-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-target-simple-no-strict.js
new file mode 100644
index 0000000000..3276ff23f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-target-simple-no-strict.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-target-simple-no-strict.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let argument, eval;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([arguments, eval] of [[2, 3]]) {
+ assert.sameValue(arguments, 2);
+ assert.sameValue(eval, 3);
+
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-target-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-target-yield-expr.js
new file mode 100644
index 0000000000..26a22ec1f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-target-yield-expr.js
@@ -0,0 +1,55 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-target-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement within a generator function body, it behaves as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let value = [33];
+let x = {};
+let iterationResult;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x[yield] ] of [[33]
+
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(iterationResult => {
+ assert.sameValue(iterationResult.value, undefined);
+ assert.sameValue(iterationResult.done, false);
+ assert.sameValue(x.prop, undefined);
+
+ iter.next('prop').then(iterationResult => {
+ assert.sameValue(iterationResult.value, undefined);
+ assert.sameValue(iterationResult.done, true);
+ assert.sameValue(x.prop, 33);
+ }).then($DONE, $DONE);
+});
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-err.js
new file mode 100644
index 0000000000..e39b6702a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-err.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-elision-iter-nrml-close-err.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: Abrupt completion returned from IteratorClose (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 6. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+ [...]
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let x;
+let iterator = {
+ next() {
+ nextCount += 1;
+
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ returnCount += 1;
+ throw new Test262Error();
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x , , ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(nextCount, 2);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(constructor, Test262Error);
+}).then($DONE, $DONE);
+
+
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-null.js
new file mode 100644
index 0000000000..49ab96979c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-null.js
@@ -0,0 +1,85 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-elision-iter-nrml-close-null.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 6. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+ [...]
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+ 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
+ exception.
+
+---*/
+let x;
+let nextCount = 0;
+let iterator = {
+ next() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ return null;
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x , , ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(nextCount, 2);
+ assert.sameValue(constructor, TypeError);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-skip.js
new file mode 100644
index 0000000000..53f159aae9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close-skip.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-elision-iter-nrml-close-skip.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose not invoked when elision exhausts the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 5. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+
+ [...]
+
+ 7. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ 9. Return Completion(status).
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let x;
+let iterator = {
+ next() {
+ nextCount += 1;
+
+ return { done: nextCount > 1 };
+ },
+ return() {
+ returnCount += 1;
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x , , ] of [iterable]) {
+ assert.sameValue(nextCount, 2);
+ assert.sameValue(returnCount, 0);
+
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close.js
new file mode 100644
index 0000000000..b2990c00dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-elision-iter-nrml-close.js
@@ -0,0 +1,94 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-elision-iter-nrml-close.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose invoked when elision does not exhaust the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 5. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+
+ [...]
+
+ 7. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+
+ 7.4.6 IteratorClose ( iterator, completion )
+
+ [...]
+ 5. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let thisValue = null;
+let args = null;
+let x;
+let iterator = {
+ next() {
+ nextCount += 1;
+
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x , , ] of [iterable]) {
+ assert.sameValue(nextCount, 2);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close-err.js
new file mode 100644
index 0000000000..23238efa46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close-err.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-list-nrml-close-err.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: Abrupt completion returned from IteratorClose (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 2. Let iteratorRecord be Record {[[Iterator]]: iterator, [[Done]]: false}.
+ 3. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 4. If status is an abrupt completion, then
+ a. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
+ b. Return Completion(status).
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let thrower = function() {
+ throw new Test262Error();
+};
+let x;
+let iterator = {
+ next() {
+ nextCount += 1;
+ return { done: nextCount > 10 };
+ },
+ return() {
+ returnCount += 1;
+ throw new Test262Error();
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x , ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(constructor, Test262Error);
+}).then($DONE, $DONE);
+
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close-skip.js
new file mode 100644
index 0000000000..9ab6342057
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close-skip.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-list-nrml-close-skip.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose is not invoked when evaluation of AssignmentElementList exhausts the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 2. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 3. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 4. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let thrower = function() {
+ throw new Test262Error();
+};
+let x;
+let iterator = {
+ next() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return() {
+ returnCount += 1;
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x , ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close.js
new file mode 100644
index 0000000000..22d6c2c046
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-nrml-close.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-list-nrml-close.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose is invoked when evaluation of AssignmentElementList completes without exhausting the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 2. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 3. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 4. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+ 7.4.6 IteratorClose ( iterator, completion )
+
+ [...]
+ 5. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let thisValue = null;
+let args = null;
+let x;
+let iterator = {
+ next() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x , ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-thrw-close-skip.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-thrw-close-skip.js
new file mode 100644
index 0000000000..cac04d3d82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-list-thrw-close-skip.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-list-thrw-close-skip.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose is not invoked when evaluation of AssignmentElementList returns an abrupt completion and the iterator has been marked as "done" (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let iterable = {};
+let thrower = function() {
+ throw new Test262Error();
+};
+let iterator = {
+ next() {
+ nextCount += 1;
+ throw new Test262Error();
+ },
+ return() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x , ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+ assert.sameValue(iterCount, 0);
+ assert.sameValue(constructor, Test262Error);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-rest-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-rest-nrml-close-skip.js
new file mode 100644
index 0000000000..3e8ec83f3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elem-trlg-iter-rest-nrml-close-skip.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elem-trlg-iter-rest-nrml-close-skip.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose is not called when rest element evaluation has exhausted the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 6. If AssignmentRestElement is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 7. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, status).
+ 8. Return Completion(status).
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let x, y;
+let iterator = {
+ next() {
+ nextCount += 1;
+ return { value: nextCount, done: nextCount > 1 };
+ },
+ return() {
+ returnCount += 1;
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ x , ...y ] of [iterable]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(() => {
+ iter.return().then(() => {
+ assert.sameValue(nextCount, 2, 'nextCount');
+ assert.sameValue(returnCount, 0, 'returnCount');
+ assert.sameValue(x, 1, 'x');
+ assert.sameValue(y.length, 0, 'y.length');
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-iter-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-iter-nrml-close-skip.js
new file mode 100644
index 0000000000..2435e768d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-iter-nrml-close-skip.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elision-iter-nrml-close-skip.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose is not called when iteration has exhausted the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elision ]
+
+ 1. Let iterator be ? GetIterator(value).
+
+ [...]
+
+ 4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result)..
+ [...]
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let iterator = {
+ next() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return() {
+ returnCount += 1;
+ return {};
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ , ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-iter-nrml-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-iter-nrml-close.js
new file mode 100644
index 0000000000..a4f8ac92cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-iter-nrml-close.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elision-iter-nrml-close.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose is called when assignment evaluation has not exhausted the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elision ]
+
+ 1. Let iterator be ? GetIterator(value).
+
+ [...]
+
+ 4. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result)..
+ [...]
+
+ 7.4.6 IteratorClose ( iterator, completion )
+
+ [...]
+ 5. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let thisValue = null;
+let args = null;
+let iterator = {
+ next() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ , ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-val-array.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-val-array.js
new file mode 100644
index 0000000000..ce8c2e2299
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-val-array.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elision-val-array.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ([,] of [[]
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-val-string.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-val-string.js
new file mode 100644
index 0000000000..e6beb05b35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-elision-val-string.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-elision-val-string.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ([,] of ['string literal'
+
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-iter-close.js
new file mode 100644
index 0000000000..4afab5f0d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-iter-close.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-empty-iter-close.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: Iterator is closed without iterating (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ ]
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+ 3. Return IteratorClose(iterator, NormalCompletion(empty)).
+
+ 7.4.6 IteratorClose ( iterator, completion )
+
+ [...]
+ 5. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let thisValue = null;
+let args = null;
+let iterator = {
+ next() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([] of [iterable]) {
+ assert.sameValue(nextCount, 0);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-val-array.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-val-array.js
new file mode 100644
index 0000000000..3b0d2c6f35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-val-array.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-empty-val-array.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ([] of [[]
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-val-string.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-val-string.js
new file mode 100644
index 0000000000..2c5cdd4ef1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-empty-val-string.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-empty-val-string.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ([] of ['string literal'
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-after-element.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-after-element.js
new file mode 100644
index 0000000000..15850f5d71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-after-element.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-after-element.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An AssignmentRestElement following an AssignmentElement consumes all remaining iterable values. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([x, ...y] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y.length, 2);
+ assert.sameValue(y[0], 2);
+ assert.sameValue(y[1], 3);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-after-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-after-elision.js
new file mode 100644
index 0000000000..d39640d596
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-after-elision.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-after-elision.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An AssignmentRestElement following an elision consumes all remaining iterable values. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([, ...x] of [[1, 2, 3]]) {
+ assert.sameValue(x.length, 2);
+ assert.sameValue(x[0], 2);
+ assert.sameValue(x[1], 3);
+
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-elision.js
new file mode 100644
index 0000000000..77db3d5337
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-elision.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-elision.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: ArrayAssignmentPattern may include elisions at any position preceding a AssignmentRestElement in a AssignmentElementList. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([, , x, , ...y] of [[1, 2, 3, 4, 5, 6]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y.length, 2);
+ assert.sameValue(y[0], 5);
+ assert.sameValue(y[1], 6);
+
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-iter-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-iter-nrml-close-skip.js
new file mode 100644
index 0000000000..f794208314
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-iter-nrml-close-skip.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-iter-nrml-close-skip.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: IteratorClose is not called when assignment evaluation has exhausted the iterator (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 4. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 5. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
+ 6. Return result.
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let x;
+let iterator = {
+ next() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return() {
+ returnCount += 1;
+ }
+};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ ...x ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-iteration.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-iteration.js
new file mode 100644
index 0000000000..cc4a95b005
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-iteration.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-iteration.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: In the presense of an AssignmentRestElement, value iteration exhausts the iterable value; (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let count = 0;
+let g = function*() {
+ count += 1;
+ yield;
+ count += 1;
+ yield;
+ count += 1;
+}
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...x] of [g()]) {
+ assert.sameValue(count, 3);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-lref.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-lref.js
new file mode 100644
index 0000000000..1f7b06d136
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-lref.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-lref.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: Reference is evaluated during assignment (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 4. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 5. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iterator, result).
+
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
+ ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+ [...]
+
+---*/
+let nextCount = 0;
+let returnCount = 0;
+let iterator = {
+ next() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return() {
+ returnCount += 1;
+ }
+};
+let obj = {};
+let iterable = {
+ [Symbol.iterator]() {
+ return iterator;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...obj['a' + 'b']] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+ assert(!!obj.ab);
+ assert.sameValue(obj.ab.length, 0);
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-null.js
new file mode 100644
index 0000000000..1ed8a5853e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-null.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-null.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable emits `null` as the only value, an array with a single `null` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...[x, y]] of [[null]]) {
+ assert.sameValue(x, null);
+ assert.sameValue(y, undefined);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined-hole.js
new file mode 100644
index 0000000000..3628b3ed78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined-hole.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-undefined-hole.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable is an array with a "hole", an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...[x]] of [[ , ]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined-own.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined-own.js
new file mode 100644
index 0000000000..a0f699d0df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined-own.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-undefined-own.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable emits `undefined` as the only value, an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...[x]] of [[undefined]]) {
+ assert.sameValue(x, undefined);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined.js
new file mode 100644
index 0000000000..f57a9b3d91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-undefined.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-undefined.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable is emits no values, an empty array should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...[x]] of [[]]) {
+ assert.sameValue(x, undefined);
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-yield-expr.js
new file mode 100644
index 0000000000..f3749215b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array-yield-expr.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {};
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...[x[yield]]] of [[86]]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(iterationResult => {
+ assert.sameValue(iterationResult.value, undefined);
+ assert.sameValue(iterationResult.done, false);
+ assert.sameValue(x.prop, undefined);
+
+ iter.next('prop').then(iterationResult => {
+ assert.sameValue(iterationResult.value, undefined);
+ assert.sameValue(iterationResult.done, true);
+ assert.sameValue(x.prop, 86);
+ }).then($DONE, $DONE);
+});
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array.js
new file mode 100644
index 0000000000..f927230cdf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-array.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-array.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...[x]] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-null.js
new file mode 100644
index 0000000000..f4fdebbec7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-null.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-null.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the iterable emits `null` as the only value, an array with a single `null` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, length;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...{ 0: x, length }] of [[null]]) {
+ assert.sameValue(x, null);
+ assert.sameValue(length, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined-hole.js
new file mode 100644
index 0000000000..930cd51a7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined-hole.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-undefined-hole.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable is an array with a "hole", an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
+// where length and name are properties of WindowProxy
+let length;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...{ 0: x, length }] of [[ , ]]) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(length, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined-own.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined-own.js
new file mode 100644
index 0000000000..9afe34ec1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined-own.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-undefined-own.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable emits `undefined` as the only value, an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
+// where length and name are properties of WindowProxy
+let length;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...{ 0: x, length }] of [[undefined]]) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(length, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined.js
new file mode 100644
index 0000000000..4834ca72f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-undefined.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-undefined.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an obect literal and the iterable is emits no values, an empty array should be used as the value of the nested DestructuringAssignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
+// where length and name are properties of WindowProxy
+let length;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...{ 0: x, length }] of [[]]) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(length, 0);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-yield-expr.js
new file mode 100644
index 0000000000..a4c9290b7b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj-yield-expr.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...{ x = yield }] of [[{}]]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(iterationResult => {
+ assert.sameValue(iterationResult.value, undefined);
+ assert.sameValue(iterationResult.done, false);
+ assert.sameValue(x, undefined);
+
+ iter.next(4).then(iterationResult => {
+ assert.sameValue(iterationResult.value, undefined);
+ assert.sameValue(iterationResult.done, true);
+ assert.sameValue(x, 4);
+ }).then($DONE, $DONE);
+});
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj.js
new file mode 100644
index 0000000000..26940a44d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-nested-obj.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-nested-obj.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...{ 1: x }] of [[1, 2, 3]]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-prop-ref-no-get.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-prop-ref-no-get.js
new file mode 100644
index 0000000000..ae2a380d03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-prop-ref-no-get.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-put-prop-ref-no-get.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let setValue;
+let x = {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...x.y] of [[23, 45, 99]]) {
+ assert.sameValue(setValue.length, 3);
+ assert.sameValue(setValue[0], 23);
+ assert.sameValue(setValue[1], 45);
+ assert.sameValue(setValue[2], 99);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-prop-ref.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-prop-ref.js
new file mode 100644
index 0000000000..bd4cc03b94
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-prop-ref.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-put-prop-ref.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {};
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...x.y] of [[4, 3, 2]]) {
+ assert.sameValue(x.y.length, 3);
+ assert.sameValue(x.y[0], 4);
+ assert.sameValue(x.y[1], 3);
+ assert.sameValue(x.y[2], 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..d1cee94575
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-put-unresolvable-no-strict.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-put-unresolvable-no-strict.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ([ ...unresolvable ] of [[]]) {
+ assert.sameValue(unresolvable.length, 0);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-yield-expr.js
new file mode 100644
index 0000000000..411a465739
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-array-rest-yield-expr.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/array-rest-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentRestElement and within the body of a generator function, it should behave as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {};
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ([...x[yield]] of [[33, 44, 55]]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(iterationResult => {
+ assert.sameValue(iterationResult.value, undefined);
+ assert.sameValue(iterationResult.done, false);
+ assert.sameValue(x.prop, undefined);
+
+ iter.next('prop').then(iterationResult => {
+ assert.sameValue(iterationResult.value, undefined);
+ assert.sameValue(iterationResult.done, true);
+ assert.sameValue(x.prop.length, 3);
+ assert.sameValue(x.prop[0], 33);
+ assert.sameValue(x.prop[1], 44);
+ assert.sameValue(x.prop[2], 55);
+ assert.sameValue(iterCount, 1);
+ }).then($DONE, $DONE);
+});
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-bool.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-bool.js
new file mode 100644
index 0000000000..f7691736b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-bool.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-bool.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (boolean value) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ({} of [false]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-num.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-num.js
new file mode 100644
index 0000000000..8b75c2640e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-num.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-num.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (number value) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ({} of [0
+]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-obj.js
new file mode 100644
index 0000000000..0d75b22d6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-obj.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-obj.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (object value) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ({} of [{}]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-string.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-string.js
new file mode 100644
index 0000000000..6bd00b4d73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-string.js
@@ -0,0 +1,41 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-string.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (string value) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+let iterCount = 0;
+async function * fn() {
+ for await ({} of ['']) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-symbol.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-symbol.js
new file mode 100644
index 0000000000..99a940350a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-empty-symbol.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-empty-symbol.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (symbol value) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let s = Symbol();
+
+let iterCount = 0;
+async function * fn() {
+ for await ({} of [s]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-first.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-first.js
new file mode 100644
index 0000000000..a095a55f7b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-first.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-first.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (first of many) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x, y } of [{ x: 3 }]) {
+ assert.sameValue(x, 3);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-last.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-last.js
new file mode 100644
index 0000000000..af16fd7b3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-last.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-last.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (last of many) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let w;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ w, x } of [{ x: 4 }]) {
+ assert.sameValue(x, 4);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-lone.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-lone.js
new file mode 100644
index 0000000000..40c3ed7028
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-lone.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-lone.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone identifier) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x, } of [{ x: 2 }]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-middle.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-middle.js
new file mode 100644
index 0000000000..9e8bdaf3f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-middle.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-middle.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (within many) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let w, y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ w, x, y } of [{ x: 5 }]) {
+ assert.sameValue(x, 5);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-trlng.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-trlng.js
new file mode 100644
index 0000000000..aaf3ccd209
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-identifier-resolution-trlng.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-identifier-resolution-trlng.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone identifier with trailing comma) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x } of [{ x: 1 }]) {
+ assert.sameValue(x, 1);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-missing.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-missing.js
new file mode 100644
index 0000000000..d42b41ead6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-missing.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-assignment-missing.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (no corresponding property defined). (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x = 1 } of [{}]) {
+ assert.sameValue(x, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-null.js
new file mode 100644
index 0000000000..2a1a082f52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-null.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-assignment-null.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (null property value defined). (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x = 1 } of [{ x: null }]) {
+ assert.sameValue(x, null);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-truthy.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-truthy.js
new file mode 100644
index 0000000000..f864840f10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-truthy.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-assignment-truthy.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (truthy property value defined). (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x = 1 } of [{ x: 2 }]) {
+ assert.sameValue(x, 2);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-undef.js
new file mode 100644
index 0000000000..62d7dc4c89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-assignment-undef.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-assignment-undef.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference ("undefined" property value defined). (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x = 1 } of [{ x: undefined }]) {
+ assert.sameValue(x, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-evaluation.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-evaluation.js
new file mode 100644
index 0000000000..fd45946338
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-evaluation.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-evaluation.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The Initializer should only be evaluated if v is undefined. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let flag1 = false;
+let flag2 = false;
+let x, y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x = flag1 = true, y = flag2 = true } of [{ y: 1 }]) {
+ assert.sameValue(flag1, true);
+ assert.sameValue(flag2, false);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..2a37d1d9a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-arrow.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-arrow.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (ArrowFunction) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let arrow;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ arrow = () => {} } of [{}]) {
+ verifyProperty(arrow, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'arrow'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-class.js
new file mode 100644
index 0000000000..ee88417a4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-class.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-class.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (ClassExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let xCls, cls, xCls2;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } } of [{}]) {
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ verifyProperty(cls, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cls'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..bb33fc5e1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-cover.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-cover.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (CoverParenthesizedExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let xCover, cover;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ xCover = (0, function() {}), cover = (function() {}) } of [{}]) {
+ assert.notSameValue(xCover.name, 'xCover');
+
+ verifyProperty(cover, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cover'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..cbb5298b54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-fn.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-fn.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (FunctionExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let xFnexp, fnexp;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ xFnexp = function x() {}, fnexp = function() {} } of [{}]) {
+ assert.notSameValue(xFnexp.name, 'xFnexp');
+
+ verifyProperty(fnexp, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'fnexp'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..a79e9447bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-fn-name-gen.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-fn-name-gen.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (GeneratorExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+let xGen, gen;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ xGen = function* x() {}, gen = function*() {} } of [{}]) {
+ assert.notSameValue(xGen.name, 'xGen');
+
+ verifyProperty(gen, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'gen'
+ });
+
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-in.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-in.js
new file mode 100644
index 0000000000..07b837f0eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-in.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-in.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The Initializer in an AssignmentProperty may be an `in` expression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let prop;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ prop = 'x' in {} } of [{}]) {
+ assert.sameValue(prop, false);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-order.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-order.js
new file mode 100644
index 0000000000..d26397f6e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-order.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-order.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Initializer values should be assigned in left-to-right order. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = 0;
+let a, b;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ a = x += 1, b = x *= 2 } of [{}]) {
+ assert.sameValue(a, 1);
+ assert.sameValue(b, 2);
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-simple-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-simple-no-strict.js
new file mode 100644
index 0000000000..d9e2dbf228
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-simple-no-strict.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-simple-no-strict.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let eval, arguments;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ eval = 3, arguments = 4 } of [{}]) {
+ assert.sameValue(eval, 3);
+ assert.sameValue(arguments, 4);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-yield-expr.js
new file mode 100644
index 0000000000..f831a39cb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-init-yield-expr.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-init-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentProperty and within a generator function body, it should behave as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x = yield } of [{}]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, false);
+ assert.sameValue(x, undefined);
+
+ iter.next(3).then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, true);
+ assert.sameValue(x, 3);
+ }).then($DONE, $DONE);
+});
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..2812364b98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-put-unresolvable-no-strict.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-put-unresolvable-no-strict.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+{
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ unresolvable } of [{}]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => {
+ assert.sameValue(unresolvable, undefined);
+ assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+ }, $DONE)
+ .then($DONE, $DONE);
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-simple-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-simple-no-strict.js
new file mode 100644
index 0000000000..8cb069a2ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-id-simple-no-strict.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-id-simple-no-strict.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let eval;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ eval } of [{ eval: 1 }]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => {
+ assert.sameValue(eval, 1);
+ assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+ }, $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-missing.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-missing.js
new file mode 100644
index 0000000000..180b928f28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-missing.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-assignment-missing.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (non-existent property) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ y: x = 1 } of [{}]) {
+ assert.sameValue(x, 1);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-null.js
new file mode 100644
index 0000000000..16e6c2ac95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-null.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-assignment-null.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the Initializer is present and v is not undefined, the Initializer should be evaluated and the result assigned to the target reference (null value) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ y: x = 1 } of [{ y: null }]) {
+ assert.sameValue(x, null);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-truthy.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-truthy.js
new file mode 100644
index 0000000000..205a23a245
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-truthy.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-assignment-truthy.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the Initializer is present and v is not undefined, the Initializer should be evaluated and the result assigned to the target reference (truthy value) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ y: x = 1 } of [{ y: 2 }]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-undef.js
new file mode 100644
index 0000000000..10121c5ffb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-assignment-undef.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-assignment-undef.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (undefined value) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ y: x = 1 } of [{ y: undefined }]) {
+ assert.sameValue(x, 1);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-evaluation.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-evaluation.js
new file mode 100644
index 0000000000..9d3d1ae8bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-evaluation.js
@@ -0,0 +1,48 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-evaluation.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The Initializer should only be evaluated if v is undefined. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let flag1 = false;
+let flag2 = false;
+let x, y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: x = flag1 = true, y: y = flag2 = true } of [{ y: 1 }]) {
+ assert.sameValue(x, true, 'value of `x`');
+ assert.sameValue(flag1, true, 'value of `flag1`');
+ assert.sameValue(y, 1, 'value of `y`');
+ assert.sameValue(flag2, false, 'value of `flag2`');
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-arrow.js
new file mode 100644
index 0000000000..e57bf67dbf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-arrow.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-arrow.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (ArrowFunction) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let arrow;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: arrow = () => {} } of [{}]) {
+ verifyProperty(arrow, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'arrow'
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-class.js
new file mode 100644
index 0000000000..4f0fad13a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-class.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-class.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (ClassExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let xCls, cls, xCls2;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: xCls = class x {}, x: cls = class {}, x: xCls2 = class { static name() {} } } of [{}]) {
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ verifyProperty(cls, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cls'
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-cover.js
new file mode 100644
index 0000000000..5964705d0c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-cover.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-cover.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (CoverParenthesizedExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let xCover, cover;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: xCover = (0, function() {}), x: cover = (function() {}) } of [{}]) {
+ assert.notSameValue(xCover.name, 'xCover');
+
+ verifyProperty(cover, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cover'
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-fn.js
new file mode 100644
index 0000000000..be988c8b65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-fn.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-fn.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (FunctionExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let xFnexp, fnexp;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: xFnexp = function x() {}, x: fnexp = function() {} } of [{}]) {
+ assert.notSameValue(xFnexp.name, 'xFnexp');
+
+ verifyProperty(fnexp, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'fnexp'
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-gen.js
new file mode 100644
index 0000000000..caeca6b7b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-fn-name-gen.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-fn-name-gen.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Assignment of function `name` attribute (GeneratorExpression) (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 6. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be ? HasOwnProperty(rhsValue, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(rhsValue, GetReferencedName(lref)).
+
+---*/
+let xGen, gen;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: xGen = function* x() {}, x: gen = function*() {} } of [{}]) {
+ assert.notSameValue(xGen.name, 'xGen');
+
+ verifyProperty(gen, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'gen'
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-in.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-in.js
new file mode 100644
index 0000000000..3caee8d3c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-in.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-in.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The Initializer in an AssignmentElement may be an `in` expression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let prop;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: prop = 'x' in {} } of [{}]) {
+ assert.sameValue(prop, false);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-yield-expr.js
new file mode 100644
index 0000000000..b043ccd363
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-init-yield-expr.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-init-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement and within a generator function body, it should behave as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: x = yield } of [{}]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, false);
+ assert.sameValue(x, undefined);
+
+ iter.next(86).then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, true);
+ assert.sameValue(x, 86);
+ }).then($DONE, $DONE);
+});
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-target-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-target-yield-expr.js
new file mode 100644
index 0000000000..93443810fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-elem-target-yield-expr.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-elem-target-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and within a generator function body, it should behave as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {};
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: x[yield] } of [{ x: 23 }]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, false);
+ assert.sameValue(x.prop, undefined);
+
+ iter.next('prop').then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, true);
+ assert.sameValue(x.prop, 23);
+ }).then($DONE, $DONE);
+});
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-first.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-first.js
new file mode 100644
index 0000000000..2fa0ea057f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-first.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-first.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (first of many). (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ a: x, y } of [{ a: 3 }]) {
+ assert.sameValue(x, 3);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-last.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-last.js
new file mode 100644
index 0000000000..166fbd9e28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-last.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-last.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (last of many). (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let w;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ w, a: x } of [{ a: 4 }]) {
+ assert.sameValue(x, 4);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-lone.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-lone.js
new file mode 100644
index 0000000000..802e6d5e04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-lone.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-lone.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone element). (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ a: x } of [{ a: 1 }]) {
+ assert.sameValue(x, 1);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-middle.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-middle.js
new file mode 100644
index 0000000000..bfa2d3e605
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-middle.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-middle.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (within many). (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+let w, y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ w, a: x, y } of [{ a: 5 }]) {
+ assert.sameValue(x, 5);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-trlng.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-trlng.js
new file mode 100644
index 0000000000..f1ee18019a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-identifier-resolution-trlng.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-identifier-resolution-trlng.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone element with trailing comma). (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = null;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ a: x, } of [{ a: 2 }]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-name-evaluation.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-name-evaluation.js
new file mode 100644
index 0000000000..c68005f71e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-name-evaluation.js
@@ -0,0 +1,45 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-name-evaluation.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: PropertyName of an AssignmentProperty may be a ComputedPropertyName. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x, y, xy;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ ['x' + 'y']: x } of [{ x: 1, xy: 23, y: 2 }]) {
+ assert.sameValue(x, 23);
+ assert.sameValue(y, undefined);
+ assert.sameValue(xy, undefined);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-array-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-array-yield-expr.js
new file mode 100644
index 0000000000..cbdc78fa7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-array-yield-expr.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-nested-array-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: [x = yield] } of [{ x: [] }]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, false);
+ assert.sameValue(x, undefined);
+
+ iter.next(24601).then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, true);
+ assert.sameValue(x, 24601);
+ }).then($DONE, $DONE);
+});
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-array.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-array.js
new file mode 100644
index 0000000000..d9618345b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-array.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-nested-array.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: [y] } of [{ x: [321] }]) {
+ assert.sameValue(y, 321);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-obj-yield-expr.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-obj-yield-expr.js
new file mode 100644
index 0000000000..f61ef9e60a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-obj-yield-expr.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-nested-obj-yield-expr.case
+// - src/dstr-assignment-for-await/async-generator/async-gen-decl.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = undefined;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: { x = yield } } of [{ x: {} }]) {
+
+ iterCount += 1;
+ }
+}
+
+let iter = fn();
+
+iter.next().then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, false);
+ assert.sameValue(x, undefined);
+
+ iter.next(4).then(result => {
+ assert.sameValue(result.value, undefined);
+ assert.sameValue(result.done, true);
+ assert.sameValue(x, 4);
+ }).then($DONE, $DONE);
+});
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-obj.js
new file mode 100644
index 0000000000..3fd9d13f01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-nested-obj.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-nested-obj.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let result, y;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: { y } } of [{ x: { y: 2 } }]) {
+ assert.sameValue(y, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-order.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-order.js
new file mode 100644
index 0000000000..5dfc8b3b9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-order.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-put-order.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The AssignmentElements in an AssignmentElementList are evaluated in left- to-right order. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ z: x, a: x } of [{ a: 2, z: 1 }]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-prop-ref-no-get.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-prop-ref-no-get.js
new file mode 100644
index 0000000000..a308ca07ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-prop-ref-no-get.js
@@ -0,0 +1,50 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-put-prop-ref-no-get.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let setValue;
+let x = {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+};
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ a: x.y } of [{ a: 23 }]) {
+ assert.sameValue(setValue, 23);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-prop-ref.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-prop-ref.js
new file mode 100644
index 0000000000..2692d2127a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-prop-ref.js
@@ -0,0 +1,42 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-put-prop-ref.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x = {};
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ xy: x.y } of [{ xy: 4 }]) {
+ assert.sameValue(x.y, 4);
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..01e67f9471
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-prop-put-unresolvable-no-strict.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-prop-put-unresolvable-no-strict.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding, async-iteration]
+flags: [generated, noStrict, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+{
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x: unresolvable } of [{}]) {
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => {
+ assert.sameValue(unresolvable, undefined);
+ assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+ }, $DONE)
+ .then($DONE, $DONE);
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-descriptors.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-descriptors.js
new file mode 100644
index 0000000000..f3a9e8abe8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-descriptors.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-descriptors.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Object created from rest deconstruction doesn't copy source object property descriptors. (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+let obj = {};
+Object.defineProperty(obj, "a", { value: 3, configurable: false, enumerable: true });
+Object.defineProperty(obj, "b", { value: 4, writable: false, enumerable: true });
+
+let iterCount = 0;
+async function * fn() {
+ for await ({...rest} of [obj]) {
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-empty-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-empty-obj.js
new file mode 100644
index 0000000000..af7cfaad45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-empty-obj.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-empty-obj.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: RestBindingInitialization creates a new object even if lhs is an empty object (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ({...rest} of [{}]) {
+ assert.notSameValue(rest, undefined);
+ assert.notSameValue(rest, null);
+ assert.sameValue(typeof rest, "object");
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-getter.js
new file mode 100644
index 0000000000..c54b5ba60b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-getter.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-getter.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let x;
+let count = 0;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({...x} of [{ get v() { count++; return 2; } }]) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-number.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-number.js
new file mode 100644
index 0000000000..6f6f837b71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-number.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-number.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: RestBindingInitialization creates a new object even if lhs is a Number (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ({...rest} of [51]) {
+ assert.notSameValue(rest, undefined);
+ assert.notSameValue(rest, null);
+ assert(rest instanceof Object);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-same-name.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-same-name.js
new file mode 100644
index 0000000000..fde8c78a3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-same-name.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-same-name.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Proper setting in the values for rest name equal to a property name. (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let o = {
+ x: 42,
+ y: 39,
+ z: 'cheeseburger'
+};
+
+let x, y, z;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({ x, ...z } of [o]) {
+ assert.sameValue(x, 42);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z.y, 39);
+ assert.sameValue(z.z, 'cheeseburger');
+
+ let keys = Object.getOwnPropertyNames(z);
+ assert.sameValue(keys.length, 2);
+ assert.sameValue(keys[0], 'y');
+ assert.sameValue(keys[1], 'z');
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..f564d3ada6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-skip-non-enumerable.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-skip-non-enumerable.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+let obj = {a: 3, b: 4};
+Object.defineProperty(obj, "x", { value: 4, enumerable: false });
+
+let iterCount = 0;
+async function * fn() {
+ for await ({...rest} of [obj]) {
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "x"), undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-str-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-str-val.js
new file mode 100644
index 0000000000..ccb96eb575
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-str-val.js
@@ -0,0 +1,47 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-str-val.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: RestBindingInitialization creats an object with indexes as property name (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ({...rest} of ["foo"]) {
+ assert.sameValue(rest["0"], "f");
+ assert.sameValue(rest["1"], "o");
+ assert.sameValue(rest["2"], "o");
+ assert(rest instanceof Object);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-symbol-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-symbol-val.js
new file mode 100644
index 0000000000..bfb3c7c4b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-symbol-val.js
@@ -0,0 +1,46 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-symbol-val.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: RestBindingInitialization creates a new object if lhs is a Symbol (for-await-of statement in an async generator declaration)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, Symbol, destructuring-binding, async-iteration]
+flags: [generated, async]
+info: |
+ IterationStatement :
+ for await ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ({...rest} of [Symbol("foo")]) {
+ assert.notSameValue(rest, undefined);
+ assert.notSameValue(rest, null);
+ assert(rest instanceof Object);
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-to-property-with-setter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-to-property-with-setter.js
new file mode 100644
index 0000000000..e924f39069
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-to-property-with-setter.js
@@ -0,0 +1,55 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-to-property-with-setter.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object property setter, its value should be binded as rest object. (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let settedValue;
+let executedGetter = false;
+let src = {
+ get y() {
+ executedGetter = true;
+ },
+ set y(v) {
+ settedValue = v;
+ },
+};
+src.y = undefined;
+
+let iterCount = 0;
+async function * fn() {
+ for await ({...src.y} of [{ x: 1, y: 2}]) {
+ assert.sameValue(settedValue.x, 1);
+ assert.sameValue(settedValue.y, 2);
+ assert(!executedGetter, "The property should not be accessed");
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-to-property.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-to-property.js
new file mode 100644
index 0000000000..a66ec73fcc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-to-property.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-to-property.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: When DestructuringAssignmentTarget is an object property, its value should be binded as rest object. (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let src = {};
+
+let iterCount = 0;
+async function * fn() {
+ for await ({...src.y} of [{ x: 1, y: 2}]) {
+ assert.sameValue(src.y.x, 1);
+ assert.sameValue(src.y.y, 2);
+
+ verifyProperty(src, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-valid-object.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-valid-object.js
new file mode 100644
index 0000000000..32b3902752
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-decl-dstr-obj-rest-valid-object.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment-for-await/obj-rest-valid-object.case
+// - src/dstr-assignment-for-await/default/async-gen-decl.template
+/*---
+description: Rest object contains just unextracted data (for-await-of statement in an async generator declaration)
+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 ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+let rest, a, b;
+
+
+let iterCount = 0;
+async function * fn() {
+ for await ({a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+let promise = fn().next();
+
+promise
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-close.js
new file mode 100644
index 0000000000..6cec2e7ee6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-close.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..59c2465c32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-get-err.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-get-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Abrupt completion returned by GetIterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ 1. Let iterator be ? GetIterator(value).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+async function * gen() {
+ for await (const [x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..d354bb2487
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-init-iter-no-close.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-name-iter-val.js
new file mode 100644
index 0000000000..eefdd83b2e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-name-iter-val.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..9007021f74
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..0e2842263a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..8ba1b1cb60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..a6798fce97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..91ac0cad9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..fe2298da22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..5d25409871
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..37b3be9e1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..cd54a65f13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Nested array destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be ? GetIterator(value).
+---*/
+
+async function * gen() {
+ for await (const [[x]] of [[null]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..5f4be10de2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..ee72fb458c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..609ce3b405
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..a0c0939c46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..5d035888b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..74e82cef42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..af03294d93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..8cd70af980
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..5bef09fda3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Destructuring initializer returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+
+async function * gen() {
+ for await (const [x = (function() { throw new Test262Error(); })()] of [[undefined]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..2c86b964d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..9e8489bff9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function * gen() {
+ for await (const [ x = unresolvableReference ] of [[]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..e0f8fa2db5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..c91491cf8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..a2c148c7fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ throw new Test262Error();
+ }
+ };
+};
+
+async function * gen() {
+ for await (const [x] of [g]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..4875ad9171
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function * gen() {
+ for await (const [x] of [g]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..70287a039a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..ae049288f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..c7c6d3117e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..2b2f5bc987
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..499084ad63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..8b0de4325c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Nested object destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function * gen() {
+ for await (const [{ x }] of [[null]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..17f4bc966a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Nested object destructuring with a value of `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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function * gen() {
+ for await (const [{ x }] of [[]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..a509176939
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..cd306e16fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-gen-const.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function* fn() {
+ for await (const [,] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .next()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..f1ded0cf52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision-step-err.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+
+---*/
+var following = 0;
+var iter = function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+async function * gen() {
+ for await (const [,] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+ assert.sameValue(following, 0, "iterator is properly closed");
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision.js
new file mode 100644
index 0000000000..c273e78fa6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-elision.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-empty.js
new file mode 100644
index 0000000000..6aa317d85f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-empty.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-init-err.js
new file mode 100644
index 0000000000..4182780a63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-init-err.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for await (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function fn() {
+ for await (const [x] = 1 of []) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..c6efbb70d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..1df0095a47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,93 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..a1080bd08b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..5ecb46a0c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..51ac654414
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding-for-await/error/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 iter = (function*() { throw new Test262Error(); })();
+
+async function * gen() {
+ for await (const [, ...x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..dc0087c5fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..2e50476322
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..1bec78e7d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-gen-const.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function* fn() {
+ for await (const [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .next()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..aac96520f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+async function * gen() {
+ for await (const [...x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..e220ff4cf8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function * gen() {
+ for await (const [...x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..ff94d6b7d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..e49292c53c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..553e9d8fea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-id.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..9666c674e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..0f3f29caae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..9271ea8bf6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..ff9bc7efc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,62 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..755a742c23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..f20a857172
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+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.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-init-iter-close.js
new file mode 100644
index 0000000000..9ac5efed97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (const [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..7cd58a3df9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (const [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-name-iter-val.js
new file mode 100644
index 0000000000..84a99a08a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-name-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (const [x, y, z] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..3b3b201523
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..cbc2d85d21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[7, 8, 9]]];
+})();
+
+async function *fn() {
+ for await (const [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..989ebda481
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [[,] = g()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..5148322b14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[]]];
+})();
+
+async function *fn() {
+ for await (const [[,] = g()] of asyncIter) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..f0c5a8d09e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [[] = function() { initCount += 1; return iter; }()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..b52b44a78c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[23]]];
+})();
+
+async function *fn() {
+ for await (const [[] = function() { initCount += 1; }()] of asyncIter) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..980b98d5b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [[...x] = values] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..d91e2c27ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[values]];
+})();
+
+async function *fn() {
+ for await (const [[...x] = function() { initCount += 1; }()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..59ee1da1f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..cd556fc650
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [arrow = () => {}] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..532ccbf1eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..3613fc45c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [cover = (function () {}), xCover = (0, function() {})] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..73ceca7210
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [fn = function () {}, xFn = function x() {}] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..fd39deaf50
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [gen = function* () {}, xGen = function* x() {}] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..c263ff68ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[,]];
+})();
+
+async function *fn() {
+ for await (const [x = 23] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..f8492e5dfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[null, 0, false, '']];
+})();
+
+async function *fn() {
+ for await (const [w = counter(), x = counter(), y = counter(), z = counter()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..9c232e121b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[undefined]];
+})();
+
+async function *fn() {
+ for await (const [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..52e0933021
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..158a11f5ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [_, x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..f5ea9d3f8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (const [x, y, z] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..81acc40f05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..a5bc92f1bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ x: 11, y: 22, z: 33 }]];
+})();
+
+async function *fn() {
+ for await (const [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..58e42372b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..354846a40f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ u: 777, w: 888, y: 999 }]];
+})();
+
+async function *fn() {
+ for await (const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..3a74a065ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.template
+/*---
+description: Elision accepts exhausted iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (const [,] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elision.js
new file mode 100644
index 0000000000..b7ebceb517
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.template
+/*---
+description: Elision advances iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function *fn() {
+ for await (const [,] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-empty.js
new file mode 100644
index 0000000000..13287f15bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (const [] of asyncIter) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..3d012227c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[3, 4, 5]];
+})();
+
+async function *fn() {
+ for await (const [...[x, y, z]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..b5f9743481
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function *fn() {
+ for await (const [...[,]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..6a8594233f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (const [...[]] of asyncIter) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..44f0fcf3ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function *fn() {
+ for await (const [...[...x]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..ae0e190382
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function *fn() {
+ for await (const [ , , ...x] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..96c8375d65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2]];
+})();
+
+async function *fn() {
+ for await (const [, , ...x] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..898546f63e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function *fn() {
+ for await (const [...x] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..f4420e2b22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [...[ x ] = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..efc9fb724f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [...x = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..e995cfa3d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (const [...{ x } = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..cf1c1fcc0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (const [...[x], y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..339a57a067
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (const [...x, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..1a21c4035a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (const [...{ x }, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..aa8a03da44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (const [...{ length }] of asyncIter) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..3c4c6b960b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[7, 8, 9]];
+})();
+
+async function *fn() {
+ for await (const [...{ 0: v, 1: w, 2: x, 3: y, length: z }] of asyncIter) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-empty.js
new file mode 100644
index 0000000000..bb9ff7d45b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [obj];
+})();
+
+async function *fn() {
+ for await (const {} of asyncIter) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..6807d9aac5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (const { arrow = () => {} } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..8c4a64ef60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (const { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..c40dd1bb73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (const { cover = (function () {}), xCover = (0, function() {}) } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..f5f91cfbc9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (const { fn = function () {}, xFn = function x() {} } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..34382e743d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (const { gen = function* () {}, xGen = function* x() {} } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..13dfaed511
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: null, x: 0, y: false, z: '' }];
+})();
+
+async function *fn() {
+ for await (const { w = counter(), x = counter(), y = counter(), z = counter() } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..074cb709f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function *fn() {
+ for await (const { x, } of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..d4977ab61d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (const { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..ce42f37ae2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: [45] }];
+})();
+
+async function *fn() {
+ for await (const { x: [y], } of asyncIter) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..dd4b499fe4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: [7, undefined, ] }];
+})();
+
+async function *fn() {
+ for await (const { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..c9774412ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ s: null, u: 0, w: false, y: '' }];
+})();
+
+async function *fn() {
+ for await (const { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..d228fb884e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ }];
+})();
+
+async function *fn() {
+ for await (const { x: y = 33 } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..cb4e9545a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function *fn() {
+ for await (const { x: y, } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..0fe010e188
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function *fn() {
+ for await (const { x: y } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..1dca393613
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: undefined }];
+})();
+
+async function *fn() {
+ for await (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..2c23caa068
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: { x: undefined, z: 7 } }];
+})();
+
+async function *fn() {
+ for await (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..26e0b9447f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-getter.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ get v() { count++; return 2; } }];
+})();
+
+async function *fn() {
+ for await (const {...x} of asyncIter) {
+ assert.sameValue(x.v, 2);
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..a4a9143c6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [o];
+})();
+
+async function *fn() {
+ for await (const {...rest} of asyncIter) {
+ assert.sameValue(rest.a, 3);
+ assert.sameValue(rest.b, 4);
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..d76c8c96e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-async-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-const-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{x: 1, y: 2, a: 5, b: 3}];
+})();
+
+async function *fn() {
+ for await (const {a, b, ...rest} of asyncIter) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-init-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-init-null.js
new file mode 100644
index 0000000000..fdf23348d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-init-null.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function * gen() {
+ for await (const {} of [null]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-init-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-init-undefined.js
new file mode 100644
index 0000000000..2cc73ea41a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-init-undefined.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-undefined.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function * gen() {
+ for await (const {} of [undefined]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-empty.js
new file mode 100644
index 0000000000..63fd4dc67b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-empty.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..58936dcc28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function * gen() {
+ for await (const { poisoned } of [poisonedProperty]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..c79cc06842
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..791585672c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2b2049f5be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..99be94f242
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..c74cf15f45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..58755a3fe6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..47408bd506
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-throws.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (const { x = thrower() } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..0b28b3a76d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function * gen() {
+ for await (const { x = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..e5a90e7c49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-init-err.js
new file mode 100644
index 0000000000..8f00dc220c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-init-err.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for await (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function fn() {
+ for await (const {x} = 1 of []) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..62841bc8cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-list-err.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-list-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (const { a, b = thrower(), c = ++initCount } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..d5646be7cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..003954fa85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..269a7b68ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function * gen() {
+ for await (const { w: [x, y, z] = [4, 5, 6] } of [{ w: null }]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..04e81f7c3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-ary.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..99fc040723
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Evaluation of property name returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (const { [thrower()]: x } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..5d391e6f89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function * gen() {
+ for await (const { poisoned: x = ++initEvalCount } of [poisonedProperty]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..943291982f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..0996544422
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (const { x: y = thrower() } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..17070d5ff1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function * gen() {
+ for await (const { x: y = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..ce9d312ff4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-init.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..02414c3296
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..9196b1886f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-id.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..cecfce5d95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..8e000e6b76
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function * gen() {
+ for await (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: null }]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..949612ff5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function * gen() {
+ for await (const { w: { x, y, z } = undefined } of [{ }]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..1f4985d42d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-prop-obj.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..a44b56862b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-getter.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..b6b53eccef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..f386ce9717
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-const-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-close.js
new file mode 100644
index 0000000000..9431b89ad5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-close.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..a743d37c65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-get-err.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-get-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Abrupt completion returned by GetIterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ 1. Let iterator be ? GetIterator(value).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+async function * gen() {
+ for await (let [x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..310419d2c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-init-iter-no-close.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-name-iter-val.js
new file mode 100644
index 0000000000..a4212b9a32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-name-iter-val.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..72d4ace1fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..2f0844275a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..a7283e83b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..9ec86f9450
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..a9cea6cb75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..c90c36f069
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..825f913245
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..8e365473f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..95aba046a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Nested array destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be ? GetIterator(value).
+---*/
+
+async function * gen() {
+ for await (let [[x]] of [[null]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..9f3ebf7a1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..7aa0c1163b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..29dd699226
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..8e051acb55
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..051310d8f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..fa4c9b27d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..996b9b3e7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..ae434d7332
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..567232a951
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Destructuring initializer returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+
+async function * gen() {
+ for await (let [x = (function() { throw new Test262Error(); })()] of [[undefined]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..db6fb62cdf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..ab20b24fcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function * gen() {
+ for await (let [ x = unresolvableReference ] of [[]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..f1b7a619f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..98cb7b775d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..704a12c64e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ throw new Test262Error();
+ }
+ };
+};
+
+async function * gen() {
+ for await (let [x] of [g]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..8b75b269ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function * gen() {
+ for await (let [x] of [g]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..c8d9fddc12
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..1c61b5302a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..0ea9b718de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..1e5e8efc7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..5d3492cadf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..96b54e5426
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Nested object destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function * gen() {
+ for await (let [{ x }] of [[null]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..985868ed1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Nested object destructuring with a value of `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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function * gen() {
+ for await (let [{ x }] of [[]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..aa264362a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..6e46db606a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-gen-let.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function* fn() {
+ for await (let [,] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .next()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..5baa34e19c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision-step-err.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+
+---*/
+var following = 0;
+var iter = function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+async function * gen() {
+ for await (let [,] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+ assert.sameValue(following, 0, "iterator is properly closed");
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision.js
new file mode 100644
index 0000000000..cfef54e6c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-elision.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-empty.js
new file mode 100644
index 0000000000..b30b893eae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-empty.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-init-err.js
new file mode 100644
index 0000000000..6289bd9ae2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-init-err.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for await (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function fn() {
+ for await (let [x] = 1 of []) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..e4a88ef409
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,87 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..54be808440
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,94 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..2b9ac630de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..7b116a5a66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..968021ce1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding-for-await/error/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 iter = (function*() { throw new Test262Error(); })();
+
+async function * gen() {
+ for await (let [, ...x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..a881416a91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..011e5bd44d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..f56ba47dde
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-gen-let.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function* fn() {
+ for await (let [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .next()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..a8680d02cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+async function * gen() {
+ for await (let [...x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..bb4036263e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function * gen() {
+ for await (let [...x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..40b3825117
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-id.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..d131ef31ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..21fc460ded
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-id.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..fb6ba2bfe9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..f30bf1b66c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..0d1284830c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..5777f1df92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..e1edc14dcc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..867ead687f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+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.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-init-iter-close.js
new file mode 100644
index 0000000000..40c431bed5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (let [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..cbd77fc4ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (let [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-name-iter-val.js
new file mode 100644
index 0000000000..07a9402024
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-name-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (let [x, y, z] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..ffdd08fe42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..af3ce60a2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[7, 8, 9]]];
+})();
+
+async function *fn() {
+ for await (let [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..81544aa47f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [[,] = g()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..2d403f9e96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[]]];
+})();
+
+async function *fn() {
+ for await (let [[,] = g()] of asyncIter) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..4effbe25e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [[] = function() { initCount += 1; return iter; }()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..4735dd78e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[23]]];
+})();
+
+async function *fn() {
+ for await (let [[] = function() { initCount += 1; }()] of asyncIter) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..3992f62a3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [[...x] = values] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..43c2dcee13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[values]];
+})();
+
+async function *fn() {
+ for await (let [[...x] = function() { initCount += 1; }()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..097e7c834c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..74e2cbe287
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [arrow = () => {}] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..ab65f44ca8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..ad923a8ba1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [cover = (function () {}), xCover = (0, function() {})] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..968fcc269f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [fn = function () {}, xFn = function x() {}] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..83c39b0a31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [gen = function* () {}, xGen = function* x() {}] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..f8e83f7aff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[,]];
+})();
+
+async function *fn() {
+ for await (let [x = 23] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..b2097cfb15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[null, 0, false, '']];
+})();
+
+async function *fn() {
+ for await (let [w = counter(), x = counter(), y = counter(), z = counter()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..c6d7e2d841
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[undefined]];
+})();
+
+async function *fn() {
+ for await (let [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..b81d106f21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..dcd15846be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [_, x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..ccf2a2ad95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (let [x, y, z] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..24cb0fc5ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..683745c5ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ x: 11, y: 22, z: 33 }]];
+})();
+
+async function *fn() {
+ for await (let [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..6026b06ce0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..274290a1a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ u: 777, w: 888, y: 999 }]];
+})();
+
+async function *fn() {
+ for await (let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..a6ab7f035a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.template
+/*---
+description: Elision accepts exhausted iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (let [,] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elision.js
new file mode 100644
index 0000000000..bb5b7490f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.template
+/*---
+description: Elision advances iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function *fn() {
+ for await (let [,] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-empty.js
new file mode 100644
index 0000000000..9cfb506be7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (let [] of asyncIter) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..164ffeab45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[3, 4, 5]];
+})();
+
+async function *fn() {
+ for await (let [...[x, y, z]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..654516bbfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function *fn() {
+ for await (let [...[,]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..67858f6b6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (let [...[]] of asyncIter) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..ab804e307e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function *fn() {
+ for await (let [...[...x]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..19ec3755cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function *fn() {
+ for await (let [ , , ...x] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..f3228bd356
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2]];
+})();
+
+async function *fn() {
+ for await (let [, , ...x] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..b2807f2633
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function *fn() {
+ for await (let [...x] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..9a24fad064
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [...[ x ] = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..756e186dd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [...x = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..a8c158410b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (let [...{ x } = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..f5a11b540e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (let [...[x], y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..f0a26042e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (let [...x, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..2159b1b101
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (let [...{ x }, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..68e0645c1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (let [...{ length }] of asyncIter) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..a6ce28973a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[7, 8, 9]];
+})();
+
+async function *fn() {
+ for await (let [...{ 0: v, 1: w, 2: x, 3: y, length: z }] of asyncIter) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-empty.js
new file mode 100644
index 0000000000..7dd445d9fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [obj];
+})();
+
+async function *fn() {
+ for await (let {} of asyncIter) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..8f1fc70be9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (let { arrow = () => {} } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..9a07f69c52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (let { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..6115182d0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (let { cover = (function () {}), xCover = (0, function() {}) } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..9b7690f29d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (let { fn = function () {}, xFn = function x() {} } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..40fdd82710
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (let { gen = function* () {}, xGen = function* x() {} } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..e54d934dfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: null, x: 0, y: false, z: '' }];
+})();
+
+async function *fn() {
+ for await (let { w = counter(), x = counter(), y = counter(), z = counter() } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..b0b8d6e2b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function *fn() {
+ for await (let { x, } of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..3a1edde3b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (let { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..2996d54738
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: [45] }];
+})();
+
+async function *fn() {
+ for await (let { x: [y], } of asyncIter) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..74b96223d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: [7, undefined, ] }];
+})();
+
+async function *fn() {
+ for await (let { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..371a9e50ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ s: null, u: 0, w: false, y: '' }];
+})();
+
+async function *fn() {
+ for await (let { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..d514a2ab4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ }];
+})();
+
+async function *fn() {
+ for await (let { x: y = 33 } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..4a52fd72c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function *fn() {
+ for await (let { x: y, } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..266dd4212d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function *fn() {
+ for await (let { x: y } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..8d63ad2835
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: undefined }];
+})();
+
+async function *fn() {
+ for await (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..a6e0bd73a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: { x: undefined, z: 7 } }];
+})();
+
+async function *fn() {
+ for await (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..3fd2a3b5a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-getter.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ get v() { count++; return 2; } }];
+})();
+
+async function *fn() {
+ for await (let {...x} of asyncIter) {
+ assert.sameValue(x.v, 2);
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..c57bfa6c4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [o];
+})();
+
+async function *fn() {
+ for await (let {...rest} of asyncIter) {
+ assert.sameValue(rest.a, 3);
+ assert.sameValue(rest.b, 4);
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..ec814c481c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-async-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-let-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{x: 1, y: 2, a: 5, b: 3}];
+})();
+
+async function *fn() {
+ for await (let {a, b, ...rest} of asyncIter) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-init-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-init-null.js
new file mode 100644
index 0000000000..bf89725c40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-init-null.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function * gen() {
+ for await (let {} of [null]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-init-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-init-undefined.js
new file mode 100644
index 0000000000..d57ee9345d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-init-undefined.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-undefined.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function * gen() {
+ for await (let {} of [undefined]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-empty.js
new file mode 100644
index 0000000000..c66b4c0d21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-empty.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..d6efb7b093
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function * gen() {
+ for await (let { poisoned } of [poisonedProperty]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..8a7c7e3525
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..f36c14e64f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..6a206b2e27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..f904656d68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..19408526c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..0e913735c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..f00aaa2c10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-throws.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (let { x = thrower() } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..f1c8e0a1a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function * gen() {
+ for await (let { x = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..6c571ea79b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-init-err.js
new file mode 100644
index 0000000000..db0f426782
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-init-err.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for await (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function fn() {
+ for await (let {x} = 1 of []) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..0d9eb0ff16
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-list-err.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-list-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (let { a, b = thrower(), c = ++initCount } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..c0506ebea9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..68ce508b20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..50a021e464
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function * gen() {
+ for await (let { w: [x, y, z] = [4, 5, 6] } of [{ w: null }]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..aed49d07fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-ary.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..eb185a7241
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Evaluation of property name returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (let { [thrower()]: x } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..43161a472c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function * gen() {
+ for await (let { poisoned: x = ++initEvalCount } of [poisonedProperty]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..f15f3c3510
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..705323261a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (let { x: y = thrower() } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..5c6989ec82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function * gen() {
+ for await (let { x: y = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..57695d3052
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-init.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..7d4688eb21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..1aa4fcdc77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-id.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..0e968128be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..3d2795ba15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function * gen() {
+ for await (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: null }]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..d006ea858e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function * gen() {
+ for await (let { w: { x, y, z } = undefined } of [{ }]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..5f436b8c24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-prop-obj.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..c990a01d69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-getter.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..1986b476c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..47ba396f9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-let-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-close.js
new file mode 100644
index 0000000000..06c3532b41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-close.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..93f17f88b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-get-err.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-get-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Abrupt completion returned by GetIterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ 1. Let iterator be ? GetIterator(value).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+async function * gen() {
+ for await (var [x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..8bbaefdde7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-init-iter-no-close.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-name-iter-val.js
new file mode 100644
index 0000000000..7f8e0087ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-name-iter-val.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..9a21708318
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..4845d03226
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..bdd8ce328e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..2c7a1455eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..eae57654d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..d8ca51ebf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..904bfb0d34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..be404a464c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..2fb7b2850a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Nested array destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be ? GetIterator(value).
+---*/
+
+async function * gen() {
+ for await (var [[x]] of [[null]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..0c141203b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..cd850f865c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..a65e87e048
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..12e7209d72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..c8e782236c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..0e6e351e0b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..563985e649
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..1a8cf680e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..5a43d294ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Destructuring initializer returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+
+async function * gen() {
+ for await (var [x = (function() { throw new Test262Error(); })()] of [[undefined]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..f3573de61f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..b4974f5abb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function * gen() {
+ for await (var [ x = unresolvableReference ] of [[]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..3aebef3461
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..99d4c32e42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..dfba3418ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ throw new Test262Error();
+ }
+ };
+};
+
+async function * gen() {
+ for await (var [x] of [g]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..06ab471db7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function * gen() {
+ for await (var [x] of [g]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..a8dd7c2f4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..26ed3ea914
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..69ebbfec9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..03880ca375
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..94ecdbe81d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..5e33bfa862
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Nested object destructuring with a null 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function * gen() {
+ for await (var [{ x }] of [[null]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..133a9e5c95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Nested object destructuring with a value of `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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_opt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+async function * gen() {
+ for await (var [{ x }] of [[]]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..a2debd56b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..915bbd108a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-gen-var.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function* fn() {
+ for await (var [,] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .next()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..0a4b238c4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision-step-err.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+
+---*/
+var following = 0;
+var iter = function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+async function * gen() {
+ for await (var [,] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+ assert.sameValue(following, 0, "iterator is properly closed");
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision.js
new file mode 100644
index 0000000000..93163065e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-elision.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-empty.js
new file mode 100644
index 0000000000..07c307b1f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-empty.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-init-err.js
new file mode 100644
index 0000000000..c05d1c938d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-init-err.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForBinding position.
+info: |
+ IterationStatement:
+ for await (var ForBinding of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function fn() {
+ for await (var [x] = 1 of []) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..5ac284fc8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..d5cd4c2b1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,91 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..cedc01d6b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..da569d8c16
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..14f64e6c7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding-for-await/error/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 iter = (function*() { throw new Test262Error(); })();
+
+async function * gen() {
+ for await (var [, ...x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..8ea6603624
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..033f084b0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..9e1ee6f3e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding-for-await/iter-close/for-await-of-async-gen-var.template
+/*---
+description: The iterator is properly consumed by the destructuring 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+async function* fn() {
+ for await (var [...x] of [iter]) {
+ return;
+ }
+}
+
+fn()
+ .next()
+ .then(() => {
+ assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+ })
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..597381b309
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+async function * gen() {
+ for await (var [...x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..6de121083f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next() {
+ return poisonedValue;
+ }
+ };
+};
+
+async function * gen() {
+ for await (var [...x] of [iter]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..3f51ee7622
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-id.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..4789837e96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..c1af67caec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-id.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..ab1af8ae7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..0e93f066bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..688ef10014
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..3f108409ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..18de0f60e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..c83b9f89af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+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.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-init-iter-close.js
new file mode 100644
index 0000000000..593ba9e8e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-init-iter-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: false };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (var [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..e9c114c8d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-init-iter-no-close.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-init-iter-no-close.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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() {
+ return { value: null, done: true };
+ },
+ return() {
+ doneCallCount += 1;
+ return {};
+ }
+ };
+};
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (var [x] of asyncIter) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-name-iter-val.js
new file mode 100644
index 0000000000..c385c04073
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-name-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-name-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (var [x, y, z] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..199d470bd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..019a7ecc51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[7, 8, 9]]];
+})();
+
+async function *fn() {
+ for await (var [[x, y, z] = [4, 5, 6]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..e643276a3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [[,] = g()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..c667ad806d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[]]];
+})();
+
+async function *fn() {
+ for await (var [[,] = g()] of asyncIter) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..ed8cb5aabc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [[] = function() { initCount += 1; return iter; }()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..2c42fc2a0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[[23]]];
+})();
+
+async function *fn() {
+ for await (var [[] = function() { initCount += 1; }()] of asyncIter) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..5b9990aa33
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [[...x] = values] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..0d7f844260
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[values]];
+})();
+
+async function *fn() {
+ for await (var [[...x] = function() { initCount += 1; }()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..612648de18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..7c6399885d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [arrow = () => {}] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..750ae97d6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..e09641bb05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [cover = (function () {}), xCover = (0, function() {})] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..6777428490
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [fn = function () {}, xFn = function x() {}] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..745aca99a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ c. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [gen = function* () {}, xGen = function* x() {}] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..4e6027a0ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+ [...] 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v). 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[,]];
+})();
+
+async function *fn() {
+ for await (var [x = 23] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..4ecc890784
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,73 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ 7. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[null, 0, false, '']];
+})();
+
+async function *fn() {
+ for await (var [w = counter(), x = counter(), y = counter(), z = counter()] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..1e91b59e9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ [...]
+ 6. If environment is undefined, return PutValue(lhs, v).
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[undefined]];
+})();
+
+async function *fn() {
+ for await (var [x = 23] of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..91eb43130e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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,
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..c47e0395f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If iteratorRecord.[[done]] is false, then
+ [...]
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [_, x] of asyncIter) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..2c6d54e7e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,76 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (var [x, y, z] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..e90c0f216e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..61fbc3df89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ x: 11, y: 22, z: 33 }]];
+})();
+
+async function *fn() {
+ for await (var [{ x, y, z } = { x: 44, y: 55, z: 66 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..4ee40856c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..0cf7c88109
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 : BindingPattern Initializer_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;
+var asyncIter = (async function*() {
+ yield* [[{ u: 777, w: 888, y: 999 }]];
+})();
+
+async function *fn() {
+ for await (var [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..ad505aacd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.template
+/*---
+description: Elision accepts exhausted iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (var [,] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elision.js
new file mode 100644
index 0000000000..9af91b9d1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-elision.js
@@ -0,0 +1,83 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.template
+/*---
+description: Elision advances iterator (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function *fn() {
+ for await (var [,] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-empty.js
new file mode 100644
index 0000000000..415452a01f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-empty.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (var [] of asyncIter) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..af3f2f7b2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. 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).
+ 4. If iteratorRecord.[[done]] is true, let v be undefined.
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[3, 4, 5]];
+})();
+
+async function *fn() {
+ for await (var [...[x, y, z]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..19af300b5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [g()];
+})();
+
+async function *fn() {
+ for await (var [...[,]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..94eca8a5df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [iter];
+})();
+
+async function *fn() {
+ for await (var [...[]] of asyncIter) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..5b04fab44d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function *fn() {
+ for await (var [...[...x]] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..0db74c51f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function *fn() {
+ for await (var [ , , ...x] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..2751ead172
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2]];
+})();
+
+async function *fn() {
+ for await (var [, , ...x] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..578944fd8c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [values];
+})();
+
+async function *fn() {
+ for await (var [...x] of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..5d05692fdd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [...[ x ] = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..8effa424c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [...x = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..6849b9f651
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.template
+/*---
+description: Rest 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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[]];
+})();
+
+async function *fn() {
+ for await (var [...{ x } = []] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..ca8490907c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (var [...[x], y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..9300892b93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (var [...x, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..9773859053
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,65 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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]
+negative:
+ phase: parse
+ 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (var [...{ x }, y] of asyncIter) {
+
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..1e1eb99e47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [[1, 2, 3]];
+})();
+
+async function *fn() {
+ for await (var [...{ length }] of asyncIter) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..ee1ff5a2d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [[7, 8, 9]];
+})();
+
+async function *fn() {
+ for await (var [...{ 0: v, 1: w, 2: x, 3: y, length: z }] of asyncIter) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-empty.js
new file mode 100644
index 0000000000..baa8264124
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-empty.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [obj];
+})();
+
+async function *fn() {
+ for await (var {} of asyncIter) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..9f2dff73bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,68 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (var { arrow = () => {} } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..6c434009b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (var { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..2bdf983c2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (var { cover = (function () {}), xCover = (0, function() {}) } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..f91252434f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (var { fn = function () {}, xFn = function x() {} } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..5d7db6321b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (var { gen = function* () {}, xGen = function* x() {} } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..1e38fdfe0b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 6. If Initializer is present and v is undefined, then
+ [...]
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: null, x: 0, y: false, z: '' }];
+})();
+
+async function *fn() {
+ for await (var { w = counter(), x = counter(), y = counter(), z = counter() } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..9af1da68ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function *fn() {
+ for await (var { x, } of asyncIter) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..746eedea1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{}];
+})();
+
+async function *fn() {
+ for await (var { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..c4c5d538d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: [45] }];
+})();
+
+async function *fn() {
+ for await (var { x: [y], } of asyncIter) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..6960af5ea7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-ary.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: [7, undefined, ] }];
+})();
+
+async function *fn() {
+ for await (var { w: [x, y, z] = [4, 5, 6] } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..c8aa483eaa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,84 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 3. If Initializer is present and v is undefined, then
+ [...]
+---*/
+var initCount = 0;
+function counter() {
+ initCount += 1;
+}
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ s: null, u: 0, w: false, y: '' }];
+})();
+
+async function *fn() {
+ for await (var { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..38ed0c9a56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ }];
+})();
+
+async function *fn() {
+ for await (var { x: y = 33 } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..5f07f5d7dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function *fn() {
+ for await (var { x: y, } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..c3c7ae74b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-id.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ x: 23 }];
+})();
+
+async function *fn() {
+ for await (var { x: y } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..adec783f36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing v and environment as arguments.
+---*/
+
+var iterCount = 0;
+var asyncIter = (async function*() {
+ yield* [{ w: undefined }];
+})();
+
+async function *fn() {
+ for await (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..5af2fbc062
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-prop-obj.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ w: { x: undefined, z: 7 } }];
+})();
+
+async function *fn() {
+ for await (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of asyncIter) {
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..0cfd28d583
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-getter.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{ get v() { count++; return 2; } }];
+})();
+
+async function *fn() {
+ for await (var {...x} of asyncIter) {
+ assert.sameValue(x.v, 2);
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..a90614e494
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [o];
+})();
+
+async function *fn() {
+ for await (var {...rest} of asyncIter) {
+ assert.sameValue(rest.a, 3);
+ assert.sameValue(rest.b, 4);
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..8a5edce9ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-async-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/default/for-await-of-async-gen-var-async.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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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;
+var asyncIter = (async function*() {
+ yield* [{x: 1, y: 2, a: 5, b: 3}];
+})();
+
+async function *fn() {
+ for await (var {a, b, ...rest} of asyncIter) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-init-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-init-null.js
new file mode 100644
index 0000000000..d0dc989602
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-init-null.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function * gen() {
+ for await (var {} of [null]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-init-undefined.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-init-undefined.js
new file mode 100644
index 0000000000..980ca381a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-init-undefined.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-init-undefined.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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).
+---*/
+
+async function * gen() {
+ for await (var {} of [undefined]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-empty.js
new file mode 100644
index 0000000000..e1fc02a521
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-empty.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-empty.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..a5b650821b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function * gen() {
+ for await (var { poisoned } of [poisonedProperty]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..5d9037cc61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,63 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..8c28f06c3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..1a6b75dbcb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..49af584517
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..28a31a695a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding-for-await/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: [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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..ae509d0916
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..dc6e773486
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-throws.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (var { x = thrower() } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..4b0ad5d1d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 5. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function * gen() {
+ for await (var { x = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..ea8c090508
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-init-err.js
new file mode 100644
index 0000000000..c319f9d21c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-init-err.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForBinding position.
+info: |
+ IterationStatement:
+ for await (var ForBinding of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function fn() {
+ for await (var {x} = 1 of []) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..ee67b85fd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-list-err.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-list-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (var { a, b = thrower(), c = ++initCount } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..099b2458e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..a224492c68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..38d07d382b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function * gen() {
+ for await (var { w: [x, y, z] = [4, 5, 6] } of [{ w: null }]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..ca0fbb0d30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-ary.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-ary.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..4cef150936
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Evaluation of property name returns an abrupt completion (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (var { [thrower()]: x } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..9448e3bbb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,67 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+async function * gen() {
+ for await (var { poisoned: x = ++initEvalCount } of [poisonedProperty]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..7e981a066d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..9e01a110bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Error thrown when evaluating the 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+async function * gen() {
+ for await (var { x: y = thrower() } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, Test262Error);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..d1ab3fb0bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,70 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+
+ 6.2.4.1 GetValue ( V )
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+async function * gen() {
+ for await (var { x: y = unresolvableReference } of [{}]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, ReferenceError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..8edf8158f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-init.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..50b4b7258b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..c49254fef7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-id.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-id.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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 Initializer_opt
+
+ [...]
+ 7. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..ef52c2b307
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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
+
+ [...]
+ 4. If Initializer is present and v is undefined, then
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Set v to ? GetValue(defaultValue).
+ 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..c76d8fc7e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function * gen() {
+ for await (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: null }]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..143d3d0df2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,62 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding-for-await/error/for-await-of-async-gen-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` 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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.
+---*/
+
+async function * gen() {
+ for await (var { w: { x, y, z } = undefined } of [{ }]) {
+ return;
+ }
+}
+
+gen().next()
+ .then(_ => {
+ throw new Test262Error("Expected async function to reject, but resolved.");
+ }, ({ constructor }) => {
+ assert.sameValue(constructor, TypeError);
+
+ })
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..2c2e25a71d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-prop-obj.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-prop-obj.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..b92cba280e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-getter.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-getter.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..77e9242263
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..cc29ee053e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/async-gen-dstr-var-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding-for-await/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding-for-await/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
+
+ [...]
+ 4. Let destructuring be IsDestructuring of lhs.
+ [...]
+ 6. Repeat
+ [...]
+ j. If destructuring is false, then
+ [...]
+ k. 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.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+ }
+}
+
+fn().next()
+ .then(() => assert.sameValue(iterCount, 1, 'iteration occurred as expected'), $DONE)
+ .then($DONE, $DONE);
+
diff --git a/js/src/tests/test262/language/statements/for-await-of/browser.js b/js/src/tests/test262/language/statements/for-await-of/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/browser.js
diff --git a/js/src/tests/test262/language/statements/for-await-of/escaped-of.js b/js/src/tests/test262/language/statements/for-await-of/escaped-of.js
new file mode 100644
index 0000000000..1903527feb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/escaped-of.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-grammar-notation
+description: >
+ The `of` contextual keyword must not contain Unicode escape sequences.
+info: |
+ Terminal symbols are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function* f() {
+ for await (var x o\u0066 []) ;
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/head-const-init.js b/js/src/tests/test262/language/statements/for-await-of/head-const-init.js
new file mode 100644
index 0000000000..f83c77f54e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/head-const-init.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for await (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function fn() {
+ for await (const x = 1 of []) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/head-let-init.js b/js/src/tests/test262/language/statements/for-await-of/head-let-init.js
new file mode 100644
index 0000000000..2112195d7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/head-let-init.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for await (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function fn() {
+ for await (let x = 1 of []) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/head-lhs-async.js b/js/src/tests/test262/language/statements/for-await-of/head-lhs-async.js
new file mode 100644
index 0000000000..141d07de0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/head-lhs-async.js
@@ -0,0 +1,24 @@
+// |reftest| async
+// Copyright (C) 2021 Stuart Cook. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ The left-hand-side of a for-await-of loop may be the identifier `async`.
+info: |
+ ForInOfStatement[Yield, Await, Return]:
+ [+Await] for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+features: [async-iteration]
+flags: [async]
+---*/
+
+let async;
+
+async function fn() {
+ for await (async of [7]);
+}
+
+fn()
+ .then(() => assert.sameValue(async, 7), $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/head-var-init.js b/js/src/tests/test262/language/statements/for-await-of/head-var-init.js
new file mode 100644
index 0000000000..bad95b1dc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/head-var-init.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForBinding position.
+info: |
+ IterationStatement:
+ for await (var ForBinding of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function fn() {
+ for await (var x = 1 of []) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-abrupt.js b/js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-abrupt.js
new file mode 100644
index 0000000000..781dc58b86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-abrupt.js
@@ -0,0 +1,54 @@
+// |reftest| async
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asynciteratorclose
+description: >
+ If retrieving an iterator's `return` method generates an error while
+ closing the iterator with non-throw completion, the error should be
+ forwarded to the runtime.
+info: |
+ AsyncIteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ [...]
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+features: [async-iteration]
+flags: [async]
+---*/
+
+const innerError = { name: "inner error" };
+const asyncIterable = {};
+asyncIterable[Symbol.asyncIterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: null };
+ },
+ get return() {
+ throw innerError;
+ },
+ };
+};
+
+let iterationCount = 0;
+const promise = (async function() {
+ for await (const x of asyncIterable) {
+ iterationCount += 1;
+ break;
+ }
+})();
+
+promise.then(function(value) {
+ throw new Test262Error("Promise should be rejected, got: " + value);
+}, function(error) {
+ assert.sameValue(error, innerError);
+ assert.sameValue(iterationCount, 1, "The loop body is evaluated");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-is-null.js b/js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-is-null.js
new file mode 100644
index 0000000000..61a35bacfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-is-null.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asynciteratorclose
+description: >
+ If iterator's "return" method is `null`,
+ received non-throw completion is forwarded to the runtime.
+info: |
+ AsyncIteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ a. Let return be innerResult.[[Value]].
+ b. If return is undefined, return Completion(completion).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+features: [Symbol.asyncIterator, async-iteration]
+flags: [async]
+includes: [asyncHelpers.js]
+---*/
+
+var iterationCount = 0;
+var returnGets = 0;
+
+var iterable = {};
+iterable[Symbol.asyncIterator] = function() {
+ return {
+ next: function() {
+ return {value: 1, done: false};
+ },
+ get return() {
+ returnGets += 1;
+ return null;
+ },
+ };
+};
+
+asyncTest(async function() {
+ for await (var _ of iterable) {
+ iterationCount += 1;
+ break;
+ }
+
+ assert.sameValue(iterationCount, 1);
+ assert.sameValue(returnGets, 1);
+});
diff --git a/js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-non-callable.js b/js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-non-callable.js
new file mode 100644
index 0000000000..e06341f845
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/iterator-close-non-throw-get-method-non-callable.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asynciteratorclose
+description: >
+ If retrieving an iterator's `return` method generates an error while
+ closing the iterator with non-throw completion, the error should be
+ forwarded to the runtime.
+info: |
+ AsyncIteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ [...]
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+features: [async-iteration]
+flags: [async]
+---*/
+
+const asyncIterable = {};
+asyncIterable[Symbol.asyncIterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: null };
+ },
+ return: Symbol(),
+ };
+};
+
+let iterationCount = 0;
+const promise = (async function() {
+ for await (const x of asyncIterable) {
+ iterationCount += 1;
+ break;
+ }
+})();
+
+promise.then(function(value) {
+ throw new Test262Error("Promise should be rejected, got: " + value);
+}, function(error) {
+ assert.sameValue(error.constructor, TypeError);
+ assert.sameValue(iterationCount, 1, "The loop body is evaluated");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/iterator-close-throw-get-method-abrupt.js b/js/src/tests/test262/language/statements/for-await-of/iterator-close-throw-get-method-abrupt.js
new file mode 100644
index 0000000000..0f72094cc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/iterator-close-throw-get-method-abrupt.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asynciteratorclose
+description: >
+ If retrieving an iterator's `return` method generates an error while
+ closing the iterator with throw completion, this error should be suppressed.
+info: |
+ AsyncIteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ [...]
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+features: [async-iteration]
+flags: [async]
+---*/
+
+const asyncIterable = {};
+asyncIterable[Symbol.asyncIterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: null };
+ },
+ get return() {
+ throw { name: "inner error" };
+ },
+ };
+};
+
+let iterationCount = 0;
+const promise = (async function() {
+ for await (const x of asyncIterable) {
+ iterationCount += 1;
+ throw new Test262Error("should not be overriden");
+ }
+})();
+
+promise.then(function(value) {
+ throw new Test262Error("Promise should be rejected, got: " + value);
+}, function(error) {
+ assert.sameValue(error.constructor, Test262Error);
+ assert.sameValue(iterationCount, 1, "The loop body is evaluated");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/iterator-close-throw-get-method-non-callable.js b/js/src/tests/test262/language/statements/for-await-of/iterator-close-throw-get-method-non-callable.js
new file mode 100644
index 0000000000..17cef4c6a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/iterator-close-throw-get-method-non-callable.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asynciteratorclose
+description: >
+ If retrieving an iterator's `return` method generates an error while
+ closing the iterator with throw completion, this error should be suppressed.
+info: |
+ AsyncIteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ [...]
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+features: [async-iteration]
+flags: [async]
+---*/
+
+const asyncIterable = {};
+asyncIterable[Symbol.asyncIterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: null };
+ },
+ return: true,
+ };
+};
+
+let iterationCount = 0;
+const promise = (async function() {
+ for await (const x of asyncIterable) {
+ iterationCount += 1;
+ throw new Test262Error("should not be overriden");
+ }
+})();
+
+promise.then(function(value) {
+ throw new Test262Error("Promise should be rejected, got: " + value);
+}, function(error) {
+ assert.sameValue(error.constructor, Test262Error);
+ assert.sameValue(iterationCount, 1, "The loop body is evaluated");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/for-await-of/let-array-with-newline.js b/js/src/tests/test262/language/statements/for-await-of/let-array-with-newline.js
new file mode 100644
index 0000000000..c020f663bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/let-array-with-newline.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+async function* f() {
+ for await (var x of []) let
+ [a] = 0;
+}
diff --git a/js/src/tests/test262/language/statements/for-await-of/let-block-with-newline.js b/js/src/tests/test262/language/statements/for-await-of/let-block-with-newline.js
new file mode 100644
index 0000000000..0fb7820ac7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/let-block-with-newline.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let {`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+features: [async-iteration]
+---*/
+
+async function* f() {
+ for await (var x of []) let // ASI
+ {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-await-of/let-identifier-with-newline.js b/js/src/tests/test262/language/statements/for-await-of/let-identifier-with-newline.js
new file mode 100644
index 0000000000..ab6887a8be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/let-identifier-with-newline.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+features: [async-iteration]
+---*/
+
+async function* f() {
+ for await (var x of []) let // ASI
+ x = 1;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-await-of/shell.js b/js/src/tests/test262/language/statements/for-await-of/shell.js
new file mode 100644
index 0000000000..ae18ad584d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/shell.js
@@ -0,0 +1,113 @@
+// GENERATED, DO NOT EDIT
+// file: asyncHelpers.js
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ A collection of assertion and wrapper functions for testing asynchronous built-ins.
+defines: [asyncTest]
+---*/
+
+function asyncTest(testFunc) {
+ if (!Object.hasOwn(globalThis, "$DONE")) {
+ throw new Test262Error("asyncTest called without async flag");
+ }
+ if (typeof testFunc !== "function") {
+ $DONE(new Test262Error("asyncTest called with non-function argument"));
+ return;
+ }
+ try {
+ testFunc().then(
+ function () {
+ $DONE();
+ },
+ function (error) {
+ $DONE(error);
+ }
+ );
+ } catch (syncError) {
+ $DONE(syncError);
+ }
+}
+
+assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
+ var innerThenable;
+ if (message === undefined) {
+ message = "";
+ } else {
+ message += " ";
+ }
+ if (typeof func === "function") {
+ try {
+ innerThenable = func();
+ if (
+ innerThenable === null ||
+ typeof innerThenable !== "object" ||
+ typeof innerThenable.then !== "function"
+ ) {
+ message +=
+ "Expected to obtain an inner promise that would reject with a" +
+ expectedErrorConstructor.name +
+ " but result was not a thenable";
+ throw new Test262Error(message);
+ }
+ } catch (thrown) {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise";
+ throw new Test262Error(message);
+ }
+ } else {
+ message +=
+ "assert.throwsAsync called with an argument that is not a function";
+ throw new Test262Error(message);
+ }
+
+ try {
+ return innerThenable.then(
+ function () {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but no exception was thrown at all";
+ throw new Test262Error(message);
+ },
+ function (thrown) {
+ var expectedName, actualName;
+ if (typeof thrown !== "object" || thrown === null) {
+ message += "Thrown value was not an object!";
+ throw new Test262Error(message);
+ } else if (thrown.constructor !== expectedErrorConstructor) {
+ expectedName = expectedErrorConstructor.name;
+ actualName = thrown.constructor.name;
+ if (expectedName === actualName) {
+ message +=
+ "Expected a " +
+ expectedName +
+ " but got a different error constructor with the same name";
+ } else {
+ message +=
+ "Expected a " + expectedName + " but got a " + actualName;
+ }
+ throw new Test262Error(message);
+ }
+ }
+ );
+ } catch (thrown) {
+ if (typeof thrown !== "object" || thrown === null) {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but innerThenable synchronously threw a value that was not an object ";
+ } else {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but a " +
+ thrown.constructor.name +
+ " was thrown synchronously";
+ }
+ throw new Test262Error(message);
+ }
+};
diff --git a/js/src/tests/test262/language/statements/for-await-of/ticks-with-async-iter-resolved-promise-and-constructor-lookup-two.js b/js/src/tests/test262/language/statements/for-await-of/ticks-with-async-iter-resolved-promise-and-constructor-lookup-two.js
new file mode 100644
index 0000000000..d584a0b824
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/ticks-with-async-iter-resolved-promise-and-constructor-lookup-two.js
@@ -0,0 +1,92 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset
+description: >
+ Ensure the number of ticks and Promise constructor lookups is correct with custom async iterator.
+info: |
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation ( lhs, stmt, iteratorRecord, iterationKind,
+ lhsKind, labelSet [ , iteratorKind ] )
+ 25.6.4.5.1 PromiseResolve
+ 6.2.3.1 Await
+
+includes: [compareArray.js]
+flags: [async]
+features: [async-iteration]
+---*/
+
+// The expected event log.
+var expected = [
+ // Before entering loop.
+ "pre",
+
+ // Await
+ // -> PromiseResolve
+ "constructor",
+
+ // Await promise resolved.
+ "tick 1",
+
+ // In loop body.
+ "loop",
+
+ // Await
+ // -> PromiseResolve
+ "constructor",
+
+ // Await promise resolved
+ "tick 2",
+
+ // After exiting loop.
+ "post",
+];
+
+// The actual event log.
+var actual = [];
+
+// Custom async iterator returning the result of the synchronous iterator wrapped in a Promise.
+function toAsyncIterator(iterable) {
+ return {
+ [Symbol.asyncIterator]() {
+ var iter = iterable[Symbol.iterator]();
+ return {
+ next() {
+ return Promise.resolve(iter.next());
+ }
+ };
+ }
+ };
+}
+
+// Test function using for-await with a single, already resolved Promise.
+async function f() {
+ var p = Promise.resolve(0);
+ actual.push("pre");
+ for await (var x of toAsyncIterator([p])) {
+ actual.push("loop");
+ }
+ actual.push("post");
+}
+
+// Count the number of ticks needed to complete the loop and compare the actual log.
+Promise.resolve(0)
+ .then(() => actual.push("tick 1"))
+ .then(() => actual.push("tick 2"))
+ .then(() => {
+ assert.compareArray(actual, expected, "Ticks and constructor lookups");
+}).then($DONE, $DONE);
+
+// Redefine `Promise.constructor` in order to intercept "constructor" lookups from PromiseResolve.
+// (Perform last so that the lookups from SpeciesConstructor in `then` aren't logged.)
+Object.defineProperty(Promise.prototype, "constructor", {
+ get() {
+ actual.push("constructor");
+ return Promise;
+ },
+ configurable: true,
+});
+
+// Start the asynchronous function.
+f();
diff --git a/js/src/tests/test262/language/statements/for-await-of/ticks-with-async-iter-resolved-promise-and-constructor-lookup.js b/js/src/tests/test262/language/statements/for-await-of/ticks-with-async-iter-resolved-promise-and-constructor-lookup.js
new file mode 100644
index 0000000000..3253713c99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/ticks-with-async-iter-resolved-promise-and-constructor-lookup.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset
+description: >
+ Ensure the number of ticks and Promise constructor lookups is correct with custom async iterator.
+info: |
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation ( lhs, stmt, iteratorRecord, iterationKind,
+ lhsKind, labelSet [ , iteratorKind ] )
+ 6.2.3.1 Await
+
+includes: [compareArray.js]
+flags: [async]
+features: [async-iteration]
+---*/
+
+// The expected event log.
+var expected = [
+ // Before entering loop.
+ "pre",
+
+ // Await promise resolved.
+ "tick 1",
+
+ // In loop body.
+ "loop",
+
+ // Await promise resolved
+ "tick 2",
+
+ // After exiting loop.
+ "post",
+];
+
+// The actual event log.
+var actual = [];
+
+// Custom async iterator directly using a synchronous iterator.
+function toAsyncIterator(iterable) {
+ return {
+ [Symbol.asyncIterator]() {
+ return iterable[Symbol.iterator]();
+ }
+ };
+}
+
+// Test function using for-await with a single, already resolved Promise.
+async function f() {
+ var p = Promise.resolve(0);
+ actual.push("pre");
+ for await (var x of toAsyncIterator([p])) {
+ actual.push("loop");
+ }
+ actual.push("post");
+}
+
+// Count the number of ticks needed to complete the loop and compare the actual log.
+Promise.resolve(0)
+ .then(() => actual.push("tick 1"))
+ .then(() => actual.push("tick 2"))
+ .then(() => {
+ assert.compareArray(actual, expected, "Ticks and constructor lookups");
+}).then($DONE, $DONE);
+
+// Redefine `Promise.constructor` in order to intercept "constructor" lookups from PromiseResolve.
+// (Perform last so that the lookups from SpeciesConstructor in `then` aren't logged.)
+Object.defineProperty(Promise.prototype, "constructor", {
+ get() {
+ actual.push("constructor");
+ return Promise;
+ },
+ configurable: true,
+});
+
+// Start the asynchronous function.
+f();
diff --git a/js/src/tests/test262/language/statements/for-await-of/ticks-with-sync-iter-resolved-promise-and-constructor-lookup.js b/js/src/tests/test262/language/statements/for-await-of/ticks-with-sync-iter-resolved-promise-and-constructor-lookup.js
new file mode 100644
index 0000000000..6ca844b232
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-await-of/ticks-with-sync-iter-resolved-promise-and-constructor-lookup.js
@@ -0,0 +1,93 @@
+// |reftest| async
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset
+description: >
+ Ensure the number of ticks and Promise constructor lookups is correct with a Async-from-Sync iterator.
+info: |
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation ( lhs, stmt, iteratorRecord, iterationKind,
+ lhsKind, labelSet [ , iteratorKind ] )
+ 25.1.4.2.1 %AsyncFromSyncIteratorPrototype%.next
+ 25.1.4.4 AsyncFromSyncIteratorContinuation
+ 25.6.4.5.1 PromiseResolve
+ 6.2.3.1 Await
+
+includes: [compareArray.js]
+flags: [async]
+features: [async-iteration]
+---*/
+
+// The expected event log.
+var expected = [
+ // Before entering loop.
+ "pre",
+
+ // %AsyncFromSyncIteratorPrototype%.next
+ // -> AsyncFromSyncIteratorContinuation
+ // -> PromiseResolve
+ "constructor",
+
+ // Await
+ // -> PromiseResolve
+ "constructor",
+
+ // Async-from-Sync Iterator promise resolved.
+ "tick 1",
+
+ // Await promise resolved.
+ "tick 2",
+
+ // In loop body.
+ "loop",
+
+ // Await
+ // -> PromiseResolve
+ "constructor",
+
+ // Async-from-Sync Iterator promise resolved.
+ "tick 3",
+
+ // Await promise resolved
+ "tick 4",
+
+ // After exiting loop.
+ "post",
+];
+
+// The actual event log.
+var actual = [];
+
+// Test function using for-await with a single, already resolved Promise.
+async function f() {
+ var p = Promise.resolve(0);
+ actual.push("pre");
+ for await (var x of [p]) {
+ actual.push("loop");
+ }
+ actual.push("post");
+}
+
+// Count the number of ticks needed to complete the loop and compare the actual log.
+Promise.resolve(0)
+ .then(() => actual.push("tick 1"))
+ .then(() => actual.push("tick 2"))
+ .then(() => actual.push("tick 3"))
+ .then(() => actual.push("tick 4"))
+ .then(() => {
+ assert.compareArray(actual, expected, "Ticks and constructor lookups");
+}).then($DONE, $DONE);
+
+// Redefine `Promise.constructor` in order to intercept "constructor" lookups from PromiseResolve.
+// (Perform last so that the lookups from SpeciesConstructor in `then` aren't logged.)
+Object.defineProperty(Promise.prototype, "constructor", {
+ get() {
+ actual.push("constructor");
+ return Promise;
+ },
+ configurable: true,
+});
+
+// Start the asynchronous function.
+f();
diff --git a/js/src/tests/test262/language/statements/for-in/12.6.4-1.js b/js/src/tests/test262/language/statements/for-in/12.6.4-1.js
new file mode 100644
index 0000000000..ef470c7b36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/12.6.4-1.js
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.6.4-1
+description: >
+ The for-in Statement - a property name must not be visited more
+ than once in any enumeration.
+---*/
+
+ var obj = { prop1: "abc", prop2: "bbc", prop3: "cnn" };
+
+ var countProp1 = 0;
+ var countProp2 = 0;
+ var countProp3 = 0;
+
+ for (var p in obj) {
+ if (obj.hasOwnProperty(p)) {
+ if (p === "prop1") {
+ countProp1++;
+ }
+ if (p === "prop2") {
+ countProp2++;
+ }
+ if (p === "prop3") {
+ countProp3++;
+ }
+ }
+ }
+
+assert.sameValue(countProp1, 1, 'countProp1');
+assert.sameValue(countProp2, 1, 'countProp2');
+assert.sameValue(countProp3, 1, 'countProp3');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/12.6.4-2.js b/js/src/tests/test262/language/statements/for-in/12.6.4-2.js
new file mode 100644
index 0000000000..1a021881f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/12.6.4-2.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.6.4-2
+description: >
+ The for-in Statement - the values of [[Enumerable]] attributes are
+ not considered when determining if a property of a prototype
+ object is shadowed by a previous object on the prototype chain
+---*/
+
+ var proto = {
+ prop: "enumerableValue"
+ };
+
+ var ConstructFun = function () { };
+ ConstructFun.prototype = proto;
+
+ var child = new ConstructFun();
+
+ Object.defineProperty(child, "prop", {
+ value: "nonEnumerableValue",
+ enumerable: false
+ });
+
+ var accessedProp = false;
+
+ for (var p in child) {
+ if (p === "prop") {
+ accessedProp = true;
+ }
+ }
+
+assert.sameValue(accessedProp, false, 'accessedProp');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A1.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A1.js
new file mode 100644
index 0000000000..4d80be149d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A1.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"for(key in undefined)\" Statement is allowed"
+es5id: 12.6.4_A1
+description: Checking if execution of "for(key in undefined)" passes
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ for(__key in undefined){
+ var key=__key;
+ };
+} catch (e) {
+ throw new Test262Error('#1: "for(key in undefined){}" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (key!==undefined) {
+ throw new Test262Error('#2: key === undefined. Actual: key === '+key);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A14_T2.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A14_T2.js
new file mode 100644
index 0000000000..526ce6f3c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A14_T2.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpession within a "for-in" Expression is allowed
+es5id: 12.6.4_A14_T2
+description: "Using \"function __func(){return {a:1};}()\" as Expession"
+---*/
+
+var x;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+for(x in function __func(){return {a:1};}()){
+ var __reached = x;
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__reached !== "a") {
+ throw new Test262Error('#2: function expession inside of for-in expression allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A15.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A15.js
new file mode 100644
index 0000000000..f82438c5e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A15.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Block within a "for-in" Expression is not allowed
+es5id: 12.6.4_A15
+description: Using block within "for-in" Expression
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var __arr=[1,2,3];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+for(x in {__arr;}){
+ break ;
+};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A2.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A2.js
new file mode 100644
index 0000000000..4b51f20771
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A2.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"for(key in null)\" Expression is allowed"
+es5id: 12.6.4_A2
+description: Checking if execution of "for(key in null)" passes
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+try {
+ for(__key in null){
+ var key=__key;
+ };
+} catch (e) {
+ throw new Test262Error('#1: "for(__key in null){}" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (key!==undefined) {
+ throw new Test262Error('#2: key === undefined. Actual: key ==='+key);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A3.1.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A3.1.js
new file mode 100644
index 0000000000..1311d1a2c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A3.1.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationNoIn in
+ Expression) Statement"
+es5id: 12.6.4_A3.1
+description: >
+ Using an array as an Expression is appropriate. Here Expression is
+ an array of numbers
+---*/
+
+var __str, __evaluated, arr;
+__str="";
+
+__evaluated = eval("for(var ind in (arr=[2,1,4,3]))__str+=arr[ind]");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__evaluated !== __str) {
+ throw new Test262Error('#1: __evaluated === __str. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1) )) {
+ throw new Test262Error('#2: (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A3.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A3.js
new file mode 100644
index 0000000000..b66aa73187
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A3.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationNoIn in
+ Expression) Statement"
+es5id: 12.6.4_A3
+description: >
+ Using an array as an Expression is appropriate. Here Expression is
+ an array of numbers. Eval is used
+---*/
+
+var __str, __evaluated, arr, ind;
+__str="";
+
+__evaluated = eval("for(ind in (arr=[2,1,4,3]))__str+=arr[ind]");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__evaluated !== __str) {
+ throw new Test262Error('#1: __evaluated === __str. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (!( (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1) )) {
+ throw new Test262Error('#2: (__str.indexOf("2")!==-1)&&(__str.indexOf("1")!==-1)&&(__str.indexOf("4")!==-1)&&(__str.indexOf("3")!==-1)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A4.1.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A4.1.js
new file mode 100644
index 0000000000..bc5292630a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A4.1.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationNoIn in
+ Expression) Statement"
+es5id: 12.6.4_A4.1
+description: Using Object as an Expression is appropriate. Eval is used
+---*/
+
+var __str, __evaluated, hash;
+__str="";
+
+__evaluated = eval("for(var ind in (hash={2:'b',1:'a',4:'d',3:'c'}))__str+=hash[ind]");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ( !( (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1) ) ) {
+ throw new Test262Error('#1: (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str !== __evaluated) {
+ throw new Test262Error('#2: __str === __evaluated. Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A4.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A4.js
new file mode 100644
index 0000000000..b2e2c3e1c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A4.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationNoIn in
+ Expression) Statement"
+es5id: 12.6.4_A4
+description: Using Object as an Expression is appropriate. Eval is used
+---*/
+
+var __str, __evaluated, hash, ind;
+__str="";
+
+__evaluated = eval("for(ind in (hash={2:'b',1:'a',4:'d',3:'c'}))__str+=hash[ind]");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ( !( (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1) ) ) {
+ throw new Test262Error('#1: (__evaluated.indexOf("a")!==-1)& (__evaluated.indexOf("b")!==-1)& (__evaluated.indexOf("c")!==-1)&(__evaluated.indexOf("d")!==-1)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str !== __evaluated) {
+ throw new Test262Error('#2: __str === __evaluated. Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A5.1.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A5.1.js
new file mode 100644
index 0000000000..51877da9a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A5.1.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationNoIn in
+ Expression) Statement"
+es5id: 12.6.4_A5.1
+description: >
+ Using hierarchical Object as an Expression is appropriate. The
+ depth is two
+---*/
+
+var __hash__map, __arr;
+
+__hash__map={a:{aa:1,ab:2,ac:3,ad:4},b:{ba:1,bb:2,bc:3,bd:4},c:{ca:1,cb:2,cc:3,cd:4},d:{da:1,db:2,dc:3,dd:4}};
+
+__arr = "";
+
+for(var __key in __hash__map){
+ for (var __ind in __hash__map[__key]){
+ __arr+=("" + __ind + __hash__map[__key][__ind]);
+ }
+}
+
+if(!(
+(__arr.indexOf("aa1")!==-1)&
+(__arr.indexOf("ab2")!==-1)&
+(__arr.indexOf("ac3")!==-1)&
+(__arr.indexOf("ad4")!==-1)&
+(__arr.indexOf("ba1")!==-1)&
+(__arr.indexOf("bb2")!==-1)&
+(__arr.indexOf("bc3")!==-1)&
+(__arr.indexOf("bd4")!==-1)&
+(__arr.indexOf("ca1")!==-1)&
+(__arr.indexOf("cb2")!==-1)&
+(__arr.indexOf("cc3")!==-1)&
+(__arr.indexOf("cd4")!==-1)&
+(__arr.indexOf("da1")!==-1)&
+(__arr.indexOf("db2")!==-1)&
+(__arr.indexOf("dc3")!==-1)&
+(__arr.indexOf("dd4")!==-1)
+)) throw new Test262Error('#1: The nested for-in Statement applied to hierarchial object works properly as described in the Standard');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A5.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A5.js
new file mode 100644
index 0000000000..d018b9185b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A5.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationNoIn in
+ Expression) Statement"
+es5id: 12.6.4_A5
+description: >
+ Using hierarchical Object as an Expression is appropriate. The
+ depth is two
+---*/
+
+var __hash__map, __arr, __key, __ind;
+
+__hash__map={a:{aa:1,ab:2,ac:3,ad:4},b:{ba:1,bb:2,bc:3,bd:4},c:{ca:1,cb:2,cc:3,cd:4},d:{da:1,db:2,dc:3,dd:4}};
+
+__arr = "";
+
+for(__key in __hash__map){
+ for (__ind in __hash__map[__key]){
+ __arr+=("" + __ind + __hash__map[__key][__ind]);
+ }
+}
+
+if(!(
+(__arr.indexOf("aa1")!==-1)&
+(__arr.indexOf("ab2")!==-1)&
+(__arr.indexOf("ac3")!==-1)&
+(__arr.indexOf("ad4")!==-1)&
+(__arr.indexOf("ba1")!==-1)&
+(__arr.indexOf("bb2")!==-1)&
+(__arr.indexOf("bc3")!==-1)&
+(__arr.indexOf("bd4")!==-1)&
+(__arr.indexOf("ca1")!==-1)&
+(__arr.indexOf("cb2")!==-1)&
+(__arr.indexOf("cc3")!==-1)&
+(__arr.indexOf("cd4")!==-1)&
+(__arr.indexOf("da1")!==-1)&
+(__arr.indexOf("db2")!==-1)&
+(__arr.indexOf("dc3")!==-1)&
+(__arr.indexOf("dd4")!==-1)
+)) throw new Test262Error('#1: The nested for-in Statement applied to hierarchial object works properly as described in the Standard');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js
new file mode 100644
index 0000000000..b32c085afa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationNoIn in
+ Expression) Statement"
+es5id: 12.6.4_A6.1
+description: >
+ Using Object with custom prototype as an Expression is
+ appropriate. The prototype is "{feat:2,hint:"protohint"}"
+---*/
+
+var __accum;
+
+function FACTORY(){this.prop=1;this.hint="hinted"};
+
+FACTORY.prototype = {feat:2,hint:"protohint"};
+
+var __instance = new FACTORY;
+
+__accum="";
+
+for (var key in __instance){
+ __accum+=(key + __instance[key]);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) {
+ throw new Test262Error('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__accum.indexOf("hintprotohint")!==-1) {
+ throw new Test262Error('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.js
new file mode 100644
index 0000000000..3eacd7cc9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationNoIn in
+ Expression) Statement"
+es5id: 12.6.4_A6
+description: >
+ Using Object with custom prototype as an Expression is
+ appropriate. The prototype is "{feat:2,hint:"protohint"}"
+---*/
+
+var __accum, key;
+
+function FACTORY(){this.prop=1;this.hint="hinted"};
+
+FACTORY.prototype = {feat:2,hint:"protohint"};
+
+var __instance = new FACTORY;
+
+__accum="";
+
+for (key in __instance){
+ __accum+=(key + __instance[key]);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) {
+ throw new Test262Error('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__accum.indexOf("hintprotohint")!==-1) {
+ throw new Test262Error('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T1.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T1.js
new file mode 100644
index 0000000000..42ffcf4c32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T1.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Properties of the object being enumerated may be deleted during
+ enumeration
+es5id: 12.6.4_A7_T1
+description: >
+ Checking "for (LeftHandSideExpression in Expression) Statement"
+ case
+---*/
+
+var __obj, __accum, __key;
+
+__obj={aa:1,ba:2,ca:3};
+
+__accum="";
+
+for (__key in __obj){
+
+ erasator_T_1000(__obj,"b");
+
+ __accum+=(__key+__obj[__key]);
+
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!((__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1))) {
+ throw new Test262Error('#1: (__accum.indexOf("aa1")!==-1)&&(__accum.indexOf("ca3")!==-1)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__accum.indexOf("ba2")!==-1) {
+ throw new Test262Error('#2: __accum.indexOf("ba2") === -1. Actual: __accum.indexOf("ba2") ==='+ __accum.indexOf("ba2") );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+// erasator is the hash map terminator
+function erasator_T_1000(hash_map, charactr){
+ for (var key in hash_map){
+ if (key.indexOf(charactr)===0) {
+ delete hash_map[key];
+ };
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T2.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T2.js
new file mode 100644
index 0000000000..ae7800a414
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A7_T2.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Properties of the object being enumerated may be deleted during
+ enumeration
+es5id: 12.6.4_A7_T2
+description: >
+ Checking "for (var VariableDeclarationNoIn in Expression)
+ Statement" case
+---*/
+
+var __obj, __accum;
+
+__obj = Object.create(null);
+__obj.aa = 1;
+__obj.ba = 2;
+__obj.ca = 3;
+
+__accum="";
+
+for (var __key in __obj){
+
+ erasator_T_1000(__obj,"b");
+
+ __accum+=(__key+__obj[__key]);
+
+}
+
+assert(
+ __accum === "aa1ca3" || __accum === "ca3aa1",
+ "Unexpected value: '" + __accum + "'"
+);
+
+// erasator is the hash map terminator
+function erasator_T_1000(hash_map, charactr){
+ for (var key in hash_map){
+ if (key.indexOf(charactr)===0) {
+ delete hash_map[key];
+ };
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/browser.js b/js/src/tests/test262/language/statements/for-in/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/browser.js
diff --git a/js/src/tests/test262/language/statements/for-in/cptn-decl-abrupt-empty.js b/js/src/tests/test262/language/statements/for-in/cptn-decl-abrupt-empty.js
new file mode 100644
index 0000000000..1b8b4ae24b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/cptn-decl-abrupt-empty.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has a declaration and iteration is cancelled
+info: |
+ IterationStatement : for ( var ForBinding in Expression ) Statement
+
+ 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+ [...]
+ k. Let result be the result of evaluating stmt.
+ [...]
+ m. If LoopContinues(result, labelSet) is false, return
+ IteratorClose(iterator, UpdateEmpty(result, V)).
+---*/
+
+assert.sameValue(eval('1; for (var a in { x: 0 }) { break; }'), undefined);
+assert.sameValue(eval('2; for (var b in { x: 0 }) { 3; break; }'), 3);
+
+assert.sameValue(
+ eval('4; outer: do { for (var a in { x: 0 }) { continue outer; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; outer: do { for (var b in { x: 0 }) { 6; continue outer; } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/cptn-decl-itr.js b/js/src/tests/test262/language/statements/for-in/cptn-decl-itr.js
new file mode 100644
index 0000000000..c598e39f15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/cptn-decl-itr.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has a declaration and iteration occurs
+info: |
+ IterationStatement : for ( var ForBinding in Expression ) Statement
+
+ 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+ [...]
+ k. Let result be the result of evaluating stmt.
+ [...]
+ n. If result.[[value]] is not empty, let V be result.[[value]].
+---*/
+
+assert.sameValue(eval('1; for (var a in { x: 0 }) { }'), undefined);
+assert.sameValue(eval('2; for (var b in { x: 0 }) { 3; }'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/cptn-decl-skip-itr.js b/js/src/tests/test262/language/statements/for-in/cptn-decl-skip-itr.js
new file mode 100644
index 0000000000..7ee1ac90c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/cptn-decl-skip-itr.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has a declaration and iteration is skipped
+info: |
+ IterationStatement : for ( var ForBinding in Expression ) Statement
+
+ 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+
+ 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation
+
+ [...]
+ 7. If iterationKind is enumerate, then
+ a. If exprValue.[[value]] is null or undefined, then
+ i. Return Completion{[[type]]: break, [[value]]: empty, [[target]]:
+ empty}.
+---*/
+
+assert.sameValue(eval('1; for (var a in undefined) { }'), undefined);
+assert.sameValue(eval('2; for (var b in undefined) { 3; }'), undefined);
+assert.sameValue(eval('4; for (var c in null) { }'), undefined);
+assert.sameValue(eval('5; for (var d in null) { 6; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/cptn-decl-zero-itr.js b/js/src/tests/test262/language/statements/for-in/cptn-decl-zero-itr.js
new file mode 100644
index 0000000000..f4cb2efc4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/cptn-decl-zero-itr.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has a declaration and no iteration occurs
+info: |
+ IterationStatement : for ( var ForBinding in Expression ) Statement
+
+ 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+---*/
+
+assert.sameValue(eval('1; for (var a in {}) { }'), undefined);
+assert.sameValue(eval('2; for (var b in {}) { 3; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/cptn-expr-abrupt-empty.js b/js/src/tests/test262/language/statements/for-in/cptn-expr-abrupt-empty.js
new file mode 100644
index 0000000000..1e186b2b4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/cptn-expr-abrupt-empty.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has no declaration and iteration is cancelled
+info: |
+ IterationStatement : for ( LeftHandSideExpression in Expression ) Statement
+
+ 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+ [...]
+ k. Let result be the result of evaluating stmt.
+ [...]
+ m. If LoopContinues(result, labelSet) is false, return
+ IteratorClose(iterator, UpdateEmpty(result, V)).
+---*/
+
+assert.sameValue(eval('var a; 1; for (a in { x: 0 }) { break; }'), undefined);
+assert.sameValue(eval('var b; 2; for (b in { x: 0 }) { 3; break; }'), 3);
+
+assert.sameValue(
+ eval('var a; 4; outer: do { for (a in { x: 0 }) { continue outer; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('var b; 5; outer: do { for (b in { x: 0 }) { 6; continue outer; } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/cptn-expr-itr.js b/js/src/tests/test262/language/statements/for-in/cptn-expr-itr.js
new file mode 100644
index 0000000000..9e4242dc03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/cptn-expr-itr.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has no declaration and iteration occurs
+info: |
+ IterationStatement : for ( LeftHandSideExpression in Expression ) Statement
+
+ 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+ [...]
+ k. Let result be the result of evaluating stmt.
+ [...]
+ n. If result.[[value]] is not empty, let V be result.[[value]].
+---*/
+
+assert.sameValue(eval('var a; 1; for (a in { x: 0 }) { }'), undefined);
+assert.sameValue(eval('var b; 2; for (b in { x: 0 }) { 3; }'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/cptn-expr-skip-itr.js b/js/src/tests/test262/language/statements/for-in/cptn-expr-skip-itr.js
new file mode 100644
index 0000000000..f473542dec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/cptn-expr-skip-itr.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has no declaration and iteration is skipped
+info: |
+ IterationStatement : for ( LeftHandSideExpression in Expression ) Statement
+
+ 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+
+ 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation
+
+ [...]
+ 7. If iterationKind is enumerate, then
+ a. If exprValue.[[value]] is null or undefined, then
+ i. Return Completion{[[type]]: break, [[value]]: empty, [[target]]:
+ empty}.
+---*/
+
+assert.sameValue(eval('var a; 1; for (a in undefined) { }'), undefined);
+assert.sameValue(eval('var b; 2; for (b in undefined) { 3; }'), undefined);
+assert.sameValue(eval('var c; 4; for (c in null) { }'), undefined);
+assert.sameValue(eval('var d; 5; for (d in null) { 6; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/cptn-expr-zero-itr.js b/js/src/tests/test262/language/statements/for-in/cptn-expr-zero-itr.js
new file mode 100644
index 0000000000..a68f14494f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/cptn-expr-zero-itr.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has no declaration and no iteration occurs
+info: |
+ IterationStatement : for ( LeftHandSideExpression in Expression ) Statement
+
+ 1. Let keyResult be ForIn/OfHeadEvaluation( « », Expression, enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+---*/
+
+assert.sameValue(eval('var a; 1; for (a in {}) { }'), undefined);
+assert.sameValue(eval('var b; 2; for (b in {}) { 3; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/decl-async-fun.js b/js/src/tests/test262/language/statements/for-in/decl-async-fun.js
new file mode 100644
index 0000000000..daf6f9ac7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/decl-async-fun.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x in {}) async function f() {}
diff --git a/js/src/tests/test262/language/statements/for-in/decl-async-gen.js b/js/src/tests/test262/language/statements/for-in/decl-async-gen.js
new file mode 100644
index 0000000000..fb494e4384
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/decl-async-gen.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x in {}) async function* g() {}
diff --git a/js/src/tests/test262/language/statements/for-in/decl-cls.js b/js/src/tests/test262/language/statements/for-in/decl-cls.js
new file mode 100644
index 0000000000..71c5e75d11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/decl-cls.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x in {}) class C {}
diff --git a/js/src/tests/test262/language/statements/for-in/decl-const.js b/js/src/tests/test262/language/statements/for-in/decl-const.js
new file mode 100644
index 0000000000..44290e6877
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/decl-const.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x in {}) const y = null;
diff --git a/js/src/tests/test262/language/statements/for-in/decl-fun.js b/js/src/tests/test262/language/statements/for-in/decl-fun.js
new file mode 100644
index 0000000000..bbf0df9899
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/decl-fun.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Function declaration not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x in {}) function f() {}
diff --git a/js/src/tests/test262/language/statements/for-in/decl-gen.js b/js/src/tests/test262/language/statements/for-in/decl-gen.js
new file mode 100644
index 0000000000..a50259ad05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/decl-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x in {}) function* g() {}
diff --git a/js/src/tests/test262/language/statements/for-in/decl-let.js b/js/src/tests/test262/language/statements/for-in/decl-let.js
new file mode 100644
index 0000000000..db3fe3b034
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/decl-let.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x in {}) let y;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-elem-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-init-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..d58f1a9e2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-init-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([ x = yield ] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-array-invalid.js b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-array-invalid.js
new file mode 100644
index 0000000000..17f34e04c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-array-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([[(x, y)]] in [[[]]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-array-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..4f3e87dab4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-array-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([[x[yield]]] in [[[]]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..f07643b8f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js
@@ -0,0 +1,66 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-memberexpr-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (MemberExpression OptionalChain .IdentifierName Initializer) (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+var x = {};
+
+for ([x?.y = 42] in [[23]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-obj-invalid.js b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-obj-invalid.js
new file mode 100644
index 0000000000..d12f86f553
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-obj-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([{ get x() {} }] in [[{}]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..709a3fa9f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment outside of a generator function body, it behaves as a IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([{ x = yield }] in [[{}]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..1b05d6fd99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-obj-literal-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+
+for ([{
+ set y(val) {
+ throw new Test262Error('The property should not be accessed.');
+ }
+}?.y = 42] in [[23]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-elem-target-simple-strict-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-target-simple-strict-strict.js
new file mode 100644
index 0000000000..f5a4747f93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-target-simple-strict-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-target-simple-strict.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is false. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([arguments] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-elem-target-yield-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-target-yield-invalid-strict.js
new file mode 100644
index 0000000000..d0e58a5b06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-elem-target-yield-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-target-yield-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it behaves as an IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([ x[yield] ] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-element.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-element.js
new file mode 100644
index 0000000000..cc0e130b32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-element.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-before-element.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: An AssignmentElement may not follow an AssignmentRestElement in an AssignmentElementList. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...x, y] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-elision.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-elision.js
new file mode 100644
index 0000000000..5679bae445
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-elision.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-before-elision.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: An elision may not follow an AssignmentRestElement in an AssignmentElementList. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...x,] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-rest.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-rest.js
new file mode 100644
index 0000000000..d4f66dfce2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-before-rest.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-before-rest.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: An AssignmentRestElement may not follow another AssignmentRestElement in an AssignmentElementList. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...x, ...y] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-elision-invalid.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-elision-invalid.js
new file mode 100644
index 0000000000..a8ecd55db9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-elision-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-elision-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: ArrayAssignmentPattern may not include elisions following an AssignmentRestElement in a AssignmentElementList. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...x,] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-init.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-init.js
new file mode 100644
index 0000000000..b36cfaa08b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-init.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-init.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: The AssignmentRestElement does not support an initializer. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+var x;
+
+for ([...x = 1] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-array-invalid.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-array-invalid.js
new file mode 100644
index 0000000000..a15928fdad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-array-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...[(x, y)]] in [[[]]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-array-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..471ffd5816
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-array-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...[x[yield]]] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-obj-invalid.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-obj-invalid.js
new file mode 100644
index 0000000000..6e9f02e7f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-obj-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...{ get x() {} }] in [[[]]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..9bef5247c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...{ x = yield }] in [[{}]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/array-rest-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..8eb174f956
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/array-rest-yield-ident-invalid-strict.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentRestElement and outside of a generator function body, it should behave as an IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+var x = {};
+
+for ([...x[yield]] in [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/browser.js b/js/src/tests/test262/language/statements/for-in/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-id-identifier-yield-expr.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-identifier-yield-expr.js
new file mode 100644
index 0000000000..e25d88f3e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-identifier-yield-expr.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-yield-expr.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: yield is not a valid IdentifierReference in an AssignmentProperty within generator function bodies. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated, noStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+(function*() {
+
+for ({ yield } in [{}]) ;
+
+});
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-id-identifier-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-identifier-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..ad47dfa927
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-identifier-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: yield is not a valid IdentifierReference in an AssignmentProperty within strict mode code. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ yield } in [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-id-init-simple-strict-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-init-simple-strict-strict.js
new file mode 100644
index 0000000000..df621510c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-init-simple-strict-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-simple-strict.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if IsValidSimpleAssignmentTarget of IdentifierReference is false. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ eval = 0 } in [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-id-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-init-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..f58aecb243
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-init-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentProperty and outside of a generator function body, it should behave as an IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x = yield } in [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-id-simple-strict-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-simple-strict-strict.js
new file mode 100644
index 0000000000..96b86c86d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-id-simple-strict-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-simple-strict.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if IsValidSimpleAssignmentTarget of IdentifierReference is false. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ eval } in [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..4047197760
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: x = yield } in [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..91c8913af4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js
@@ -0,0 +1,66 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (MemberExpression OptionalChain .IdentifierName Initializer) (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+var y = {};
+
+for ({ x: y?.z = 42 } in [{ x: 23 }]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..ba16f696e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+
+for ({ x: {
+ set y(val) {
+ throw new Test262Error('The property should not be accessed.');
+ }
+}?.y = 42} in [{x: 42}]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..c900a5c99e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: x[yield] } in [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-array-invalid.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-array-invalid.js
new file mode 100644
index 0000000000..d7a6a95084
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-array-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: [(x, y)] } in [{ x: [] }]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..30d93ebabb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: [x = yield] } in [{ x: [] }]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-obj-invalid.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-obj-invalid.js
new file mode 100644
index 0000000000..bdb012fc97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-obj-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: { get x() {} } } in [{ x: {} }]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..cb77a9348f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: { x = yield } } in [{ x: {} }]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/obj-rest-not-last-element-invalid.js b/js/src/tests/test262/language/statements/for-in/dstr/obj-rest-not-last-element-invalid.js
new file mode 100644
index 0000000000..dc532f4d5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/obj-rest-not-last-element-invalid.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-not-last-element-invalid.case
+// - src/dstr-assignment/syntax/for-in.template
+/*---
+description: Object rest element needs to be the last AssignmenProperty in ObjectAssignmentPattern. (For..in statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+var rest, b;
+
+for ({...rest, b} in [{}
+]) ;
diff --git a/js/src/tests/test262/language/statements/for-in/dstr/shell.js b/js/src/tests/test262/language/statements/for-in/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/for-in/head-const-bound-names-dup.js b/js/src/tests/test262/language/statements/for-in/head-const-bound-names-dup.js
new file mode 100644
index 0000000000..df52e66409
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-const-bound-names-dup.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The head's declaration may not contain duplicate entries
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if the BoundNames of ForDeclaration contains any
+ duplicate entries.
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (const [x, x] in {}) {}
diff --git a/js/src/tests/test262/language/statements/for-in/head-const-bound-names-fordecl-tdz.js b/js/src/tests/test262/language/statements/for-in/head-const-bound-names-fordecl-tdz.js
new file mode 100644
index 0000000000..c3b281209c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-const-bound-names-fordecl-tdz.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.12_S2
+description: >
+ ForIn/Of: Bound names of ForDeclaration are in TDZ (for-of)
+---*/
+
+assert.throws(ReferenceError, function() {
+ let x = 1;
+ for (const x in { x }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-const-bound-names-in-stmt.js b/js/src/tests/test262/language/statements/for-in/head-const-bound-names-in-stmt.js
new file mode 100644
index 0000000000..27c09224a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-const-bound-names-in-stmt.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The body may not re-declare variables declared in the head
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if any element of the BoundNames of ForDeclaration
+ also occurs in the VarDeclaredNames of Statement.
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (const x in {}) {
+ var x;
+}
diff --git a/js/src/tests/test262/language/statements/for-in/head-const-bound-names-let.js b/js/src/tests/test262/language/statements/for-in/head-const-bound-names-let.js
new file mode 100644
index 0000000000..deca364ed5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-const-bound-names-let.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The declaration may not contain a binding for `let`
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if the BoundNames of ForDeclaration contains "let".
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+for (const let in {}) {}
diff --git a/js/src/tests/test262/language/statements/for-in/head-const-fresh-binding-per-iteration.js b/js/src/tests/test262/language/statements/for-in/head-const-fresh-binding-per-iteration.js
new file mode 100644
index 0000000000..460f398e4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-const-fresh-binding-per-iteration.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ const ForDeclaration: creates a fresh binding per iteration
+---*/
+
+let s = '';
+for (const x of [1, 2, 3]) {
+ s += x;
+}
+assert.sameValue(s, '123', "The value of `s` is `'123'`");
+
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-decl-expr.js b/js/src/tests/test262/language/statements/for-in/head-decl-expr.js
new file mode 100644
index 0000000000..7208b10a5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-decl-expr.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Expression is allowed in head
+info: |
+ IterationStatement : for ( ForDeclaration in Expression ) Statement
+
+ 1. Let keyResult be the result of performing
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration, Expression,
+ enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+es6id: 13.7.5.11
+---*/
+
+var iterCount = 0;
+
+for (let x in null, { key: 0 }) {
+ assert.sameValue(x, 'key');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-expr-expr.js b/js/src/tests/test262/language/statements/for-in/head-expr-expr.js
new file mode 100644
index 0000000000..9ad88f1836
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-expr-expr.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Expression is allowed in head
+info: |
+ IterationStatement : for ( ForDeclaration in Expression ) Statement
+
+ 1. Let keyResult be the result of performing
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration, Expression,
+ enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+es6id: 13.7.5.11
+---*/
+
+var iterCount = 0;
+var x;
+
+for (x in null, { key: 0 }) {
+ assert.sameValue(x, 'key');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-let-bound-names-dup.js b/js/src/tests/test262/language/statements/for-in/head-let-bound-names-dup.js
new file mode 100644
index 0000000000..f3ac4d4ef4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-let-bound-names-dup.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The head's declaration may not contain duplicate entries
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if the BoundNames of ForDeclaration contains any
+ duplicate entries.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (let [x, x] in {}) {}
diff --git a/js/src/tests/test262/language/statements/for-in/head-let-bound-names-fordecl-tdz.js b/js/src/tests/test262/language/statements/for-in/head-let-bound-names-fordecl-tdz.js
new file mode 100644
index 0000000000..2693e9e318
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-let-bound-names-fordecl-tdz.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.12_S2
+description: >
+ ForIn/Of: Bound names of ForDeclaration are in TDZ (for-of)
+---*/
+
+assert.throws(ReferenceError, function() {
+ let x = 1;
+ for (let x in { x }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-let-bound-names-in-stmt.js b/js/src/tests/test262/language/statements/for-in/head-let-bound-names-in-stmt.js
new file mode 100644
index 0000000000..2264f8e31a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-let-bound-names-in-stmt.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The body may not re-declare variables declared in the head
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if any element of the BoundNames of ForDeclaration
+ also occurs in the VarDeclaredNames of Statement.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (let x in {}) {
+ var x;
+}
diff --git a/js/src/tests/test262/language/statements/for-in/head-let-bound-names-let.js b/js/src/tests/test262/language/statements/for-in/head-let-bound-names-let.js
new file mode 100644
index 0000000000..42bf0f6523
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-let-bound-names-let.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The declaration may not contain a binding for `let`
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if the BoundNames of ForDeclaration contains "let".
+flags: [noStrict]
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (let let in {}) {}
diff --git a/js/src/tests/test262/language/statements/for-in/head-let-destructuring.js b/js/src/tests/test262/language/statements/for-in/head-let-destructuring.js
new file mode 100644
index 0000000000..c9465b8b7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-let-destructuring.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+es6id: 13.7
+description: >
+ The token sequence `let [`is interpreted as the beginning of a destructuring
+ binding pattern
+info: |
+ Syntax
+
+ IterationStatement[Yield, Return]:
+
+ for ( [lookahead ∉ { let [ } ] LeftHandSideExpression[?Yield] in
+ Expression[+In, ?Yield] ) Statement[?Yield, ?Return]
+
+ for ( ForDeclaration[?Yield] in Expression[+In, ?Yield] )
+ Statement[?Yield, ?Return]
+---*/
+
+var obj = Object.create(null);
+var value;
+
+obj.key = 1;
+
+for ( let[x] in obj ) {
+ value = x;
+}
+
+assert.sameValue(typeof x, 'undefined', 'binding is block-scoped');
+assert.sameValue(value, 'k');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-let-fresh-binding-per-iteration.js b/js/src/tests/test262/language/statements/for-in/head-let-fresh-binding-per-iteration.js
new file mode 100644
index 0000000000..b1aea266fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-let-fresh-binding-per-iteration.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset
+es6id: 13.7.5.13
+description: >
+ let ForDeclaration: creates a fresh binding per iteration
+---*/
+
+var fns = {};
+var obj = Object.create(null);
+obj.a = 1;
+obj.b = 1;
+obj.c = 1;
+
+for (let x in obj) {
+ // Store function objects as properties of an object so that their return
+ // value may be verified regardless of the for-in statement's enumeration
+ // order.
+ fns[x] = function() { return x; };
+}
+
+assert.sameValue(typeof fns.a, 'function', 'property definition: "a"');
+assert.sameValue(fns.a(), 'a');
+assert.sameValue(typeof fns.b, 'function', 'property definition: "b"');
+assert.sameValue(fns.b(), 'b');
+assert.sameValue(typeof fns.c, 'function', 'property definition: "c"');
+assert.sameValue(fns.c(), 'c');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-lhs-cover-non-asnmt-trgt.js b/js/src/tests/test262/language/statements/for-in/head-lhs-cover-non-asnmt-trgt.js
new file mode 100644
index 0000000000..21c5c9124e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-lhs-cover-non-asnmt-trgt.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Head's LeftHandSideExpression must be a simple assignment target
+info: |
+ It is a Syntax Error if IsValidSimpleAssignmentTarget of
+ LeftHandSideExpression is false.
+
+ It is a Syntax Error if the LeftHandSideExpression is
+ CoverParenthesizedExpressionAndArrowParameterList : ( Expression ) and
+ Expression derives a production that would produce a Syntax Error according
+ to these rules if that production is substituted for
+ LeftHandSideExpression. This rule is recursively applied.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ((this) in {}) {}
diff --git a/js/src/tests/test262/language/statements/for-in/head-lhs-cover.js b/js/src/tests/test262/language/statements/for-in/head-lhs-cover.js
new file mode 100644
index 0000000000..108a4775c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-lhs-cover.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Head's AssignmentExpression may be CoverParenthesizedExpressionAndArrowParameterList
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+var iterCount = 0;
+var x;
+
+for ((x) in { attr: null }) {
+ assert.sameValue(x, 'attr');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-ary.js b/js/src/tests/test262/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-ary.js
new file mode 100644
index 0000000000..0710c74012
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-ary.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Invalid destructuring assignment pattern (array literal)
+info: |
+ It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral
+ or an ArrayLiteral and if the lexical token sequence matched by
+ LeftHandSideExpression cannot be parsed with no tokens left over using
+ AssignmentPattern as the goal symbol.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ([(x, y)] in {}) {}
diff --git a/js/src/tests/test262/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-obj.js b/js/src/tests/test262/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-obj.js
new file mode 100644
index 0000000000..ca8a72be7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-lhs-invalid-asnmt-ptrn-obj.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Invalid destructuring assignment pattern (object literal)
+info: |
+ It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral
+ or an ArrayLiteral and if the lexical token sequence matched by
+ LeftHandSideExpression cannot be parsed with no tokens left over using
+ AssignmentPattern as the goal symbol.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ({ m() {} } in {}) {}
diff --git a/js/src/tests/test262/language/statements/for-in/head-lhs-let.js b/js/src/tests/test262/language/statements/for-in/head-lhs-let.js
new file mode 100644
index 0000000000..4e45b7c9a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-lhs-let.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+es6id: 13.7
+description: >
+ The `let` token is interpreted as an Identifier when it is not followed by a
+ `[` token
+info: |
+ Syntax
+
+ IterationStatement[Yield, Return]:
+
+ for ( [lookahead ∉ { let [ } ] LeftHandSideExpression[?Yield] in
+ Expression[+In, ?Yield] ) Statement[?Yield, ?Return]
+
+ for ( ForDeclaration[?Yield] in Expression[+In, ?Yield] )
+ Statement[?Yield, ?Return]
+flags: [noStrict]
+---*/
+
+var obj = Object.create(null);
+var let, value;
+
+obj.key = 1;
+
+for ( let in obj ) ;
+
+assert.sameValue(let, 'key', 'IdentifierReference');
+
+Object.defineProperty(Array.prototype, '1', {
+ set: function(param) {
+ value = param;
+ }
+});
+for ( [let][1] in obj ) ;
+
+assert.sameValue(value, 'key', 'MemberExpression');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-lhs-member.js b/js/src/tests/test262/language/statements/for-in/head-lhs-member.js
new file mode 100644
index 0000000000..1aabaa75b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-lhs-member.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Head's AssignmentExpression may be a MemberExpression
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+var iterCount = 0;
+var x = {};
+
+for (x.y in { attr: null }) {
+ assert.sameValue(x.y, 'attr');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-lhs-non-asnmt-trgt.js b/js/src/tests/test262/language/statements/for-in/head-lhs-non-asnmt-trgt.js
new file mode 100644
index 0000000000..4c195a0402
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-lhs-non-asnmt-trgt.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Head's LeftHandSideExpression must be a simple assignment target
+info: |
+ It is a Syntax Error if IsValidSimpleAssignmentTarget of
+ LeftHandSideExpression is false.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (this in {}) {}
diff --git a/js/src/tests/test262/language/statements/for-in/head-var-bound-names-dup.js b/js/src/tests/test262/language/statements/for-in/head-var-bound-names-dup.js
new file mode 100644
index 0000000000..83d4f820dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-var-bound-names-dup.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: The head's declaration may contain duplicate entries
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+var iterCount = 0;
+
+for (var [x, x] in { ab: null }) {
+ assert.sameValue(x, 'b');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-var-bound-names-in-stmt.js b/js/src/tests/test262/language/statements/for-in/head-var-bound-names-in-stmt.js
new file mode 100644
index 0000000000..7dcffd8a1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-var-bound-names-in-stmt.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The body may re-declare variables declared in the head
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+var iterCount = 0;
+
+for (var x in { attr: null }) {
+ var x;
+
+ assert.sameValue(x, 'attr');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-var-bound-names-let.js b/js/src/tests/test262/language/statements/for-in/head-var-bound-names-let.js
new file mode 100644
index 0000000000..9af850a2d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-var-bound-names-let.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: The head's bound names may include "let"
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+flags: [noStrict]
+---*/
+
+var iterCount = 0;
+
+for (var let in { attr: null }) {
+ assert.sameValue(let, 'attr');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/head-var-expr.js b/js/src/tests/test262/language/statements/for-in/head-var-expr.js
new file mode 100644
index 0000000000..b7ff66f987
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-var-expr.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Expression is allowed in head
+info: |
+ IterationStatement : for ( ForDeclaration in Expression ) Statement
+
+ 1. Let keyResult be the result of performing
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration, Expression,
+ enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+es6id: 13.7.5.11
+---*/
+
+var iterCount = 0;
+
+for (var x in null, { key: 0 }) {
+ assert.sameValue(x, 'key');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/identifier-let-allowed-as-lefthandside-expression-not-strict.js b/js/src/tests/test262/language/statements/for-in/identifier-let-allowed-as-lefthandside-expression-not-strict.js
new file mode 100644
index 0000000000..f0d109c679
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/identifier-let-allowed-as-lefthandside-expression-not-strict.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ identifier "let" allowed as lefthandside expression
+esid: sec-iteration-statements
+info: |
+ for ( [ lookahead ∉ { let [ } ] LeftHandSideExpression [?Yield, ?Await] in
+ Expression[+In, ?Yield, ? Await]) Statement[?Yield, ?Await, ?Return]
+flags: [noStrict]
+---*/
+for (let in {}) { }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-const.js b/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-const.js
new file mode 100644
index 0000000000..021a7f923b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-const.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (const x in {}) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-let.js b/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-let.js
new file mode 100644
index 0000000000..557f634a92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-let.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (let x in {}) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-lhs.js b/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-lhs.js
new file mode 100644
index 0000000000..a95c2e3895
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-lhs.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (x in {}) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-var.js b/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-var.js
new file mode 100644
index 0000000000..dc3c9c38e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/labelled-fn-stmt-var.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (var x in {}) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for-in/let-array-with-newline.js b/js/src/tests/test262/language/statements/for-in/let-array-with-newline.js
new file mode 100644
index 0000000000..3cef8a7963
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/let-array-with-newline.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x in null) let
+[a] = 0;
diff --git a/js/src/tests/test262/language/statements/for-in/let-block-with-newline.js b/js/src/tests/test262/language/statements/for-in/let-block-with-newline.js
new file mode 100644
index 0000000000..27a6bf9268
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/let-block-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let {`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+for (var x in null) let // ASI
+{}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/let-identifier-with-newline.js b/js/src/tests/test262/language/statements/for-in/let-identifier-with-newline.js
new file mode 100644
index 0000000000..89c01ee5c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/let-identifier-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+for (var x in null) let // ASI
+x = 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/order-after-define-property.js b/js/src/tests/test262/language/statements/for-in/order-after-define-property.js
new file mode 100644
index 0000000000..f4b53b95a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/order-after-define-property.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-enumerate-object-properties
+description: >
+ Property names are returned in ascending chronological order of creation
+ that is unaffected by [[DefineOwnProperty]].
+info: |
+ EnumerateObjectProperties ( O )
+
+ EnumerateObjectProperties must obtain the own property keys of the target object
+ by calling its [[OwnPropertyKeys]] internal method. Property attributes of the
+ target object must be obtained by calling its [[GetOwnProperty]] internal method.
+
+ OrdinaryOwnPropertyKeys ( O )
+
+ [...]
+ 3. For each own property key P of O that is a String but is not an array index,
+ in ascending chronological order of property creation, do
+ a. Add P as the last element of keys.
+ [...]
+ 5. Return keys.
+includes: [compareArray.js]
+---*/
+
+var obj = {};
+obj.a = 1;
+obj.b = 2;
+Object.defineProperty(obj, "a", {value: 11});
+var objKeys = [];
+for (var objKey in obj) {
+ objKeys.push(objKey);
+}
+assert.compareArray(objKeys, ["a", "b"]);
+
+var arr = [];
+Object.defineProperty(arr, "a", {
+ get: function() {},
+ enumerable: true,
+ configurable: true,
+})
+arr.b = 2;
+Object.defineProperty(arr, "a", {
+ get: function() {},
+});
+var arrKeys = [];
+for (var arrKey in arr) {
+ arrKeys.push(arrKey);
+}
+assert.compareArray(arrKeys, ["a", "b"]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/order-enumerable-shadowed.js b/js/src/tests/test262/language/statements/for-in/order-enumerable-shadowed.js
new file mode 100644
index 0000000000..f1315a7ad4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/order-enumerable-shadowed.js
@@ -0,0 +1,35 @@
+// Copyright 2019 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-enumerate-object-properties
+description: Enumerable properties the prototype which are shadowed by non-enumerable properties on the object are not enumerated
+features: [for-in-order]
+includes: [compareArray.js]
+---*/
+
+var proto = {
+ p2: 'p2',
+};
+
+var o = Object.create(proto, {
+ 'p1': {
+ value: 'p1',
+ enumerable: true,
+ },
+ 'p2': {
+ value: 'p1',
+ enumerable: false,
+ },
+});
+
+
+
+var keys = [];
+for (var key in o) {
+ keys.push(key);
+}
+
+assert.compareArray(keys, ['p1']);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/order-property-added.js b/js/src/tests/test262/language/statements/for-in/order-property-added.js
new file mode 100644
index 0000000000..54ab4b19f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/order-property-added.js
@@ -0,0 +1,27 @@
+// Copyright 2019 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-enumerate-object-properties
+description: Properties added to the object during iteration are not enumerated
+features: [for-in-order]
+includes: [compareArray.js]
+---*/
+
+var o = {
+ p1: 'p1',
+ p2: 'p2',
+ p3: 'p3',
+};
+
+var keys = [];
+for (var key in o) {
+ if (key === 'p1') {
+ o.p4 = 'p4';
+ }
+ keys.push(key);
+}
+
+assert.compareArray(keys, ['p1', 'p2', 'p3']);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/order-property-on-prototype.js b/js/src/tests/test262/language/statements/for-in/order-property-on-prototype.js
new file mode 100644
index 0000000000..c1f1e9de38
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/order-property-on-prototype.js
@@ -0,0 +1,30 @@
+// Copyright 2019 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-enumerate-object-properties
+description: Properties on the prototype are enumerated after properties on the object
+features: [for-in-order]
+includes: [compareArray.js]
+---*/
+
+var proto = {
+ p4: 'p4',
+};
+
+var o = {
+ p1: 'p1',
+ p2: 'p2',
+ p3: 'p3',
+};
+
+Object.setPrototypeOf(o, proto);
+
+var keys = [];
+for (var key in o) {
+ keys.push(key);
+}
+
+assert.compareArray(keys, ['p1', 'p2', 'p3', 'p4']);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/order-simple-object.js b/js/src/tests/test262/language/statements/for-in/order-simple-object.js
new file mode 100644
index 0000000000..6c066eeb32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/order-simple-object.js
@@ -0,0 +1,35 @@
+// Copyright 2019 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-enumerate-object-properties
+description: Property enumeration order for simple objects
+features: [for-in-order]
+includes: [compareArray.js]
+---*/
+
+var o = {
+ p1: 'p1',
+ p2: 'p2',
+ p3: 'p3',
+};
+
+o.p4 = 'p4';
+
+o[2] = '2';
+o[0] = '0';
+o[1] = '1';
+
+delete o.p1;
+delete o.p3;
+o.p1 = 'p1';
+
+
+var keys = [];
+for (var key in o) {
+ keys.push(key);
+}
+
+assert.compareArray(keys, ['0', '1', '2', 'p2', 'p4', 'p1']);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/scope-body-lex-boundary.js b/js/src/tests/test262/language/statements/for-in/scope-body-lex-boundary.js
new file mode 100644
index 0000000000..506fb0ff60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/scope-body-lex-boundary.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Creation of new lexical environment for each evaluation of the statement
+ body
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. Repeat
+ [...]
+ i. Let result be the result of evaluating stmt.
+ j. Set the running execution context's LexicalEnvironment to oldEnv.
+ k. If LoopContinues(result, labelSet) is false, return ?
+ IteratorClose(iterator, UpdateEmpty(result, V)).
+ l. If result.[[Value]] is not empty, let V be result.[[Value]].
+features: [let]
+---*/
+
+let x = 'outside';
+var probeFirst, probeSecond;
+
+for (let x in { a: 0, b: 0 })
+ if (!probeFirst)
+ probeFirst = function() { return x; };
+ else
+ probeSecond = function() { return x; };
+
+
+// 13.7.5.15 EnumerateObjectProperties
+//
+// > [...] The mechanics and order of enumerating the properties is not
+// > specified [...]
+assert.notSameValue(probeFirst(), probeSecond());
+assert(
+ probeFirst() === 'a' || probeFirst() === 'b',
+ 'First binding is either "a" or "b"'
+);
+assert(
+ probeSecond() === 'a' || probeSecond() === 'b',
+ 'Second binding is either "a" or "b"'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/scope-body-lex-close.js b/js/src/tests/test262/language/statements/for-in/scope-body-lex-close.js
new file mode 100644
index 0000000000..b24988864a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/scope-body-lex-close.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Removal of lexical environment for the initial evaluation of the statement
+ body
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. Repeat
+ [...]
+ i. Let result be the result of evaluating stmt.
+ j. Set the running execution context's LexicalEnvironment to oldEnv.
+ k. If LoopContinues(result, labelSet) is false, return ?
+ IteratorClose(iterator, UpdateEmpty(result, V)).
+ l. If result.[[Value]] is not empty, let V be result.[[Value]].
+features: [let]
+---*/
+
+let x = 'outside';
+var probeDecl, probeBody;
+
+for (
+ let [x, _ = probeDecl = function() { return x; }]
+ in
+ { i: 0 }
+ )
+ probeBody = function() { return x; };
+
+assert.sameValue(probeDecl(), 'i', 'reference from ForDeclaration');
+assert.sameValue(probeBody(), 'i', 'reference from statement body');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/scope-body-lex-open.js b/js/src/tests/test262/language/statements/for-in/scope-body-lex-open.js
new file mode 100644
index 0000000000..e33b87aa0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/scope-body-lex-open.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Creation of new lexical environment for the initial evaluation of the
+ statement body
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. Repeat
+ [...]
+ d. If lhsKind is either assignment or varBinding, then
+ [...]
+ e. Else,
+ i. Assert: lhsKind is lexicalBinding.
+ ii. Assert: lhs is a ForDeclaration.
+ iii. Let iterationEnv be NewDeclarativeEnvironment(oldEnv).
+ iv. Perform BindingInstantiation for lhs passing iterationEnv as the
+ argument.
+ v. Set the running execution context's LexicalEnvironment to
+ iterationEnv.
+ [...]
+features: [let]
+---*/
+
+var probeBefore = function() { return x; };
+let x = 'outside';
+var probeExpr, probeDecl, probeBody;
+
+for (
+ let [x, _ = probeDecl = function() { return x; }]
+ in
+ { i: probeExpr = function() { typeof x; }}
+ )
+ probeBody = function() { return x; };
+
+assert.sameValue(probeBefore(), 'outside');
+assert.throws(ReferenceError, probeExpr);
+assert.sameValue(probeDecl(), 'i', 'reference from ForDeclaration');
+assert.sameValue(probeBody(), 'i', 'reference from statement body');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/scope-body-var-none.js b/js/src/tests/test262/language/statements/for-in/scope-body-var-none.js
new file mode 100644
index 0000000000..63b0cc6c6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/scope-body-var-none.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: No variable environment is created for the statement body
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. Repeat
+ [...]
+ d. If lhsKind is either assignment or varBinding, then
+ [...]
+ e. Else,
+ i. Assert: lhsKind is lexicalBinding.
+ ii. Assert: lhs is a ForDeclaration.
+ iii. Let iterationEnv be NewDeclarativeEnvironment(oldEnv).
+ iv. Perform BindingInstantiation for lhs passing iterationEnv as the
+ argument.
+ v. Set the running execution context's LexicalEnvironment to
+ iterationEnv.
+ [...]
+features: [let]
+---*/
+
+var probeBefore = function() { return x; };
+var probeExpr, probeDecl, probeBody;
+var x = 1;
+
+for (
+ let [_ = probeDecl = function() { return x; }]
+ in
+ { '': probeExpr = function() { return x; }}
+ )
+ var x = 2, __ = probeBody = function() { return x; };
+
+
+assert.sameValue(probeBefore(), 2, 'reference preceding statement');
+assert.sameValue(probeExpr(), 2, 'reference from AssignmentExpression');
+assert.sameValue(probeDecl(), 2, 'reference from ForDeclaration');
+assert.sameValue(probeBody(), 2, 'reference from statement body');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/scope-head-lex-close.js b/js/src/tests/test262/language/statements/for-in/scope-head-lex-close.js
new file mode 100644
index 0000000000..911644825f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/scope-head-lex-close.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Removal of lexical environment to serve as a temporal dead zone for the
+ statement's AssignmentExpresson
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ?
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration,
+ AssignmentExpression, iterate).
+ [...]
+
+ 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation
+
+ [...]
+ 2. If TDZnames is not an empty List, then
+ a. Assert: TDZnames has no duplicate entries.
+ b. Let TDZ be NewDeclarativeEnvironment(oldEnv).
+ c. Let TDZEnvRec be TDZ's EnvironmentRecord.
+ d. For each string name in TDZnames, do
+ i. Perform ! TDZEnvRec.CreateMutableBinding(name, false).
+ e. Set the running execution context's LexicalEnvironment to TDZ.
+ 3. Let exprRef be the result of evaluating expr.
+ 4. Set the running execution context's LexicalEnvironment to oldEnv.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeDecl, probeExpr, probeBody;
+
+for (
+ let [x, _ = probeDecl = function() { return x; }]
+ in
+ { i: probeExpr = function() { typeof x; } }
+ )
+ probeBody = function() { return x; };
+
+assert.throws(ReferenceError, probeExpr);
+assert.sameValue(probeDecl(), 'i', 'reference from ForDeclaration');
+assert.sameValue(probeBody(), 'i', 'reference from statement body');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/scope-head-lex-open.js b/js/src/tests/test262/language/statements/for-in/scope-head-lex-open.js
new file mode 100644
index 0000000000..fb51fb7cb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/scope-head-lex-open.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Creation of new lexical environment to serve as a temporal dead zone for
+ the statement's AssignmentExpresson
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ?
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration,
+ AssignmentExpression, iterate).
+ [...]
+
+ 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation
+
+ [...]
+ 2. If TDZnames is not an empty List, then
+ a. Assert: TDZnames has no duplicate entries.
+ b. Let TDZ be NewDeclarativeEnvironment(oldEnv).
+ c. Let TDZEnvRec be TDZ's EnvironmentRecord.
+ d. For each string name in TDZnames, do
+ i. Perform ! TDZEnvRec.CreateMutableBinding(name, false).
+ e. Set the running execution context's LexicalEnvironment to TDZ.
+ 3. Let exprRef be the result of evaluating expr.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeBefore = function() { return x; };
+var probeExpr;
+
+for (let x in { i: probeExpr = function() { typeof x; }}) ;
+
+assert.sameValue(probeBefore(), 'outside');
+assert.throws(ReferenceError, probeExpr);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/scope-head-var-none.js b/js/src/tests/test262/language/statements/for-in/scope-head-var-none.js
new file mode 100644
index 0000000000..d0536483b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/scope-head-var-none.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ No variable environment is created for the statement "head"
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ?
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration,
+ AssignmentExpression, iterate).
+ [...]
+
+ 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation
+
+ [...]
+ 2. If TDZnames is not an empty List, then
+ a. Assert: TDZnames has no duplicate entries.
+ b. Let TDZ be NewDeclarativeEnvironment(oldEnv).
+ c. Let TDZEnvRec be TDZ's EnvironmentRecord.
+ d. For each string name in TDZnames, do
+ i. Perform ! TDZEnvRec.CreateMutableBinding(name, false).
+ e. Set the running execution context's LexicalEnvironment to TDZ.
+ 3. Let exprRef be the result of evaluating expr.
+ [...]
+flags: [noStrict]
+---*/
+
+var probeBefore = function() { return x; };
+var x = 1;
+var probeDecl, probeExpr, probeBody;
+
+for (
+ let [_ = probeDecl = function() { return x; }]
+ in
+ { '': (eval('var x = 2;'), probeExpr = function() { return x; }) }
+ )
+ probeBody = function() { return x; };
+
+assert.sameValue(probeBefore(), 2, 'reference preceding statement');
+assert.sameValue(probeDecl(), 2, 'reference from ForDeclaration');
+assert.sameValue(probeExpr(), 2, 'reference from AssignmentExpression');
+assert.sameValue(probeBody(), 2, 'reference from statement body');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-in/shell.js b/js/src/tests/test262/language/statements/for-in/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/shell.js
diff --git a/js/src/tests/test262/language/statements/for-in/var-arguments-fn-strict-init-strict.js b/js/src/tests/test262/language/statements/for-in/var-arguments-fn-strict-init-strict.js
new file mode 100644
index 0000000000..2fa07fc233
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/var-arguments-fn-strict-init-strict.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: >
+ 'for(var arguments = 42 in ...) {...}' throws SyntaxError in
+ strict mode within a function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ for (var arguments = 42 in null) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-in/var-arguments-fn-strict-strict.js b/js/src/tests/test262/language/statements/for-in/var-arguments-fn-strict-strict.js
new file mode 100644
index 0000000000..efdfe80745
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/var-arguments-fn-strict-strict.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: >
+ 'for(var arguments in ...) {...}' throws SyntaxError in strict mode within a
+ function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ for (var arguments in null) {}
+}
diff --git a/js/src/tests/test262/language/statements/for-in/var-arguments-strict-init-strict.js b/js/src/tests/test262/language/statements/for-in/var-arguments-strict-init-strict.js
new file mode 100644
index 0000000000..ffe0728b9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/var-arguments-strict-init-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: >
+ 'for(var arguments = 42 in ...) {...}' throws SyntaxError in
+ strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var arguments = 42 in null) {}
diff --git a/js/src/tests/test262/language/statements/for-in/var-arguments-strict-strict.js b/js/src/tests/test262/language/statements/for-in/var-arguments-strict-strict.js
new file mode 100644
index 0000000000..64ca63ea83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/var-arguments-strict-strict.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: "'for(var arguments in ...) {...}' throws SyntaxError in strict mode"
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var arguments in null) {}
diff --git a/js/src/tests/test262/language/statements/for-in/var-eval-strict-init-strict.js b/js/src/tests/test262/language/statements/for-in/var-eval-strict-init-strict.js
new file mode 100644
index 0000000000..b841da936b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/var-eval-strict-init-strict.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: "'for(var eval = 42 in ...) {...}' throws SyntaxError in strict mode"
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var eval = 42 in null) {}
diff --git a/js/src/tests/test262/language/statements/for-in/var-eval-strict-strict.js b/js/src/tests/test262/language/statements/for-in/var-eval-strict-strict.js
new file mode 100644
index 0000000000..ed6753dcfd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/var-eval-strict-strict.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: "'for(var eval in ...) {...}' throws SyntaxError in strict mode"
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var eval in null) {}
diff --git a/js/src/tests/test262/language/statements/for-of/Array.prototype.Symbol.iterator.js b/js/src/tests/test262/language/statements/for-of/Array.prototype.Symbol.iterator.js
new file mode 100644
index 0000000000..58fb131db5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/Array.prototype.Symbol.iterator.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The method should return a valid iterator that can be traversed using a
+ `for...of` loop.
+es6id: 22.1.3.30
+features: [Symbol.iterator]
+---*/
+
+var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
+var i = 0;
+
+for (var value of array[Symbol.iterator]()) {
+ assert.sameValue(value, array[i], 'element at index ' + i);
+ i++;
+}
+
+assert.sameValue(i, 8, 'Visits all elements');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/Array.prototype.entries.js b/js/src/tests/test262/language/statements/for-of/Array.prototype.entries.js
new file mode 100644
index 0000000000..82e747d4b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/Array.prototype.entries.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ The method should return a valid iterator that can be traversed using a
+ `for...of` loop.
+ es6id: 22.1.3.4
+---*/
+
+var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
+var i = 0;
+
+for (var value of array.entries()) {
+ assert.sameValue(
+ value[0], i, 'element at index ' + i + ': value (array key)'
+ );
+ assert.sameValue(
+ value[1], array[i], 'element at index ' + i + ': value (array value)'
+ );
+ assert.sameValue(
+ value.length, 2, 'element at index ' + i + ': value (array length)'
+ );
+ i++;
+}
+
+assert.sameValue(i, 8, 'Visits all elements');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/Array.prototype.keys.js b/js/src/tests/test262/language/statements/for-of/Array.prototype.keys.js
new file mode 100644
index 0000000000..2c71795448
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/Array.prototype.keys.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ The method should return a valid iterator that can be traversed using a
+ `for...of` loop.
+ es6id: 22.1.3.13
+---*/
+
+var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
+var i = 0;
+
+for (var value of array.keys()) {
+ assert.sameValue(value, i, 'element at index ' + i);
+ i++;
+}
+
+assert.sameValue(i, 8, 'Visits all elements');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/arguments-mapped-aliasing.js b/js/src/tests/test262/language/statements/for-of/arguments-mapped-aliasing.js
new file mode 100644
index 0000000000..5464686c0b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/arguments-mapped-aliasing.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: >
+ Mapped arguments object mutation via alias during traversal using for..of
+info: |
+ "Mapped" arguments objects should be able to be traversed using a `for..of`
+ loop, and dynamic changes to the formal parameters should be reflected in
+ the iterated values.
+flags: [noStrict]
+---*/
+
+var expected = [1, 3, 1];
+var i = 0;
+
+(function(a, b, c) {
+ for (var value of arguments) {
+ a = b;
+ b = c;
+ c = i;
+ assert.sameValue(value, expected[i], 'argument at index ' + i);
+ i++;
+ }
+
+}(1, 2, 3));
+
+assert.sameValue(i, 3, 'Visits all arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/arguments-mapped-mutation.js b/js/src/tests/test262/language/statements/for-of/arguments-mapped-mutation.js
new file mode 100644
index 0000000000..283033dc01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/arguments-mapped-mutation.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Mapped arguments object mutation during traversal using for..of
+info: |
+ "Mapped" arguments objects should be able to be traversed using a `for..of`
+ loop, and dynamic changes to their contents should be reflected in the
+ iterated values.
+flags: [noStrict]
+---*/
+
+var expected = [1, 4, 6];
+var i = 0;
+
+(function() {
+ for (var value of arguments) {
+ assert.sameValue(value, expected[i], 'argument at index ' + i);
+ i++;
+ arguments[i] *= 2;
+ }
+}(1, 2, 3));
+
+assert.sameValue(i, 3, 'Visits all arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/arguments-mapped.js b/js/src/tests/test262/language/statements/for-of/arguments-mapped.js
new file mode 100644
index 0000000000..236677f921
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/arguments-mapped.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Mapped arguments object traversal using for..of
+info: |
+ "Mapped" arguments objects should be able to be traversed using a `for..of`
+ loop.
+flags: [noStrict]
+---*/
+
+var i = 0;
+
+(function() {
+ for (var value of arguments) {
+ assert.sameValue(value, arguments[i], 'argument at index ' + i);
+ i++;
+ }
+}(0, 'a', true, false, null, undefined, NaN));
+
+assert.sameValue(i, 7, 'Visits all arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/arguments-unmapped-aliasing.js b/js/src/tests/test262/language/statements/for-of/arguments-unmapped-aliasing.js
new file mode 100644
index 0000000000..bb4aefac27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/arguments-unmapped-aliasing.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: >
+ Unmapped arguments object mutation via alias during traversal using for..of
+info: |
+ "Unmapped" arguments objects should be able to be traversed using a
+ `for..of` loop, and dynamic changes to the formal parameters should not be
+ reflected in the iterated values.
+flags: [noStrict]
+---*/
+
+var expected = [1, 2, 3];
+var i = 0;
+
+(function(a, b, c) {
+ 'use strict';
+ for (var value of arguments) {
+ a = b;
+ b = c;
+ c = i;
+ assert.sameValue(value, expected[i], 'argument at index ' + i);
+ i++;
+ }
+
+}(1, 2, 3));
+
+assert.sameValue(i, 3, 'Visits all arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/arguments-unmapped-mutation.js b/js/src/tests/test262/language/statements/for-of/arguments-unmapped-mutation.js
new file mode 100644
index 0000000000..a3feb3ea63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/arguments-unmapped-mutation.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Unmapped arguments object mutation during traversal using for..of
+info: |
+ "Unmapped" arguments objects should be able to be traversed using a
+ `for..of` loop, and dynamic changes to their contents should be reflected
+ in the iterated values.
+flags: [noStrict]
+---*/
+
+var expected = [1, 4, 6];
+var i = 0;
+
+(function() {
+ 'use strict';
+ for (var value of arguments) {
+ assert.sameValue(value, expected[i], 'argument at index ' + i);
+ i++;
+ arguments[i] *= 2;
+ }
+}(1, 2, 3));
+
+assert.sameValue(i, 3, 'Visits all arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/arguments-unmapped.js b/js/src/tests/test262/language/statements/for-of/arguments-unmapped.js
new file mode 100644
index 0000000000..e1a68abad3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/arguments-unmapped.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Unmapped arguments object traversal using for..of
+info: |
+ "Umapped" arguments objects should be able to be traversed using a
+ `for..of` loop.
+flags: [noStrict]
+---*/
+
+var i = 0;
+
+(function() {
+ 'use strict';
+ for (var value of arguments) {
+ assert.sameValue(value, arguments[i], 'argument at index ' + i);
+ i++;
+ }
+}(0, 'a', true, false, null, undefined, NaN));
+
+assert.sameValue(i, 7, 'Visits all arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/array-contract-expand.js b/js/src/tests/test262/language/statements/for-of/array-contract-expand.js
new file mode 100644
index 0000000000..1a4c55e5a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/array-contract-expand.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Array entry removal and re-insertion during traversal using for..of
+info: |
+ Entries removed from an Array instance during traversal should be visited
+ if they are re-inserted prior to iterator exhaustion.
+es6id: 13.6.4
+---*/
+
+var array = [0, 1];
+var iterationCount = 0;
+
+var first = 0;
+var second = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = null;
+
+ if (first !== null) {
+ array.pop();
+ array.push(1);
+ }
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/array-contract.js b/js/src/tests/test262/language/statements/for-of/array-contract.js
new file mode 100644
index 0000000000..e8e7a5fc56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/array-contract.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Array entry removal during traversal using for..of
+info: |
+ Entries removed from an Array instance during traversal should not be
+ visited.
+es6id: 13.6.4
+---*/
+
+var array = [0, 1];
+var iterationCount = 0;
+
+for (var x of array) {
+ assert.sameValue(x, 0);
+ array.pop();
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/array-expand-contract.js b/js/src/tests/test262/language/statements/for-of/array-expand-contract.js
new file mode 100644
index 0000000000..d4ae45a8eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/array-expand-contract.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Array entry insertion and removal items during traversal using for..of
+info: |
+ New entries inserted into an Array instance during traversal should not be
+ visited if they are removed prior to visitation.
+es6id: 13.6.4
+---*/
+
+var array = [0];
+var iterationCount = 0;
+
+for (var x of array) {
+ assert.sameValue(x, 0);
+
+ array.push(1);
+ array.pop();
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/array-expand.js b/js/src/tests/test262/language/statements/for-of/array-expand.js
new file mode 100644
index 0000000000..2a80716fca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/array-expand.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Array entry insertion during traversal using for..of
+info: |
+ New entries inserted into an Array instance during traversal should be
+ visited.
+es6id: 13.6.4
+---*/
+
+var array = [0];
+var iterationCount = 0;
+
+var first = 0;
+var second = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = null;
+
+ if (first !== null) {
+ array.push(1);
+ }
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/array-key-get-error.js b/js/src/tests/test262/language/statements/for-of/array-key-get-error.js
new file mode 100644
index 0000000000..aef1e6a3cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/array-key-get-error.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Error in Array entry access during traversal using for..of
+info: |
+ If retrieving an element from the array produces an error, that error
+ should be forwarded to the run time.
+es6id: 13.6.4
+---*/
+
+var array = [];
+var iterationCount = 0;
+
+Object.defineProperty(array, '0', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (var value of array) {
+ iterationCount += 1;
+ }
+});
+
+assert.sameValue(iterationCount, 0, 'The loop body is not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/array.js b/js/src/tests/test262/language/statements/for-of/array.js
new file mode 100644
index 0000000000..51d7bda74e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/array.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ Array instances should be able to be traversed using a `for...of` loop.
+ es6id: 13.6.4
+---*/
+
+var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
+var i = 0;
+
+for (var value of array) {
+ assert.sameValue(value, array[i], 'element at index ' + i);
+ i++;
+}
+
+assert.sameValue(i, 8, 'Visits all elements');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/body-dstr-assign-error.js b/js/src/tests/test262/language/statements/for-of/body-dstr-assign-error.js
new file mode 100644
index 0000000000..f9a4dfd242
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/body-dstr-assign-error.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-forin-div-ofheadevaluation-tdznames-expr-iterationkind
+description: >
+ If the left-hand side requires a DestructuringAssignment operation and that
+ operation produces an error, the iterator should be closed and the error
+ forwarded to the runtime.
+info: |
+ ...
+ Else,
+ If lhsKind is assignment, then
+ Let status be the result of performing DestructuringAssignmentEvaluation of
+ assignmentPattern using nextValue as the argument.
+ ...
+ If status is an abrupt completion, then
+ Set the running execution context's LexicalEnvironment to oldEnv.
+ If iterationKind is enumerate, then
+ Return status.
+
+features: [destructuring-assignment, for-of, Symbol.iterator]
+---*/
+
+var callCount = 0;
+var iterationCount = 0;
+var iterable = {};
+var x = {
+ set attr(_) {
+ throw new Test262Error();
+ }
+};
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: [0] };
+ },
+ return: function() {
+ callCount += 1;
+ }
+ }
+};
+
+assert.throws(Test262Error, function() {
+ for ([x.attr] of iterable) {
+ iterationCount += 1;
+ }
+});
+
+assert.sameValue(iterationCount, 0, 'The loop body is not evaluated');
+assert.sameValue(callCount, 1, 'Iterator is closed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/body-dstr-assign.js b/js/src/tests/test262/language/statements/for-of/body-dstr-assign.js
new file mode 100644
index 0000000000..d720979a4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/body-dstr-assign.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset
+description: >
+ The left-hand side may take the form of a DestructuringAssignment.
+info: |
+ ...
+ Else,
+ If lhsKind is assignment, then
+ Let status be the result of performing DestructuringAssignmentEvaluation of
+ assignmentPattern using nextValue as the argument.
+
+features: [destructuring-assignment, for-of]
+---*/
+
+var iterationCount = 0;
+var x;
+
+for ([x] of [[0]]) {
+ assert.sameValue(x, 0);
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/body-put-error.js b/js/src/tests/test262/language/statements/for-of/body-put-error.js
new file mode 100644
index 0000000000..9cd32665fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/body-put-error.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset
+description: >
+ If the left-hand side is not a lexical binding and the assignment produces
+ an error, the iterator should be closed and the error forwarded to the
+ runtime.
+info: |
+ ...
+ If destructuring is false, then
+ If lhsRef is an abrupt completion, then
+ Let status be lhsRef.
+ Else if lhsKind is lexicalBinding, then
+ Let status be InitializeReferencedBinding(lhsRef, nextValue).
+ Else,
+ Let status be PutValue(lhsRef, nextValue).
+ ...
+
+features: [for-of, Symbol.iterator]
+---*/
+
+var callCount = 0;
+var iterationCount = 0;
+var iterable = {};
+var x = {
+ set attr(_) {
+ throw new Test262Error();
+ }
+};
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: 0 };
+ },
+ return: function() {
+ callCount += 1;
+ }
+ }
+};
+
+assert.throws(Test262Error, function() {
+ for (x.attr of iterable) {
+ iterationCount += 1;
+ }
+});
+
+assert.sameValue(iterationCount, 0, 'The loop body is not evaluated');
+assert.sameValue(callCount, 1, 'Iterator is closed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/break-from-catch.js b/js/src/tests/test262/language/statements/for-of/break-from-catch.js
new file mode 100644
index 0000000000..8c0bc856c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/break-from-catch.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `break` statements within
+ the `catch` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+for (var x of iterator) {
+
+ try {
+ throw new Error();
+ } catch (err) {
+ i++;
+ break;
+ throw new Test262Error('This code is unreachable (following `break` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/break-from-finally.js b/js/src/tests/test262/language/statements/for-of/break-from-finally.js
new file mode 100644
index 0000000000..cb4b6ce6d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/break-from-finally.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `break` statements within
+ `finally` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+for (var x of iterator) {
+ try {
+ } finally {
+ i++;
+ break;
+
+ throw new Test262Error('This code is unreachable (following `break` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/break-from-try.js b/js/src/tests/test262/language/statements/for-of/break-from-try.js
new file mode 100644
index 0000000000..8d965d2a77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/break-from-try.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `break` statements within
+ `try` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+for (var x of iterator) {
+ try {
+ i++;
+ break;
+
+ throw new Test262Error('This code is unreachable (following `break` statement).');
+ } catch (err) {}
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/break-label-from-catch.js b/js/src/tests/test262/language/statements/for-of/break-label-from-catch.js
new file mode 100644
index 0000000000..58a51aa76c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/break-label-from-catch.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `break` statements within
+ `try` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+outer:
+while (true) {
+ for (var x of iterator) {
+ try {
+ throw new Error();
+ } catch (err) {
+ i++;
+ break outer;
+ throw new Test262Error('This code is unreachable (following `break` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..of` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/break-label-from-finally.js b/js/src/tests/test262/language/statements/for-of/break-label-from-finally.js
new file mode 100644
index 0000000000..dc7b2a8ac6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/break-label-from-finally.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `break` statements within
+ `try` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+outer:
+while (true) {
+ for (var x of iterator) {
+ try {
+ } finally {
+ i++;
+ break outer;
+ throw new Test262Error('This code is unreachable (following `break` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..of` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/break-label-from-try.js b/js/src/tests/test262/language/statements/for-of/break-label-from-try.js
new file mode 100644
index 0000000000..3770198653
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/break-label-from-try.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `break` statements within
+ `try` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+outer:
+while (true) {
+ for (var x of iterator) {
+ try {
+ i++;
+ break outer;
+ throw new Test262Error('This code is unreachable (following `break` statement).');
+ } catch (err) {}
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..of` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/break-label.js b/js/src/tests/test262/language/statements/for-of/break-label.js
new file mode 100644
index 0000000000..365f1ac1a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/break-label.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor labeled `break`
+ statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+outer:
+while (true) {
+ for (var x of iterator) {
+ i++;
+ break outer;
+
+ throw new Test262Error('This code is unreachable (following `break` statement).');
+ }
+ throw new Test262Error('This code is unreachable (following `for..of` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/break.js b/js/src/tests/test262/language/statements/for-of/break.js
new file mode 100644
index 0000000000..f2afcf1c3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/break.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `break` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+for (var x of iterator) {
+ i++;
+ break;
+
+ throw new Test262Error('This code is unreachable.');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/browser.js b/js/src/tests/test262/language/statements/for-of/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/browser.js
diff --git a/js/src/tests/test262/language/statements/for-of/continue-from-catch.js b/js/src/tests/test262/language/statements/for-of/continue-from-catch.js
new file mode 100644
index 0000000000..a7f3d8f054
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/continue-from-catch.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `continue` statements
+ within the `catch` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var iterator = values();
+var i = 0;
+
+for (var x of iterator) {
+ try {
+ throw new Error();
+ } catch (err) {
+ i++;
+ continue;
+
+ throw new Test262Error('This code is unreachable (following `continue` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+}
+
+assert.sameValue(i, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/continue-from-finally.js b/js/src/tests/test262/language/statements/for-of/continue-from-finally.js
new file mode 100644
index 0000000000..1972c7a8f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/continue-from-finally.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `continue` statements
+ within the `finally` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var iterator = values();
+var i = 0;
+
+for (var x of iterator) {
+ try {
+ throw new Error();
+ } catch (err) {
+ } finally {
+ i++;
+ continue;
+
+ throw new Test262Error('This code is unreachable (following `continue` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+}
+
+assert.sameValue(i, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/continue-from-try.js b/js/src/tests/test262/language/statements/for-of/continue-from-try.js
new file mode 100644
index 0000000000..fc01a44f26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/continue-from-try.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `continue` statements
+ within `try` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var iterator = values();
+var i = 0;
+
+for (var x of iterator) {
+ try {
+ i++;
+ continue;
+
+ throw new Test262Error('This code is unreachable (following `continue` statement).');
+ } catch (err) {}
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+}
+
+assert.sameValue(i, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/continue-label-from-catch.js b/js/src/tests/test262/language/statements/for-of/continue-label-from-catch.js
new file mode 100644
index 0000000000..1af2ed4deb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/continue-label-from-catch.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `continue` statements
+ within the `catch` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var iterator = values();
+var loop = true;
+var i = 0;
+
+outer:
+while (loop) {
+ loop = false;
+
+ for (var x of iterator) {
+ try {
+ throw new Error();
+ } catch (err) {
+ i++;
+ continue outer;
+ throw new Test262Error('This code is unreachable (following `continue` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..of` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/continue-label-from-finally.js b/js/src/tests/test262/language/statements/for-of/continue-label-from-finally.js
new file mode 100644
index 0000000000..6924e231cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/continue-label-from-finally.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `continue` statements
+ within the `finally` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var iterator = values();
+var loop = true;
+var i = 0;
+
+outer:
+while (loop) {
+ loop = false;
+
+ for (var x of iterator) {
+ try {
+ throw new Error();
+ } catch (err) {
+ } finally {
+ i++;
+ continue outer;
+
+ throw new Test262Error('This code is unreachable (following `continue` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..of` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/continue-label-from-try.js b/js/src/tests/test262/language/statements/for-of/continue-label-from-try.js
new file mode 100644
index 0000000000..c6e546c8d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/continue-label-from-try.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `continue` statements
+ within `try` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var iterator = values();
+var loop = true;
+var i = 0;
+
+outer:
+while (loop) {
+ loop = false;
+ for (var x of iterator) {
+ try {
+ i++;
+ continue outer;
+ throw new Test262Error('This code is unreachable (following `continue` statement).');
+ } catch (err) {}
+
+ throw new Test262Error('This code is unreachable (following `try` statment).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..of` statement).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/continue-label.js b/js/src/tests/test262/language/statements/for-of/continue-label.js
new file mode 100644
index 0000000000..ed8a7af3bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/continue-label.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor labeled `continue`
+ statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+}
+var iterator = values();
+var i = 0;
+var loop = true;
+
+outer:
+while (loop) {
+ loop = false;
+
+ for (var x of iterator) {
+ i++;
+ continue outer;
+
+ throw new Test262Error('This code is unreachable (inside for-of).');
+ }
+ throw new Test262Error('This code is unreachable (inside while).');
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/continue.js b/js/src/tests/test262/language/statements/for-of/continue.js
new file mode 100644
index 0000000000..0ded50884c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/continue.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.n
+description: >
+ Control flow during body evaluation should honor `continue` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var iterator = values();
+var i = 0;
+
+for (var x of iterator) {
+ i++;
+ continue;
+
+ throw new Test262Error('This code is unreachable.');
+}
+
+assert.sameValue(i, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/cptn-decl-abrupt-empty.js b/js/src/tests/test262/language/statements/for-of/cptn-decl-abrupt-empty.js
new file mode 100644
index 0000000000..766dade109
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/cptn-decl-abrupt-empty.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has a declaration and iteration is cancelled
+info: |
+ IterationStatement : for ( var ForBinding of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ForIn/OfHeadEvaluation( « »,
+ AssignmentExpression, iterate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+ [...]
+ k. Let result be the result of evaluating stmt.
+ [...]
+ m. If LoopContinues(result, labelSet) is false, return
+ IteratorClose(iterator, UpdateEmpty(result, V)).
+---*/
+
+assert.sameValue(eval('1; for (var a of [0]) { break; }'), undefined);
+assert.sameValue(eval('2; for (var b of [0]) { 3; break; }'), 3);
+
+assert.sameValue(
+ eval('4; outer: do { for (var a of [0]) { continue outer; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; outer: do { for (var b of [0]) { 6; continue outer; } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/cptn-decl-itr.js b/js/src/tests/test262/language/statements/for-of/cptn-decl-itr.js
new file mode 100644
index 0000000000..4b856e30e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/cptn-decl-itr.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has a declaration and iteration occurs
+info: |
+ IterationStatement : for ( var ForBinding of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ForIn/OfHeadEvaluation( « »,
+ AssignmentExpression, iterate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+ [...]
+ k. Let result be the result of evaluating stmt.
+ [...]
+ n. If result.[[value]] is not empty, let V be result.[[value]].
+---*/
+
+assert.sameValue(eval('1; for (var a of [0]) { }'), undefined);
+assert.sameValue(eval('2; for (var b of [0]) { 3; }'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/cptn-decl-no-itr.js b/js/src/tests/test262/language/statements/for-of/cptn-decl-no-itr.js
new file mode 100644
index 0000000000..ce739a4baf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/cptn-decl-no-itr.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has a declaration and no iteration occurs
+info: |
+ IterationStatement : for ( var ForBinding of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ForIn/OfHeadEvaluation( « »,
+ AssignmentExpression, iterate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+---*/
+
+
+assert.sameValue(eval('1; for (var a of []) { }'), undefined);
+assert.sameValue(eval('2; for (var b of []) { 3; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/cptn-expr-abrupt-empty.js b/js/src/tests/test262/language/statements/for-of/cptn-expr-abrupt-empty.js
new file mode 100644
index 0000000000..edbded5824
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/cptn-expr-abrupt-empty.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has no declaration and iteration is cancelled
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ForIn/OfHeadEvaluation( « »,
+ AssignmentExpression, iterate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+ [...]
+ k. Let result be the result of evaluating stmt.
+ [...]
+ m. If LoopContinues(result, labelSet) is false, return
+ IteratorClose(iterator, UpdateEmpty(result, V)).
+---*/
+
+assert.sameValue(eval('var a; 1; for (a of [0]) { break; }'), undefined);
+assert.sameValue(eval('var b; 2; for (b of [0]) { 3; break; }'), 3);
+
+assert.sameValue(
+ eval('var a; 4; outer: do { for (a of [0]) { continue outer; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('var b; 5; outer: do { for (b of [0]) { 6; continue outer; } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/cptn-expr-itr.js b/js/src/tests/test262/language/statements/for-of/cptn-expr-itr.js
new file mode 100644
index 0000000000..be34657871
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/cptn-expr-itr.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has no declaration and iteration occurs
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ForIn/OfHeadEvaluation( « »,
+ AssignmentExpression, iterate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+ [...]
+ k. Let result be the result of evaluating stmt.
+ [...]
+ n. If result.[[value]] is not empty, let V be result.[[value]].
+---*/
+
+assert.sameValue(eval('var a; 1; for (a of [0]) { }'), undefined);
+assert.sameValue(eval('var b; 2; for (b of [0]) { 3; }'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/cptn-expr-no-itr.js b/js/src/tests/test262/language/statements/for-of/cptn-expr-no-itr.js
new file mode 100644
index 0000000000..09e01617ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/cptn-expr-no-itr.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.5.11
+description: >
+ Completion value when head has no declaration and no iteration occurs
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ForIn/OfHeadEvaluation( « »,
+ AssignmentExpression, iterate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 2. Let V = undefined.
+ [...]
+ 5. Repeat
+ a. Let nextResult be IteratorStep(iterator).
+ b. ReturnIfAbrupt(nextResult).
+ c. If nextResult is false, return NormalCompletion(V).
+---*/
+
+
+assert.sameValue(eval('var a; 1; for (a of []) { }'), undefined);
+assert.sameValue(eval('var b; 2; for (b of []) { 3; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/decl-async-fun.js b/js/src/tests/test262/language/statements/for-of/decl-async-fun.js
new file mode 100644
index 0000000000..1707055e73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/decl-async-fun.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of []) async function f() {}
diff --git a/js/src/tests/test262/language/statements/for-of/decl-async-gen.js b/js/src/tests/test262/language/statements/for-of/decl-async-gen.js
new file mode 100644
index 0000000000..b2f1effe6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/decl-async-gen.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of []) async function* g() {}
diff --git a/js/src/tests/test262/language/statements/for-of/decl-cls.js b/js/src/tests/test262/language/statements/for-of/decl-cls.js
new file mode 100644
index 0000000000..ced8622834
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/decl-cls.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of []) class C {}
diff --git a/js/src/tests/test262/language/statements/for-of/decl-const.js b/js/src/tests/test262/language/statements/for-of/decl-const.js
new file mode 100644
index 0000000000..9deec2acab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/decl-const.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of []) const y = null;
diff --git a/js/src/tests/test262/language/statements/for-of/decl-fun.js b/js/src/tests/test262/language/statements/for-of/decl-fun.js
new file mode 100644
index 0000000000..d979f255ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/decl-fun.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Function declaration not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of []) function f() {}
diff --git a/js/src/tests/test262/language/statements/for-of/decl-gen.js b/js/src/tests/test262/language/statements/for-of/decl-gen.js
new file mode 100644
index 0000000000..a3e7652526
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/decl-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of []) function* g() {}
diff --git a/js/src/tests/test262/language/statements/for-of/decl-let.js b/js/src/tests/test262/language/statements/for-of/decl-let.js
new file mode 100644
index 0000000000..f07110f886
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/decl-let.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of []) let y;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-assignment.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-assignment.js
new file mode 100644
index 0000000000..20143823c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-assignment.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-assignment.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var v2, vNull, vHole, vUndefined, vOob;
+
+var counter = 0;
+
+for ([v2 = 10, vNull = 11, vHole = 12, vUndefined = 13, vOob = 14] of [[2, null, , undefined]]) {
+ assert.sameValue(v2, 2);
+ assert.sameValue(vNull, null);
+ assert.sameValue(vHole, 12);
+ assert.sameValue(vUndefined, 13);
+ assert.sameValue(vOob, 14);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-evaluation.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-evaluation.js
new file mode 100644
index 0000000000..bbccdbc9c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-evaluation.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-evaluation.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The Initializer should only be evaluated if v is undefined. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var flag1 = false, flag2 = false;
+var _;
+
+var counter = 0;
+
+for ([ _ = flag1 = true, _ = flag2 = true ] of [[14]]) {
+ assert.sameValue(flag1, false);
+ assert.sameValue(flag2, true);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-arrow.js
new file mode 100644
index 0000000000..8be5d38d3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-arrow.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-fn-name-arrow.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (ArrowFunction) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(v, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(v,
+ GetReferencedName(lref)).
+
+---*/
+var arrow;
+
+var counter = 0;
+
+for ([ arrow = () => {} ] of [[]]) {
+ verifyProperty(arrow, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'arrow'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-class.js
new file mode 100644
index 0000000000..8defd41fb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-class.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-fn-name-class.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (ClassExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(v, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(v,
+ GetReferencedName(lref)).
+
+---*/
+var xCls, cls, xCls2;
+
+var counter = 0;
+
+for ([ xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } ] of [[]]) {
+ assert(xCls.name !== 'xCls');
+ assert(xCls2.name !== 'xCls2');
+
+ verifyProperty(cls, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cls'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-cover.js
new file mode 100644
index 0000000000..3da40d6f12
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-cover.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-fn-name-cover.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (CoverParenthesizedExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(v, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(v,
+ GetReferencedName(lref)).
+
+---*/
+var xCover, cover;
+
+var counter = 0;
+
+for ([ xCover = (0, function() {}), cover = (function() {}) ] of [[]]) {
+ assert(xCover.name !== 'xCover');
+
+ verifyProperty(cover, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cover'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-fn.js
new file mode 100644
index 0000000000..803fc9cad4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-fn.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-fn-name-fn.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (FunctionExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(v, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(v,
+ GetReferencedName(lref)).
+
+---*/
+var xFn, fn;
+
+var counter = 0;
+
+for ([ xFn = function x() {}, fn = function() {} ] of [[]]) {
+ assert(xFn.name !== 'xFn');
+
+ verifyProperty(fn, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'fn'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-gen.js
new file mode 100644
index 0000000000..dba9a58abb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-fn-name-gen.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-fn-name-gen.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (GeneratorExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and value is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(v, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(v,
+ GetReferencedName(lref)).
+
+---*/
+var xGen, gen;
+
+var counter = 0;
+
+for ([ xGen = function* x() {}, gen = function*() {} ] of [[]]) {
+ assert.notSameValue(xGen.name, 'xGen');
+
+ verifyProperty(gen, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'gen'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-in.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-in.js
new file mode 100644
index 0000000000..e96d24918c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-in.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-in.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The Initializer in an AssignmentElement may be an `in` expression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ([ x = 'x' in {} ] of [[]]) {
+ assert.sameValue(x, false);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-let.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-let.js
new file mode 100644
index 0000000000..b0a3900788
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-let.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-let.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Value retrieval of Initializer obeys `let` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [let, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ([ x = y ] of [[]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+let y;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-order.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-order.js
new file mode 100644
index 0000000000..44df138ffb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-order.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-order.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Initializer values should be assigned in left-to-right order. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = 0;
+var a, b;
+
+var counter = 0;
+
+for ([ a = x += 1, b = x *= 2 ] of [[]]) {
+ assert.sameValue(a, 1);
+ assert.sameValue(b, 2);
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-simple-no-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-simple-no-strict.js
new file mode 100644
index 0000000000..0d27234e42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-simple-no-strict.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-simple-no-strict.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var argument, eval;
+
+var counter = 0;
+
+for ([arguments = 4, eval = 5] of [[]]) {
+ assert.sameValue(arguments, 4);
+ assert.sameValue(eval, 5);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-expr.js
new file mode 100644
index 0000000000..986b32c2a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-expr.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement within a generator function body, it behaves as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var value = [];
+var iterationResult, iter, x;
+iter = (function*() {
+
+var counter = 0;
+
+for ([ x = yield ] of [[]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+})();
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x, undefined);
+
+iterationResult = iter.next(86);
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x, 86);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..7cb9b2a429
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([ x = yield ] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-ident-valid.js
new file mode 100644
index 0000000000..8d12e33155
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-init-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-init-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 4;
+var x;
+
+var counter = 0;
+
+for ([ x = yield ] of [[]]) {
+ assert.sameValue(x, 4);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-get-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-get-err.js
new file mode 100644
index 0000000000..a3d0803fe6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-get-err.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-get-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from GetIterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+var _;
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ _ ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-err.js
new file mode 100644
index 0000000000..77e23d0684
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-nrml-close-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from IteratorClose (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, result).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var _;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ throw new Test262Error();
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ _ ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-null.js
new file mode 100644
index 0000000000..6cd47504a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-null.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-nrml-close-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 6. Return result.
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+ 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
+ exception.
+
+---*/
+var _;
+var iterable = {};
+var nextCount = 0;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ return null;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([ _ ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-skip.js
new file mode 100644
index 0000000000..d6f1d8eb3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close-skip.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-nrml-close-skip.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is not called when assignment evaluation has exhausted the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, result).
+ 6. Return result.
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var _;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ return {};
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ _ ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close.js
new file mode 100644
index 0000000000..66cd1fa186
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-nrml-close.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-nrml-close.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is called when assignment evaluation has not exhausted the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 6. Return result.
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var thisValue = null;
+var args = null;
+var _;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ _ ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close-err.js
new file mode 100644
index 0000000000..2f057606e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close-err.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-rtrn-close-err.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is called when reference evaluation produces a "return" completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 6. Return result.
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var returnCount = 0;
+var unreachable = 0;
+var iterable = {};
+var iterator = {
+ return: function() {
+ returnCount += 1;
+ throw new Test262Error();
+ }
+};
+var iter;
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([ {}[ yield ] ] of [iterable]) {
+ unreachable += 1;
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+iter = g();
+iter.next();
+assert.throws(Test262Error, function() {
+ iter.return();
+});
+
+assert.sameValue(returnCount, 1);
+assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close-null.js
new file mode 100644
index 0000000000..f3fa8bfba7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close-null.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-rtrn-close-null.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 6. Return result.
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+ 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
+ exception.
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var unreachable = 0;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return {done: false, value: undefined};
+ },
+ return: function() {
+ returnCount += 1;
+ return null;
+ }
+};
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+function* g() {
+
+var counter = 0;
+
+for ([ {} = yield ] of [iterable]) {
+ unreachable += 1;
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+var iter = g();
+iter.next();
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+assert.throws(TypeError, function() {
+ iter.return();
+});
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close.js
new file mode 100644
index 0000000000..1ba48978a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-rtrn-close.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-rtrn-close.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is called when reference evaluation produces a "return" completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 6. Return result.
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var unreachable = 0;
+var thisValue = null;
+var args = null;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return {done: false, value: undefined};
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([ {} = yield ] of [iterable]) {
+ unreachable += 1;
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+var iter = g();
+iter.next();
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+var result = iter.return(777);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
+assert.sameValue(result.value, 777);
+assert(result.done, 'Iterator correctly closed');
+assert.sameValue(thisValue, iterator, 'correct `this` value');
+assert(!!args, 'arguments object provided');
+assert.sameValue(args.length, 0, 'zero arguments specified');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close-err.js
new file mode 100644
index 0000000000..7b6fffcc4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close-err.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-thrw-close-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is called when reference evaluation produces a "throw" completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 6. Return result.
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+function ReturnError() {}
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+
+ // This value should be discarded.
+ throw new ReturnError();
+ }
+};
+var thrower = function() {
+ throw new Test262Error();
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ {}[thrower()] ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 0);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close-skip.js
new file mode 100644
index 0000000000..992ab88a44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close-skip.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-thrw-close-skip.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is not called when iteration produces an abrupt completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 6. Return result.
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ throw new Test262Error();
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+var _;
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ x ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close.js
new file mode 100644
index 0000000000..807c4cdb81
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-iter-thrw-close.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-iter-thrw-close.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is called when reference evaluation produces a "throw" completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 6. Return result.
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ }
+};
+var thrower = function() {
+ throw new Test262Error();
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ {}[thrower()] ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 0);
+assert.sameValue(returnCount, 1);
+assert.sameValue(thisValue, iterator, 'correct `this` value');
+assert(!!args, 'arguments object provided');
+assert.sameValue(args.length, 0, 'zero arguments specified');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-invalid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-invalid.js
new file mode 100644
index 0000000000..8a5fc098ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([[(x, y)]] of [[[]]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-null.js
new file mode 100644
index 0000000000..2b675653cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-null.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is `null`, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var _;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([[ _ ]] of [[null]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined-hole.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined-hole.js
new file mode 100644
index 0000000000..a204f6a461
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined-hole.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-undefined-hole.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is a "hole", a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var _;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([[ _ ]] of [[ , ]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined-own.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined-own.js
new file mode 100644
index 0000000000..e63ba1a3d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined-own.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-undefined-own.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is `undefined`, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var _;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([[ x ]] of [[undefined]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined.js
new file mode 100644
index 0000000000..d8d5ffcb87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-undefined.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-undefined.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and no value is defined, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var _;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([[ x ]] of [[]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-expr.js
new file mode 100644
index 0000000000..138133f07d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-expr.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and within a generator function body, it behaves as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var value = [[22]];
+var x = {};
+var iterationResult, iter;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ([[x[yield]]] of [value]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x.prop, undefined);
+
+iterationResult = iter.next('prop');
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x.prop, 22);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..d4a52b24fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([[x[yield]]] of [[[]]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-ident-valid.js
new file mode 100644
index 0000000000..145115147f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 'prop';
+var x = {};
+
+var counter = 0;
+
+for ([[x[yield]]] of [[[22]]]) {
+ assert.sameValue(x.prop, 22);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array.js
new file mode 100644
index 0000000000..5a3dd3d619
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-array.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-array.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ([[x]] of [[[1]]]) {
+ assert.sameValue(x, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..7c69c77bbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js
@@ -0,0 +1,66 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-memberexpr-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (MemberExpression OptionalChain .IdentifierName Initializer) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+var x = {};
+
+for ([x?.y = 42] of [[23]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-invalid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-invalid.js
new file mode 100644
index 0000000000..6d366da8d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([{ get x() {} }] of [[{}]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-null.js
new file mode 100644
index 0000000000..b6864a4638
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-null.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is `null`, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([{ x }] of [[null]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined-hole.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined-hole.js
new file mode 100644
index 0000000000..a521cbca92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined-hole.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-undefined-hole.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is a "hole", a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([{ x }] of [[ , ]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined-own.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined-own.js
new file mode 100644
index 0000000000..552d0751e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined-own.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-undefined-own.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is `undefined`, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([{ x }] of [[undefined]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined.js
new file mode 100644
index 0000000000..b6f0adc559
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-undefined.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-undefined.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and no value is defined, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([{ x }] of [[]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-expr.js
new file mode 100644
index 0000000000..e5a2a41058
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-expr.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it behaves as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var iterationResult, iter, x;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ([{ x = yield }] of [[{}]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x, undefined);
+
+iterationResult = iter.next(4);
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..a7a49a4947
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment outside of a generator function body, it behaves as a IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([{ x = yield }] of [[{}]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-ident-valid.js
new file mode 100644
index 0000000000..c3935a3ac5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment outside of a generator function body, it behaves as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 2;
+var x;
+
+var counter = 0;
+
+for ([{ x = yield }] of [[{}]]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj.js
new file mode 100644
index 0000000000..d4c064fbd2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-nested-obj.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-nested-obj.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ([{ x }] of [[{ x: 2 }]]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-const.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-const.js
new file mode 100644
index 0000000000..eb90ecce08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-const.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-const.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: The assignment target should obey `const` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [const, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+const c = null;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([ c ] of [[1]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-let.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-let.js
new file mode 100644
index 0000000000..1347eb8ec2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-let.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-let.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: The assignment target should obey `let` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [let, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ([ x ] of [[]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+let x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..b83831dde1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-obj-literal-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+
+for ([{
+ set y(val) {
+ throw new Test262Error('The property should not be accessed.');
+ }
+}?.y = 42] of [[23]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref-init-active.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref-init-active.js
new file mode 100644
index 0000000000..9f222e6814
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref-init-active.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-obj-literal-prop-ref-init-active.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with activated initializer. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentPattern : ArrayAssignmentPattern
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+ AssignmentElementList : AssignmentElisionElement
+ AssignmentElisionElement : Elision_opt AssignmentElement
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern.
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple.
+
+ Runtime Semantics: DestructuringAssignmentEvaluation
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+ 2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord.
+ 3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result).
+ 4. Return result.
+
+ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
+ AssignmentElement : DestructuringAssignmentTarget Initializer
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ ...
+ 7. Return ? PutValue(lref, v).
+
+---*/
+var x, setValue;
+
+var counter = 0;
+
+for ([{
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+}.y = 42] of [[undefined]]) {
+ assert.sameValue(setValue, 42);
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref-init.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref-init.js
new file mode 100644
index 0000000000..3edd7eb750
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref-init.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-obj-literal-prop-ref-init.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with initializer. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentPattern : ArrayAssignmentPattern
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+ AssignmentElementList : AssignmentElisionElement
+ AssignmentElisionElement : Elision_opt AssignmentElement
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern.
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple.
+
+ Runtime Semantics: DestructuringAssignmentEvaluation
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+ 2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord.
+ 3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result).
+ 4. Return result.
+
+ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
+ AssignmentElement : DestructuringAssignmentTarget Initializer
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ ...
+ 7. Return ? PutValue(lref, v).
+
+---*/
+var x, setValue;
+
+var counter = 0;
+
+for ([{
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+}.y = 42] of [[23]]) {
+ assert.sameValue(setValue, 23);
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref.js
new file mode 100644
index 0000000000..712b25cd02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-obj-literal-prop-ref.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-obj-literal-prop-ref.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentPattern : ArrayAssignmentPattern
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+ AssignmentElementList : AssignmentElisionElement
+ AssignmentElisionElement : Elision_opt AssignmentElement
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern.
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple.
+
+ Runtime Semantics: DestructuringAssignmentEvaluation
+ ArrayAssignmentPattern : [ AssignmentElementList ]
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+ 2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord.
+ 3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result).
+ 4. Return result.
+
+ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
+ AssignmentElement : DestructuringAssignmentTarget Initializer
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ ...
+ 7. Return ? PutValue(lref, v).
+
+---*/
+var x, setValue;
+
+var counter = 0;
+
+for ([{
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+}.y] of [[23]]) {
+ assert.sameValue(setValue, 23);
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref-no-get.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref-no-get.js
new file mode 100644
index 0000000000..b4f82d1792
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref-no-get.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-prop-ref-no-get.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x, setValue;
+x = {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+};
+
+var counter = 0;
+
+for ([x.y] of [[23]]) {
+ assert.sameValue(setValue, 23);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref-user-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref-user-err.js
new file mode 100644
index 0000000000..bca0379d3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref-user-err.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-prop-ref-user-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Any error raised as a result of setting the value should be forwarded to the runtime. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = {
+ set y(val) {
+ throw new Test262Error();
+ }
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([x.y] of [[23]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref.js
new file mode 100644
index 0000000000..fabda343d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-prop-ref.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-prop-ref.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = {};
+
+var counter = 0;
+
+for ([x.y] of [[4]]) {
+ assert.sameValue(x.y, 4);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..76ec86c3a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-unresolvable-no-strict.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-unresolvable-no-strict.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+{
+
+var counter = 0;
+
+for ([ unresolvable ] of [[]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+assert.sameValue(unresolvable, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-unresolvable-strict-strict.js
new file mode 100644
index 0000000000..7a29183272
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-put-unresolvable-strict-strict.js
@@ -0,0 +1,40 @@
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-put-unresolvable-strict.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ([ unresolvable ] of [[]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-identifier.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-identifier.js
new file mode 100644
index 0000000000..dabe6c34d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-identifier.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-target-identifier.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x, y, z;
+
+var counter = 0;
+
+for ([x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-simple-no-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-simple-no-strict.js
new file mode 100644
index 0000000000..e046d2cfb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-simple-no-strict.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-target-simple-no-strict.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var argument, eval;
+
+var counter = 0;
+
+for ([arguments, eval] of [[2, 3]]) {
+ assert.sameValue(arguments, 2);
+ assert.sameValue(eval, 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-simple-strict-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-simple-strict-strict.js
new file mode 100644
index 0000000000..344718e293
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-simple-strict-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-target-simple-strict.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is false. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([arguments] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-expr.js
new file mode 100644
index 0000000000..253ebe13de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-expr.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-target-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement within a generator function body, it behaves as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var value = [33];
+var x = {};
+var iterationResult, iter;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ([ x[yield] ] of [[33]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x.prop, undefined);
+
+iterationResult = iter.next('prop');
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x.prop, 33);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-invalid-strict.js
new file mode 100644
index 0000000000..a39b7cc37a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-target-yield-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it behaves as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([ x[yield] ] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-valid.js
new file mode 100644
index 0000000000..779f769d75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-target-yield-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-target-yield-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 'prop';
+var x = {};
+
+var counter = 0;
+
+for ([ x[yield] ] of [[33]]) {
+ assert.sameValue(x.prop, 33);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-abpt.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-abpt.js
new file mode 100644
index 0000000000..209a650414
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-abpt.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-abpt.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned during evaluation of elision (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 6. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+ i. If iteratorRecord.[[done]] is false, return
+ IteratorClose(iterator, status).
+ ii. Return Completion(status).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+
+ if (nextCount === 2) {
+ throw new Test262Error();
+ }
+
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ x , , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 2);
+assert.sameValue(returnCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-err.js
new file mode 100644
index 0000000000..f43fbcfa38
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-err.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from IteratorClose (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 6. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+ [...]
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ throw new Test262Error();
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ x , , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 2);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-null.js
new file mode 100644
index 0000000000..c55e73a43b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-null.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 6. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+ [...]
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+ 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
+ exception.
+
+---*/
+var iterable = {};
+var x;
+var nextCount = 0;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ return null;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([ x , , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-skip.js
new file mode 100644
index 0000000000..9894c4ce57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close-skip.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close-skip.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose not invoked when elision exhausts the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 6. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+ [...]
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ 9. Return Completion(status).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+
+ return { done: nextCount > 1 };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ x , , ] of [iterable]) {
+ assert.sameValue(nextCount, 2);
+ assert.sameValue(returnCount, 0);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close.js
new file mode 100644
index 0000000000..50f94cba56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-elision-iter-nrml-close.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose invoked when elision does not exhaust the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 6. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+ [...]
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ x , , ] of [iterable]) {
+ assert.sameValue(nextCount, 2);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-get-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-get-err.js
new file mode 100644
index 0000000000..eb9e0a6f16
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-get-err.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-get-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from GetIterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+var x;
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ x , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-err.js
new file mode 100644
index 0000000000..d825c94adf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-err.js
@@ -0,0 +1,76 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from IteratorClose (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var thrower = function() {
+ throw new Test262Error();
+};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ throw new Test262Error();
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ x , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-null.js
new file mode 100644
index 0000000000..2e1ac4dc2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-null.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+ 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
+ exception.
+
+---*/
+var iterable = {};
+var x;
+var nextCount = 0;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ return null;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([ x , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-skip.js
new file mode 100644
index 0000000000..f8b8c96b8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close-skip.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-skip.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is not invoked when evaluation of AssignmentElementList exhausts the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var thrower = function() {
+ throw new Test262Error();
+};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ x , ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close.js
new file mode 100644
index 0000000000..8b279ded51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-nrml-close.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is invoked when evaluation of AssignmentElementList completes without exhausting the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ x , ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close-err.js
new file mode 100644
index 0000000000..02520bfd06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close-err.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-rtrn-close-err.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "return" completion and the iterator has not been marked as "done" (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var unreachable = 0;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return {done: false, value: undefined};
+ },
+ return: function() {
+ returnCount += 1;
+
+ throw new Test262Error();
+ }
+};
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([ {} = yield , ] of [iterable]) {
+ unreachable += 1;
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+var iter = g();
+iter.next();
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+assert.throws(Test262Error, function() {
+ iter.return();
+});
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close-null.js
new file mode 100644
index 0000000000..3ecd873557
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close-null.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-rtrn-close-null.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+ 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
+ exception.
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return {done: false, value: undefined};
+ },
+ return: function() {
+ returnCount += 1;
+ return null;
+ }
+};
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([ {} = yield , ] of [iterable]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+var iter = g();
+iter.next();
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+assert.throws(TypeError, function() {
+ iter.return();
+});
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close.js
new file mode 100644
index 0000000000..09c39d4e3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-rtrn-close.js
@@ -0,0 +1,102 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-rtrn-close.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "return" completion and the iterator has not been marked as "done" (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var unreachable = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return {done: false, value: undefined};
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+var iter, result;
+
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([ {} = yield , ] of [iterable]) {
+ unreachable += 1;
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+};
+
+iter = g();
+iter.next();
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+result = iter.return(888);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
+assert.sameValue(result.value, 888);
+assert(result.done, 'Iterator correctly closed');
+assert.sameValue(thisValue, iterator, 'correct `this` value');
+assert(!!args, 'arguments object provided');
+assert.sameValue(args.length, 0, 'zero arguments specified');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close-err.js
new file mode 100644
index 0000000000..f7932463fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close-err.js
@@ -0,0 +1,84 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-thrw-close-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "throw" completion and the iterator has not been marked as "done" (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 7. If completion.[[type]] is throw, return Completion(completion).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var thrower = function() {
+ throw new Test262Error();
+};
+function ReturnError() {}
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+
+ // This value should be discarded.
+ throw new ReturnError();
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ {}[thrower()] , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+
+assert.sameValue(nextCount, 0);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close-skip.js
new file mode 100644
index 0000000000..6091d997bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close-skip.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-thrw-close-skip.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is not invoked when evaluation of AssignmentElementList returns an abrupt completion and the iterator has been marked as "done" (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var thrower = function() {
+ throw new Test262Error();
+};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ throw new Test262Error();
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+var x;
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ x , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close.js
new file mode 100644
index 0000000000..ee99d2439e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-list-thrw-close.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-list-thrw-close.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "throw" completion and the iterator has not been marked as "done" (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}.
+ 4. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentElementList using
+ iteratorRecord as the argument.
+ 5. If status is an abrupt completion, then
+ a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ b. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var thrower = function() {
+ throw new Test262Error();
+};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ {}[thrower()] , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 0);
+assert.sameValue(returnCount, 1);
+assert.sameValue(thisValue, iterator, 'correct `this` value');
+assert(!!args, 'arguments object provided');
+assert.sameValue(args.length, 0, 'zero arguments specified');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-nrml-close-skip.js
new file mode 100644
index 0000000000..d14e6f9d3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-nrml-close-skip.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-rest-nrml-close-skip.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is not called when rest element evaluation has exhausted the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 7. If AssignmentRestElement is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ 9. Return Completion(status).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var x, y;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { value: nextCount, done: nextCount > 1 };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ x , ...y ] of [iterable]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+assert.sameValue(nextCount, 2, 'nextCount');
+assert.sameValue(returnCount, 0, 'returnCount');
+assert.sameValue(x, 1, 'x');
+assert.sameValue(y.length, 0, 'y.length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close-err.js
new file mode 100644
index 0000000000..ea6f727c9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close-err.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-rest-rtrn-close-err.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is called when AssignmentRestEvaluation produces a "return" completion due to reference evaluation (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 7. If AssignmentRestElement is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ 9. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var unreachable = 0;
+var x;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+
+ throw new Test262Error();
+ }
+};
+var iter;
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+function* g() {
+
+var counter = 0;
+
+for ([ x , ...{}[yield] ] of [iterable]) {
+ unreachable += 1;
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+iter = g();
+iter.next();
+
+assert.throws(Test262Error, function() {
+ iter.return();
+});
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close-null.js
new file mode 100644
index 0000000000..95e723e06b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close-null.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-rest-rtrn-close-null.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 7. If AssignmentRestElement is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ 9. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var nextCount = 0;
+var iterable = {};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ return null;
+ }
+};
+var iter;
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([ x , ...{}[yield] ] of [iterable]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+iter = g();
+iter.next();
+
+assert.throws(TypeError, function() {
+ iter.return();
+});
+
+assert.sameValue(nextCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close.js
new file mode 100644
index 0000000000..20a278c1ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-rtrn-close.js
@@ -0,0 +1,99 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-rest-rtrn-close.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is called when AssignmentRestEvaluation produces a "return" completion due to reference evaluation (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 7. If AssignmentRestElement is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ 9. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var unreachable = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+var iter, result;
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([ x , ...{}[yield] ] of [iterable]) {
+ unreachable += 1;
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+iter = g();
+iter.next();
+result = iter.return(999);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
+assert.sameValue(result.value, 999);
+assert(result.done, 'Iterator correctly closed');
+assert.sameValue(thisValue, iterator, 'correct `this` value');
+assert(!!args, 'arguments object provided');
+assert.sameValue(args.length, 0, 'zero arguments specified');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close-err.js
new file mode 100644
index 0000000000..7e669658ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-rest-thrw-close-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is called when AssignmentRestEvaluation produces a "throw" completion due to reference evaluation (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 7. If AssignmentRestElement is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ 9. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 7. If completion.[[type]] is throw, return Completion(completion)
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var x;
+function ReturnError() {}
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+
+ // This value should be discarded.
+ throw new ReturnError();
+ }
+};
+var thrower = function() {
+ throw new Test262Error();
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ x , ...{}[thrower()] ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close-skip.js
new file mode 100644
index 0000000000..2b210e7b00
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close-skip.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-rest-thrw-close-skip.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned during iteration for rest element (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 7. If AssignmentRestElement is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ 9. Return Completion(status).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+
+ if (nextCount === 2) {
+ throw new Test262Error();
+ }
+
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ x , ...x ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 2);
+assert.sameValue(returnCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close.js
new file mode 100644
index 0000000000..62a5eea52c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elem-trlg-iter-rest-thrw-close.js
@@ -0,0 +1,89 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elem-trlg-iter-rest-thrw-close.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is called when AssignmentRestEvaluation produces a "throw" completion due to reference evaluation (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern :
+ [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
+
+ [...]
+ 7. If AssignmentRestElement is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement
+ with iteratorRecord as the argument.
+ 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ status).
+ 9. Return Completion(status).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var x;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ }
+};
+var thrower = function() {
+ throw new Test262Error();
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ x , ...{}[thrower()] ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+assert.sameValue(thisValue, iterator, 'correct `this` value');
+assert(!!args, 'arguments object provided');
+assert.sameValue(args.length, 0, 'zero arguments specified');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-abpt.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-abpt.js
new file mode 100644
index 0000000000..ec3c4fdb92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-abpt.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-iter-abpt.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is not called when iteration produces an abrupt completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elision ]
+
+ 1. Let iterator be GetIterator(value).
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ throw new Test262Error();
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-get-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-get-err.js
new file mode 100644
index 0000000000..1c4e3e0c27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-get-err.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-iter-get-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from GetIterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elision ]
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-err.js
new file mode 100644
index 0000000000..10c4ed8604
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-err.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-iter-nrml-close-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from IteratorClose (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elision ]
+
+ 1. Let iterator be GetIterator(value).
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 6. Return result.
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ throw new Test262Error();
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-null.js
new file mode 100644
index 0000000000..80d05752b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-null.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-iter-nrml-close-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elision ]
+
+ 1. Let iterator be GetIterator(value).
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ [...]
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+ 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
+ exception.
+
+---*/
+var iterable = {};
+var nextCount = 0;
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ return null;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([ , ] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-skip.js
new file mode 100644
index 0000000000..aa8d78b8fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close-skip.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-iter-nrml-close-skip.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is not called when iteration has exhausted the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elision ]
+
+ 1. Let iterator be GetIterator(value).
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ return {};
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ , ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close.js
new file mode 100644
index 0000000000..d49c8e3f12
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-iter-nrml-close.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-iter-nrml-close.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is called when assignment evaluation has not exhausted the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elision ]
+
+ 1. Let iterator be GetIterator(value).
+ [...]
+ 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ [...]
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ , ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-array.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-array.js
new file mode 100644
index 0000000000..928f7371b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-array.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-val-array.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+for ([,] of [[]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-bool.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-bool.js
new file mode 100644
index 0000000000..d0ac48f268
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-bool.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-val-bool.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for boolean values. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([,] of [true]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-null.js
new file mode 100644
index 0000000000..cc9f581817
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-null.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-val-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for `null`. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([,] of [null]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-num.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-num.js
new file mode 100644
index 0000000000..67b15faa51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-num.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-val-num.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for number values. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([,] of [1]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-string.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-string.js
new file mode 100644
index 0000000000..7e3eb227cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-string.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-val-string.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+for ([,] of ['string literal']) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-symbol.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-symbol.js
new file mode 100644
index 0000000000..5e108f191e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-symbol.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-val-symbol.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for symbol values. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var s = Symbol();
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([,] of [s]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-undef.js
new file mode 100644
index 0000000000..34f979d148
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-elision-val-undef.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-elision-val-undef.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for `undefined`. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([,] of [undefined]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close-err.js
new file mode 100644
index 0000000000..1de55b5d7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close-err.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-iter-close-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from IteratorClose (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ ]
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+ 3. Return IteratorClose(iterator, NormalCompletion(empty)).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ throw new Test262Error();
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 0);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close-null.js
new file mode 100644
index 0000000000..974e7ee66e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close-null.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-iter-close-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ ]
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+ 3. Return IteratorClose(iterator, NormalCompletion(empty)).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+ 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
+ exception.
+
+---*/
+var iterable = {};
+var iterator = {
+ next: function() {
+ return { done: true };
+ },
+ return: function() {
+ return null;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close.js
new file mode 100644
index 0000000000..cb2179bb78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-close.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-iter-close.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Iterator is closed without iterating (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ ]
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+ 3. Return IteratorClose(iterator, NormalCompletion(empty)).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([] of [iterable]) {
+ assert.sameValue(nextCount, 0);
+ assert.sameValue(returnCount, 1);
+ assert.sameValue(thisValue, iterator, 'correct `this` value');
+ assert(!!args, 'arguments object provided');
+ assert.sameValue(args.length, 0, 'zero arguments specified');
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-get-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-get-err.js
new file mode 100644
index 0000000000..78b769aaff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-iter-get-err.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-iter-get-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from GetIterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ ]
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-array.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-array.js
new file mode 100644
index 0000000000..35c4607eea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-array.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-val-array.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+for ([] of [[]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-bool.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-bool.js
new file mode 100644
index 0000000000..d214286a58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-bool.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-val-bool.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for boolean values (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([] of [true]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-null.js
new file mode 100644
index 0000000000..9b443df948
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-null.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-val-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for `null`. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([] of [null]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-num.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-num.js
new file mode 100644
index 0000000000..810a70201d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-num.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-val-num.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for number values. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([] of [1]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-string.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-string.js
new file mode 100644
index 0000000000..42c37c37b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-string.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-val-string.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+for ([] of ['string literal']) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-symbol.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-symbol.js
new file mode 100644
index 0000000000..10dbd8e691
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-symbol.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-val-symbol.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for Symbol values. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var s = Symbol();
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([] of [s]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-undef.js
new file mode 100644
index 0000000000..21bb4b5eb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-empty-val-undef.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-empty-val-undef.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for `undefined`. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([] of [undefined]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-iteration.js b/js/src/tests/test262/language/statements/for-of/dstr/array-iteration.js
new file mode 100644
index 0000000000..3610f3a338
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-iteration.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-iteration.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Value iteration only proceeds for the number of elements in the ArrayAssignmentPattern. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var count = 0;
+var g = function*() {
+ count += 1;
+ yield;
+ count += 1;
+ yield;
+ count += 1;
+}
+
+var counter = 0;
+
+for ([,,] of [g()]) {
+ assert.sameValue(count, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-after-element.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-after-element.js
new file mode 100644
index 0000000000..479d42ce9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-after-element.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-after-element.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An AssignmentRestElement following an AssignmentElement consumes all remaining iterable values. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x, y;
+
+var counter = 0;
+
+for ([x, ...y] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y.length, 2);
+ assert.sameValue(y[0], 2);
+ assert.sameValue(y[1], 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-after-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-after-elision.js
new file mode 100644
index 0000000000..12d68319a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-after-elision.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-after-elision.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An AssignmentRestElement following an elision consumes all remaining iterable values. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ([, ...x] of [[1, 2, 3]]) {
+ assert.sameValue(x.length, 2);
+ assert.sameValue(x[0], 2);
+ assert.sameValue(x[1], 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-element.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-element.js
new file mode 100644
index 0000000000..4f85f4ed44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-element.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-before-element.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: An AssignmentElement may not follow an AssignmentRestElement in an AssignmentElementList. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...x, y] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-elision.js
new file mode 100644
index 0000000000..6c81944496
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-elision.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-before-elision.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: An elision may not follow an AssignmentRestElement in an AssignmentElementList. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...x,] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-rest.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-rest.js
new file mode 100644
index 0000000000..8898ee2dd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-before-rest.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-before-rest.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: An AssignmentRestElement may not follow another AssignmentRestElement in an AssignmentElementList. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...x, ...y] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision-invalid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision-invalid.js
new file mode 100644
index 0000000000..69122c7ceb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-elision-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: ArrayAssignmentPattern may not include elisions following an AssignmentRestElement in a AssignmentElementList. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...x,] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision-iter-abpt.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision-iter-abpt.js
new file mode 100644
index 0000000000..78b9770c33
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision-iter-abpt.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-elision-iter-abpt.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is not called when assignment evaluation produces an abrupt completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 4. If Elision is present, then
+ a. Let status be the result of performing
+ IteratorDestructuringAssignmentEvaluation of Elision with
+ iteratorRecord as the argument.
+ b. If status is an abrupt completion, then
+ i. If iteratorRecord.[[done]] is false, return
+ IteratorClose(iterator, status).
+ ii. Return Completion(status).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ throw new Test262Error();
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+var x;
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([ , ...x] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision.js
new file mode 100644
index 0000000000..50b9dc4d18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-elision.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-elision.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: ArrayAssignmentPattern may include elisions at any position preceding a AssignmentRestElement in a AssignmentElementList. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x, y;
+
+var counter = 0;
+
+for ([, , x, , ...y] of [[1, 2, 3, 4, 5, 6]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y.length, 2);
+ assert.sameValue(y[0], 5);
+ assert.sameValue(y[1], 6);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-init.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-init.js
new file mode 100644
index 0000000000..f7181ff364
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-init.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-init.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: The AssignmentRestElement does not support an initializer. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+var x;
+
+for ([...x = 1] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-get-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-get-err.js
new file mode 100644
index 0000000000..b566e7b806
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-get-err.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-iter-get-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Abrupt completion returned from GetIterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iterable = {};
+var x;
+iterable[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([...x] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-nrml-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-nrml-close-skip.js
new file mode 100644
index 0000000000..497d477f7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-nrml-close-skip.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-iter-nrml-close-skip.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is not called when assignment evaluation has exhausted the iterator (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+ 7. Return result.
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var x;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([ ...x ] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close-err.js
new file mode 100644
index 0000000000..d35bfcfd0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close-err.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-iter-rtrn-close-err.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is called when reference evaluation produces a "return" completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
+ ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var returnCount = 0;
+var unreachable = 0;
+var iterable = {};
+var iterator = {
+ return: function() {
+ returnCount += 1;
+
+ throw new Test262Error();
+ }
+};
+var iter;
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([...{}[yield]] of [iterable]) {
+ unreachable += 1;
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+iter = g();
+iter.next();
+assert.throws(Test262Error, function() {
+ iter.return();
+});
+
+assert.sameValue(returnCount, 1);
+assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close-null.js
new file mode 100644
index 0000000000..9c6d19e9fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close-null.js
@@ -0,0 +1,88 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-iter-rtrn-close-null.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose throws a TypeError when `return` returns a non-Object value (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
+ ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var iterable = {};
+var iterator = {
+ return: function() {
+ return null;
+ }
+};
+var iter;
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([...{}[yield]] of [iterable]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+iter = g();
+iter.next();
+
+assert.throws(TypeError, function() {
+ iter.return();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close.js
new file mode 100644
index 0000000000..2d37e4bfe2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-rtrn-close.js
@@ -0,0 +1,103 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-iter-rtrn-close.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: IteratorClose is called when reference evaluation produces a "return" completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
+ ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ 7. If completion.[[type]] is throw, return Completion(completion).
+ 8. If innerResult.[[type]] is throw, return Completion(innerResult).
+
+---*/
+var returnCount = 0;
+var unreachable = 0;
+var thisValue = null;
+var args = null;
+var iterable = {};
+var iterator = {
+ next() {
+ throw new Test262Error();
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ return {};
+ }
+};
+var iter, result;
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function* g() {
+
+var counter = 0;
+
+for ([...{}[yield]] of [iterable]) {
+ unreachable += 1;
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+iter = g();
+iter.next();
+result = iter.return(444);
+
+assert.sameValue(returnCount, 1);
+assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
+assert.sameValue(result.value, 444);
+assert(result.done, 'Iterator correctly closed');
+assert.sameValue(thisValue, iterator, 'correct `this` value');
+assert(!!args, 'arguments object provided');
+assert.sameValue(args.length, 0, 'zero arguments specified');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close-err.js
new file mode 100644
index 0000000000..4d8a233e94
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close-err.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-iter-thrw-close-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is called when reference evaluation produces a "throw" completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
+ ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var x;
+function ReturnError() {}
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+
+ // This value should be discarded.
+ throw new ReturnError();
+ }
+};
+var thrower = function() {
+ throw new Test262Error();
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([...{}[thrower()]] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 0);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close-skip.js
new file mode 100644
index 0000000000..b38d26b98d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close-skip.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-iter-thrw-close-skip.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is not called when iteration produces an abrupt completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var x;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ throw new Test262Error();
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([...x] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close.js
new file mode 100644
index 0000000000..8d50a51a9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iter-thrw-close.js
@@ -0,0 +1,93 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-iter-thrw-close.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is called when reference evaluation produces a "throw" completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
+ ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+
+ 7.4.6 IteratorClose( iterator, completion )
+
+ [...]
+ 6. Let innerResult be Call(return, iterator, « »).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var thisValue = null;
+var args = null;
+var x;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ // Set an upper-bound to limit unnecessary iteration in non-conformant
+ // implementations
+ return { done: nextCount > 10 };
+ },
+ return: function() {
+ returnCount += 1;
+ thisValue = this;
+ args = arguments;
+ }
+};
+var thrower = function() {
+ throw new Test262Error();
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([...{}[thrower()]] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 0);
+assert.sameValue(returnCount, 1);
+assert.sameValue(thisValue, iterator, 'correct `this` value');
+assert(!!args, 'arguments object provided');
+assert.sameValue(args.length, 0, 'zero arguments specified');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iteration.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iteration.js
new file mode 100644
index 0000000000..d72db7dfa4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-iteration.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-iteration.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: In the presense of an AssignmentRestElement, value iteration exhausts the iterable value; (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var count = 0;
+var g = function*() {
+ count += 1;
+ yield;
+ count += 1;
+ yield;
+ count += 1;
+}
+var x;
+
+var counter = 0;
+
+for ([...x] of [g()]) {
+ assert.sameValue(count, 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-lref-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-lref-err.js
new file mode 100644
index 0000000000..bbb495da20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-lref-err.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-lref-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is called when reference evaluation produces an abrupt completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
+ ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+var thrower = function() {
+ throw new Test262Error();
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([...{}[thrower()]] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 0);
+assert.sameValue(returnCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-lref.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-lref.js
new file mode 100644
index 0000000000..88c55def71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-lref.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-lref.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Reference is evaluated during assignment (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
+ ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ b. ReturnIfAbrupt(lref).
+ [...]
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+var obj = {};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+for ([...obj['a' + 'b']] of [iterable]) {
+ assert.sameValue(nextCount, 1);
+ assert.sameValue(returnCount, 0);
+ assert(!!obj.ab);
+ assert.sameValue(obj.ab.length, 0);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-invalid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-invalid.js
new file mode 100644
index 0000000000..755d5ddd22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...[(x, y)]] of [[[]]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-iter-thrw-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-iter-thrw-close-skip.js
new file mode 100644
index 0000000000..cbe266ff9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-iter-thrw-close-skip.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-iter-thrw-close-skip.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is not called when nested array pattern evaluation produces an abrupt completion (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ [...]
+ 4. Repeat while iteratorRecord.[[done]] is false
+ [...]
+ d. If next is false, set iteratorRecord.[[done]] to true.
+ [...]
+ 7. Return the result of performing DestructuringAssignmentEvaluation of
+ nestedAssignmentPattern with A as the argument.
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+var thrower = function() {
+ throw new Test262Error();
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([...[...{}[thrower()]]] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-null.js
new file mode 100644
index 0000000000..c19fe03c4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-null.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-null.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable emits `null` as the only value, an array with a single `null` element should be used as the value of the nested DestructuringAssignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x, y;
+
+var counter = 0;
+
+for ([...[x, y]] of [[null]]) {
+ assert.sameValue(x, null);
+ assert.sameValue(y, undefined);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined-hole.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined-hole.js
new file mode 100644
index 0000000000..e54d64285b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined-hole.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-undefined-hole.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable is an array with a "hole", an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+
+var counter = 0;
+
+for ([...[x]] of [[ , ]]) {
+ assert.sameValue(x, undefined);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined-own.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined-own.js
new file mode 100644
index 0000000000..d36db6c846
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined-own.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-undefined-own.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable emits `undefined` as the only value, an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+
+var counter = 0;
+
+for ([...[x]] of [[undefined]]) {
+ assert.sameValue(x, undefined);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined.js
new file mode 100644
index 0000000000..a9db7a0b79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-undefined.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-undefined.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable is emits no values, an empty array should be used as the value of the nested DestructuringAssignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+
+var counter = 0;
+
+for ([...[x]] of [[]]) {
+ assert.sameValue(x, undefined);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-expr.js
new file mode 100644
index 0000000000..ea7b1adfdd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-expr.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var value = [86];
+var x = {};
+var iterationResult, iter;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ([...[x[yield]]] of [[86]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x.prop, undefined);
+
+iterationResult = iter.next('prop');
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x.prop, 86);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..fb2fb1e0d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...[x[yield]]] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-ident-valid.js
new file mode 100644
index 0000000000..47be4f44c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 'prop';
+var x = {};
+
+var counter = 0;
+
+for ([...[x[yield]]] of [[86]]) {
+ assert.sameValue(x.prop, 86);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array.js
new file mode 100644
index 0000000000..348bef9481
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-array.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-array.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ([...[x]] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-invalid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-invalid.js
new file mode 100644
index 0000000000..3368e6ea71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...{ get x() {} }] of [[[]]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-null.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-null.js
new file mode 100644
index 0000000000..c785308214
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-null.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-null.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the iterable emits `null` as the only value, an array with a single `null` element should be used as the value of the nested DestructuringAssignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x, length;
+
+var counter = 0;
+
+for ([...{ 0: x, length }] of [[null]]) {
+ assert.sameValue(x, null);
+ assert.sameValue(length, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined-hole.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined-hole.js
new file mode 100644
index 0000000000..51a4f6a384
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined-hole.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-undefined-hole.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable is an array with a "hole", an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
+// where length and name are properties of WindowProxy
+let length;
+
+var counter = 0;
+
+for ([...{ 0: x, length }] of [[ , ]]) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(length, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined-own.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined-own.js
new file mode 100644
index 0000000000..2c93d273ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined-own.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-undefined-own.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the iterable emits `undefined` as the only value, an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
+// where length and name are properties of WindowProxy
+let length;
+
+var counter = 0;
+
+for ([...{ 0: x, length }] of [[undefined]]) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(length, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined.js
new file mode 100644
index 0000000000..c3c28db4a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-undefined.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-undefined.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an obect literal and the iterable is emits no values, an empty array should be used as the value of the nested DestructuringAssignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+// Use the the top-level lexical scope for 'length' to provide compatibility with browsers
+// where length and name are properties of WindowProxy
+let length;
+
+var counter = 0;
+
+for ([...{ 0: x, length }] of [[]]) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(length, 0);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-expr.js
new file mode 100644
index 0000000000..93a2cce8ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-expr.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var iterationResult, iter, x;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ([...{ x = yield }] of [[{}]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x, undefined);
+
+iterationResult = iter.next(4);
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..7124f411be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ([...{ x = yield }] of [[{}]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-ident-valid.js
new file mode 100644
index 0000000000..7dc23a56cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 2;
+var x;
+
+var counter = 0;
+
+for ([...{ x = yield }] of [[{}]]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj.js
new file mode 100644
index 0000000000..482ae1ca0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-nested-obj.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-nested-obj.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ([...{ 1: x }] of [[1, 2, 3]]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-const.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-const.js
new file mode 100644
index 0000000000..56c60e050e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-const.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-put-const.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: The assignment target should obey `const` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [const, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+const c = null;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ([ ...c ] of [[1]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-let.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-let.js
new file mode 100644
index 0000000000..487d08cd62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-let.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-put-let.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: The assignment target should obey `let` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [let, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ([ ...x ] of [[]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+let x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-no-get.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-no-get.js
new file mode 100644
index 0000000000..110d37c5ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-no-get.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-put-prop-ref-no-get.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var setValue;
+var x = {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+};
+
+var counter = 0;
+
+for ([...x.y] of [[23, 45, 99]]) {
+ assert.sameValue(setValue.length, 3);
+ assert.sameValue(setValue[0], 23);
+ assert.sameValue(setValue[1], 45);
+ assert.sameValue(setValue[2], 99);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-user-err-iter-close-skip.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-user-err-iter-close-skip.js
new file mode 100644
index 0000000000..2f6c3746d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-user-err-iter-close-skip.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-put-prop-ref-user-err-iter-close-skip.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: IteratorClose is not called when value assignment produces an abrupt completion. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
+
+ [...]
+ 5. Let result be the result of performing
+ IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
+ iteratorRecord as the argument
+ 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
+ result).
+
+ AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
+
+ [...]
+ 4. Repeat while iteratorRecord.[[done]] is false
+ [...]
+ d. If next is false, set iteratorRecord.[[done]] to true.
+ [...]
+ 5. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an
+ ArrayLiteral, then
+ a. Return PutValue(lref, A).
+
+---*/
+var nextCount = 0;
+var returnCount = 0;
+var iterable = {};
+var iterator = {
+ next: function() {
+ nextCount += 1;
+ return { done: true };
+ },
+ return: function() {
+ returnCount += 1;
+ }
+};
+var obj = Object.defineProperty({}, 'poisoned', {
+ set: function(x) {
+ throw new Test262Error();
+ }
+});
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([...obj.poisoned] of [iterable]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(nextCount, 1);
+assert.sameValue(returnCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-user-err.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-user-err.js
new file mode 100644
index 0000000000..45e6872020
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref-user-err.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-put-prop-ref-user-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Any error raised as a result of setting the value should be forwarded to the runtime. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = {
+ set y(val) {
+ throw new Test262Error();
+ }
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ([...x.y] of [[23]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref.js
new file mode 100644
index 0000000000..10b3ca6d3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-prop-ref.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-put-prop-ref.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = {};
+
+var counter = 0;
+
+for ([...x.y] of [[4, 3, 2]]) {
+ assert.sameValue(x.y.length, 3);
+ assert.sameValue(x.y[0], 4);
+ assert.sameValue(x.y[1], 3);
+ assert.sameValue(x.y[2], 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..20b01f6336
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-unresolvable-no-strict.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-put-unresolvable-no-strict.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+{
+
+var counter = 0;
+
+for ([ ...unresolvable ] of [[]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+assert.sameValue(unresolvable.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-unresolvable-strict-strict.js
new file mode 100644
index 0000000000..a566c3f60f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-put-unresolvable-strict-strict.js
@@ -0,0 +1,40 @@
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-put-unresolvable-strict.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ([ ...unresolvable ] of [[]]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-expr.js
new file mode 100644
index 0000000000..d0c492b0a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-expr.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentRestElement and within the body of a generator function, it should behave as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = {};
+var iterationResult, iter;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ([...x[yield]] of [[33, 44, 55]]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x.prop, undefined);
+
+iterationResult = iter.next('prop');
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x.prop.length, 3);
+assert.sameValue(x.prop[0], 33);
+assert.sameValue(x.prop[1], 44);
+assert.sameValue(x.prop[2], 55);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..12b41221bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-ident-invalid-strict.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentRestElement and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+var x = {};
+
+for ([...x[yield]] of [[]]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-ident-valid.js
new file mode 100644
index 0000000000..9d2e19dff6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/array-rest-yield-ident-valid.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/array-rest-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentRestElement and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 'prop';
+var x = {};
+
+var counter = 0;
+
+for ([...x[yield]] of [[33, 44, 55]]) {
+ assert.sameValue(x.prop.length, 3);
+ assert.sameValue(x.prop[0], 33);
+ assert.sameValue(x.prop[1], 44);
+ assert.sameValue(x.prop[2], 55);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/browser.js b/js/src/tests/test262/language/statements/for-of/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-close.js
new file mode 100644
index 0000000000..bdc6687660
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [x] of [iter]) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..7dcc91b449
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Abrupt completion returned by GetIterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ for (const [x, y, z] of [[1, 2, 3]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..3caf29d81b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-get-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Abrupt completion returned by GetIterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ for (const [x] of [iter]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..817876118a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [x] of [iter]) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-name-iter-val.js
new file mode 100644
index 0000000000..7ae6f3fb2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding with normal value iteration (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..217d2adf07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [[x, y, z] = [4, 5, 6]] of [[]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..8e557ea330
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..9a2ebf1553
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [[,] = g()] of [[]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..a0ad26fc25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [[,] = g()] of [[[]]]) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..0b7d99fda1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [[] = function() { initCount += 1; return iter; }()] of [[]]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..8b2d39fa32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [[] = function() { initCount += 1; }()] of [[[23]]]) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..81d8dc2de2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..b09b6daabe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..d380b761f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Nested array destructuring with a null value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const [[x]] of [[null]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..00f39a397a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Destructuring initializer with an exhausted iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [x = 23] of [[]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..0d77af2052
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [arrow = () => {}] of [[]]) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..d536028996
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..a48fa92448
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [cover = (function () {}), xCover = (0, function() {})] of [[]]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..023f9247fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [fn = function () {}, xFn = function x() {}] of [[]]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..e33c8f1c06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// 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-of-const.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [gen = function* () {}, xGen = function* x() {}] of [[]]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..671c1fe0a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Destructuring initializer with a "hole" (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [x = 23] of [[,]]) {
+ assert.sameValue(x, 23);
+ // another statement
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..287e32bcd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..eac4b83873
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Destructuring initializer returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ for (const [x = (function() { throw new Test262Error(); })()] of [[undefined]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..1a3db28d11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Destructuring initializer with an undefined value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [x = 23] of [[undefined]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..c0169e8a17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (const [ x = unresolvableReference ] of [[]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..2776aab08d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding when value iteration completes (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..1407655409
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [_, x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..6f93b69dd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (const [x] of [g]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..ef03673a4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var iterCount = 0;
+
+for (const [x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..c52b85fc58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (const [x] of [g]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..9751e7a674
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..38ef7a9261
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..744ef995e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..600ac4b074
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..1d9a8cbb8d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..5f6d0743a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Nested object destructuring with a null value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const [{ x }] of [[null]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..25977c2400
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Nested object destructuring with a value of `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const [{ x }] of [[]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..3952eff05c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Elision accepts exhausted iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [,] of [iter]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..eb8a8b0b96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding/iter-close/for-of-const.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (const [,] of [iter]) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..dcd3155f83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision-step-err.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (const [,] of [iter]) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-elision.js
new file mode 100644
index 0000000000..b42eaaf2a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Elision advances iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [,] of [g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-empty.js
new file mode 100644
index 0000000000..7e5df06e2e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [] of [iter]) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-init-err.js
new file mode 100644
index 0000000000..f294826871
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-init-err.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (const [x] = 1 of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..a8bfc671b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Rest element containing an array BindingElementList pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [...[x, y, z]] of [[3, 4, 5]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..ea7ddad36f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Rest element containing an elision (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [...[,]] of [g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..5084f6f3e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Rest element containing an "empty" array pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [...[]] of [iter]) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..248cac83a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Rest element containing a rest element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..023443c909
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Lone rest element (direct binding) (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var iterCount = 0;
+
+for (const [...x] of [[1]]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..a0cf9ee911
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Rest element following elision elements (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ for (const [, ...x] of [iter]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..d2479bbedd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Rest element following elision elements (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..c2e7693af8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: RestElement applied to an exhausted iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [, , ...x] of [[1, 2]]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..0534ab4866
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding/iter-close/for-of-const.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (const [...x] of [iter]) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..fe2263684a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (const [...x] of [iter]) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..12472d517c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (const [...x] of [iter]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..2c4b3fc3a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Lone rest element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..d20f6a8c56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...[ x ] = []] of [[]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..eeb53cf677
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Rest element (identifier) does not support initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...x = []] of [[]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..e8e3d80256
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...{ x } = []] of [[]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..897ad82b3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...[x], y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..bbd9a15bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Rest element (identifier) may not be followed by any element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...x, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..0e6ec2518c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...{ x }, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..de0e9babd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Rest element containing an object binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const [...{ length }] of [[1, 2, 3]]) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..d5ddf64601
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Rest element containing an object binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+
+for (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.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-init-null.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-init-null.js
new file mode 100644
index 0000000000..53a699c8b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-init-null.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const {} of [null]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-init-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-init-undefined.js
new file mode 100644
index 0000000000..9a0540f9e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-init-undefined.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const {} of [undefined]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-empty.js
new file mode 100644
index 0000000000..fc85ac0e64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const {} of [obj]) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..0c3baa9c5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (const { poisoned } of [poisonedProperty]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..a93573fbbb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const { arrow = () => {} } of [{}]) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..a65a8562e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..1dbff80598
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const { cover = (function () {}), xCover = (0, function() {}) } of [{}]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..7113485257
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const { fn = function () {}, xFn = function x() {} } of [{}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..71e0426536
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,64 @@
+// 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-of-const.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const { gen = function* () {}, xGen = function* x() {} } of [{}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..061901ff4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..f1aa1a7ab3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Error thrown when evaluating the initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (const { x = thrower() } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..ee5f500377
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (const { x = unresolvableReference } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..c3476c299f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const { x, } of [{ x: 23 }]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-init-err.js
new file mode 100644
index 0000000000..7961550941
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-init-err.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (const {x} = 1 of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..6b083c1b40
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-list-err.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (const { a, b = thrower(), c = ++initCount } of [{}]) {
+ return;
+ }
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..3070390866
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..995d172198
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const { x: [y], } of [{ x: [45] }]) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..7ce541e952
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (const { w: [x, y, z] = [4, 5, 6] } of [{ w: null }]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..cadee3690e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..2bf7de1950
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Evaluation of property name returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (const { [thrower()]: x } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..31a35c2605
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (const { poisoned: x = ++initEvalCount } of [poisonedProperty]) {
+ return;
+ }
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..7d22df45c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..3de1ee1adf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Error thrown when evaluating the initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (const { x: y = thrower() } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..dd9782c840
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (const { x: y = unresolvableReference } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..1e176cc385
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const { x: y = 33 } of [{ }]) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..07c7fd9758
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const { x: y, } of [{ x: 23 }]) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..b3b4e7f218
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Binding as specified via property name and identifier (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const { x: y } of [{ x: 23 }]) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..8aef591cd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..2cd0da6dba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: null }]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..c90a93a21b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/for-of-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (const { w: { x, y, z } = undefined } of [{ }]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..2c86bf1cee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..9ab6019a31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-getter.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/for-of-const.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const {...x} of [{ get v() { count++; return 2; } }]) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..15ef80cd1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const {...rest} of [o]) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/const-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..69fb433326
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/const-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-of-const.template
+/*---
+description: Rest object contains just unextracted data (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (const {a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-close.js
new file mode 100644
index 0000000000..9c2ba3f96c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [x] of [iter]) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..5772d2b435
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Abrupt completion returned by GetIterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ for (let [x, y, z] of [[1, 2, 3]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..d67ab5c4ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-get-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Abrupt completion returned by GetIterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ for (let [x] of [iter]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..63205c97cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [x] of [iter]) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-name-iter-val.js
new file mode 100644
index 0000000000..8ee75df788
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding with normal value iteration (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..02d52df6e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [[x, y, z] = [4, 5, 6]] of [[]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..c6e3ff07bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..a76de3274d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [[,] = g()] of [[]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..1c62d7be26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [[,] = g()] of [[[]]]) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..575a575b4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [[] = function() { initCount += 1; return iter; }()] of [[]]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..1494a8af29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [[] = function() { initCount += 1; }()] of [[[23]]]) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..2b0e795f53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..8fc2c4e9ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..b012805051
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Nested array destructuring with a null value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let [[x]] of [[null]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..73453eeff9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Destructuring initializer with an exhausted iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [x = 23] of [[]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..125d850f34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [arrow = () => {}] of [[]]) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..fef2647aba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..aa30c1fbb8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [cover = (function () {}), xCover = (0, function() {})] of [[]]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..2fd4c1c892
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [fn = function () {}, xFn = function x() {}] of [[]]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..e16e291ec3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// 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-of-let.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [gen = function* () {}, xGen = function* x() {}] of [[]]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..5fda42c7d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Destructuring initializer with a "hole" (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [x = 23] of [[,]]) {
+ assert.sameValue(x, 23);
+ // another statement
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..a53ddf7bf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..ddfb202e7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Destructuring initializer returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ for (let [x = (function() { throw new Test262Error(); })()] of [[undefined]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..d7db6260ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Destructuring initializer with an undefined value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [x = 23] of [[undefined]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..77e2bb144a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (let [ x = unresolvableReference ] of [[]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..c3066148f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding when value iteration completes (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..b60398b7fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [_, x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..20cd863ab3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (let [x] of [g]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..968f027b96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var iterCount = 0;
+
+for (let [x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..744627718e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (let [x] of [g]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..ecd94ba119
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..d345996ea4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..086b9871ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..37e59ddd46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..8bc6b1a244
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..a52a1db344
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Nested object destructuring with a null value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let [{ x }] of [[null]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..3daea7a5f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Nested object destructuring with a value of `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let [{ x }] of [[]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..4d467bf91c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Elision accepts exhausted iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [,] of [iter]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..5eaef08293
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding/iter-close/for-of-let.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (let [,] of [iter]) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..476262dc7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision-step-err.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (let [,] of [iter]) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-elision.js
new file mode 100644
index 0000000000..afa835f0d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Elision advances iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [,] of [g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-empty.js
new file mode 100644
index 0000000000..66d7a0fe4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [] of [iter]) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-init-err.js
new file mode 100644
index 0000000000..9c9f86e19e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-init-err.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (let [x] = 1 of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..2f03e1f2a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Rest element containing an array BindingElementList pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [...[x, y, z]] of [[3, 4, 5]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..d9d1f9e3bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Rest element containing an elision (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [...[,]] of [g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..dea5af639f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Rest element containing an "empty" array pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [...[]] of [iter]) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..09def53f88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Rest element containing a rest element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..4b1b9723f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Lone rest element (direct binding) (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var iterCount = 0;
+
+for (let [...x] of [[1]]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..b4ebb84303
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Rest element following elision elements (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ for (let [, ...x] of [iter]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..56ec257ce5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Rest element following elision elements (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..c3c190675e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: RestElement applied to an exhausted iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [, , ...x] of [[1, 2]]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..ca6f9b1edd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding/iter-close/for-of-let.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (let [...x] of [iter]) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..da0f4ff5ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (let [...x] of [iter]) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..e61fdcb66a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (let [...x] of [iter]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..ef1bc67f10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Lone rest element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..dbd5d76f0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...[ x ] = []] of [[]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..c4cdff33ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Rest element (identifier) does not support initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...x = []] of [[]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..1ab019d9ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...{ x } = []] of [[]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..5e254fd3fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...[x], y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..81967123ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Rest element (identifier) may not be followed by any element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...x, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..b744247852
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...{ x }, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..982ddef1a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Rest element containing an object binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let [...{ length }] of [[1, 2, 3]]) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..20a9e2c9f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Rest element containing an object binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+
+for (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.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-init-null.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-init-null.js
new file mode 100644
index 0000000000..8a8a72b0d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-init-null.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let {} of [null]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-init-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-init-undefined.js
new file mode 100644
index 0000000000..748dede704
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-init-undefined.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let {} of [undefined]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-empty.js
new file mode 100644
index 0000000000..85c41d7cc9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let {} of [obj]) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..fb046302fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (let { poisoned } of [poisonedProperty]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..d638a5f92f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let { arrow = () => {} } of [{}]) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..c801ccd4be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..5261c6c37c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let { cover = (function () {}), xCover = (0, function() {}) } of [{}]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..37ffb46c55
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let { fn = function () {}, xFn = function x() {} } of [{}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..f2e81e9467
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,64 @@
+// 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-of-let.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let { gen = function* () {}, xGen = function* x() {} } of [{}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..3d7a799f73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..879f9cb43a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Error thrown when evaluating the initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (let { x = thrower() } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..a58d6660e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (let { x = unresolvableReference } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..08c770b922
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let { x, } of [{ x: 23 }]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-init-err.js
new file mode 100644
index 0000000000..88325bbe6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-init-err.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (let {x} = 1 of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..4062d8cba0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-list-err.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (let { a, b = thrower(), c = ++initCount } of [{}]) {
+ return;
+ }
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..70e5fb41e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..2e591bda71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let { x: [y], } of [{ x: [45] }]) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..6598982c47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (let { w: [x, y, z] = [4, 5, 6] } of [{ w: null }]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..d92b0bf095
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..d8af00ee04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Evaluation of property name returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (let { [thrower()]: x } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..377f712820
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (let { poisoned: x = ++initEvalCount } of [poisonedProperty]) {
+ return;
+ }
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..3b0aa20fa9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..252bc11ebb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Error thrown when evaluating the initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (let { x: y = thrower() } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..beacb6eb2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (let { x: y = unresolvableReference } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..362f8a7b4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let { x: y = 33 } of [{ }]) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..153a9df8a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let { x: y, } of [{ x: 23 }]) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..6ce9783e5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Binding as specified via property name and identifier (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let { x: y } of [{ x: 23 }]) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..07a09d319a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..fb956c7135
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: null }]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..51dbb5df4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/for-of-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (let { w: { x, y, z } = undefined } of [{ }]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..ab47647d69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-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-of-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..405a223d0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-getter.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/for-of-let.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let {...x} of [{ get v() { count++; return 2; } }]) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..2b87b2cbef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/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-of-let.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let {...rest} of [o]) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/let-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..c9f408b6f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/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-of-let.template
+/*---
+description: Rest object contains just unextracted data (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 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;
+
+for (let {a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-bool.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-bool.js
new file mode 100644
index 0000000000..cb9927622f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-bool.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-empty-bool.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (boolean value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+for ({} of [false]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-null.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-null.js
new file mode 100644
index 0000000000..361d985be5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-null.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-empty-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (null value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({} of [null]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-num.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-num.js
new file mode 100644
index 0000000000..4545eb9388
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-num.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-empty-num.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (number value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+for ({} of [0]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-obj.js
new file mode 100644
index 0000000000..f6276f0852
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-obj.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-empty-obj.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (object value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+for ({} of [{}]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-string.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-string.js
new file mode 100644
index 0000000000..14d2b37c1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-string.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-empty-string.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (string value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+for ({} of ['']) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-symbol.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-symbol.js
new file mode 100644
index 0000000000..61755aba3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-symbol.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-empty-symbol.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (symbol value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var s = Symbol();
+
+var counter = 0;
+
+for ({} of [s]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-undef.js
new file mode 100644
index 0000000000..890974faf5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-empty-undef.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-empty-undef.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (undefined value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({} of [undefined]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-first.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-first.js
new file mode 100644
index 0000000000..70f808185e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-first.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-resolution-first.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (first of many) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+var y;
+
+var counter = 0;
+
+for ({ x, y } of [{ x: 3 }]) {
+ assert.sameValue(x, 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-last.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-last.js
new file mode 100644
index 0000000000..085041b37d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-last.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-resolution-last.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (last of many) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+var w;
+
+var counter = 0;
+
+for ({ w, x } of [{ x: 4 }]) {
+ assert.sameValue(x, 4);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-lone.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-lone.js
new file mode 100644
index 0000000000..61fc0d65fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-lone.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-resolution-lone.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone identifier) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+
+var counter = 0;
+
+for ({ x, } of [{ x: 2 }]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-middle.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-middle.js
new file mode 100644
index 0000000000..febd089b8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-middle.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-resolution-middle.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (within many) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+var w, y;
+
+var counter = 0;
+
+for ({ w, x, y } of [{ x: 5 }]) {
+ assert.sameValue(x, 5);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-trlng.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-trlng.js
new file mode 100644
index 0000000000..02e6c6779f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-resolution-trlng.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-resolution-trlng.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone identifier with trailing comma) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+
+var counter = 0;
+
+for ({ x } of [{ x: 1 }]) {
+ assert.sameValue(x, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-expr.js
new file mode 100644
index 0000000000..84ed8fd2c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-expr.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-yield-expr.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: yield is not a valid IdentifierReference in an AssignmentProperty within generator function bodies. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated, noStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+(function*() {
+
+for ({ yield } of [{}]) ;
+
+});
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..c67a9cc2d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: yield is not a valid IdentifierReference in an AssignmentProperty within strict mode code. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ yield } of [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-ident-valid.js
new file mode 100644
index 0000000000..6cc660d6b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-identifier-yield-ident-valid.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-identifier-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: yield is a valid IdentifierReference in an AssignmentProperty outside of strict mode and generator functions. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield;
+
+var counter = 0;
+
+for ({ yield } of [{ yield: 3 }]) {
+ assert.sameValue(yield, 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-missing.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-missing.js
new file mode 100644
index 0000000000..d284a52c94
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-missing.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-assignment-missing.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (no corresponding property defined). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ({ x = 1 } of [{}]) {
+ assert.sameValue(x, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-null.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-null.js
new file mode 100644
index 0000000000..176c1aef23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-null.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-assignment-null.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (null property value defined). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ({ x = 1 } of [{ x: null }]) {
+ assert.sameValue(x, null);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-truthy.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-truthy.js
new file mode 100644
index 0000000000..68a032b78c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-truthy.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-assignment-truthy.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (truthy property value defined). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ({ x = 1 } of [{ x: 2 }]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-undef.js
new file mode 100644
index 0000000000..8e139d9f14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-assignment-undef.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-assignment-undef.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference ("undefined" property value defined). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ({ x = 1 } of [{ x: undefined }]) {
+ assert.sameValue(x, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-evaluation.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-evaluation.js
new file mode 100644
index 0000000000..765faed324
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-evaluation.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-evaluation.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The Initializer should only be evaluated if v is undefined. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var flag1 = false;
+var flag2 = false;
+var x, y;
+
+var counter = 0;
+
+for ({ x = flag1 = true, y = flag2 = true } of [{ y: 1 }]) {
+ assert.sameValue(flag1, true);
+ assert.sameValue(flag2, false);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..f6a3c37add
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-arrow.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-fn-name-arrow.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (ArrowFunction) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+var arrow;
+
+var counter = 0;
+
+for ({ arrow = () => {} } of [{}]) {
+ verifyProperty(arrow, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'arrow'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-class.js
new file mode 100644
index 0000000000..e9b35c5bb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-class.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-fn-name-class.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (ClassExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+var xCls, cls, xCls2;
+
+var counter = 0;
+
+for ({ xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } } of [{}]) {
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ verifyProperty(cls, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cls'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..d79cbdf0f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-cover.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-fn-name-cover.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (CoverParenthesizedExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+var xCover, cover;
+
+var counter = 0;
+
+for ({ xCover = (0, function() {}), cover = (function() {}) } of [{}]) {
+ assert.notSameValue(xCover.name, 'xCover');
+
+ verifyProperty(cover, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cover'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..a9eccefe4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-fn.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-fn-name-fn.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (FunctionExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+var xFn, fn;
+
+var counter = 0;
+
+for ({ xFn = function x() {}, fn = function() {} } of [{}]) {
+ assert.notSameValue(xFn.name, 'xFn');
+
+ verifyProperty(fn, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'fn'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..e8be796941
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-fn-name-gen.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-fn-name-gen.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (GeneratorExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentProperty : IdentifierReference Initializeropt
+ [...] 6. If Initializeropt 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, P).
+
+---*/
+var xGen, gen;
+
+var counter = 0;
+
+for ({ xGen = function* x() {}, gen = function*() {} } of [{}]) {
+ assert.notSameValue(xGen.name, 'xGen');
+
+ verifyProperty(gen, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'gen'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-in.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-in.js
new file mode 100644
index 0000000000..7ffb5e146e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-in.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-in.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The Initializer in an AssignmentProperty may be an `in` expression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var prop;
+
+var counter = 0;
+
+for ({ prop = 'x' in {} } of [{}]) {
+ assert.sameValue(prop, false);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-let.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-let.js
new file mode 100644
index 0000000000..d520041444
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-let.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-let.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Value retrieval of Initializer obeys `let` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [let, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ({ x = y } of [{}]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+let y;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-order.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-order.js
new file mode 100644
index 0000000000..cd1a3da4c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-order.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-order.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Initializer values should be assigned in left-to-right order. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = 0;
+var a, b;
+
+var counter = 0;
+
+for ({ a = x += 1, b = x *= 2 } of [{}]) {
+ assert.sameValue(a, 1);
+ assert.sameValue(b, 2);
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-simple-no-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-simple-no-strict.js
new file mode 100644
index 0000000000..fe5ba9b801
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-simple-no-strict.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-simple-no-strict.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var eval, arguments;
+
+var counter = 0;
+
+for ({ eval = 3, arguments = 4 } of [{}]) {
+ assert.sameValue(eval, 3);
+ assert.sameValue(arguments, 4);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-simple-strict-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-simple-strict-strict.js
new file mode 100644
index 0000000000..91a89fe260
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-simple-strict-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-simple-strict.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if IsValidSimpleAssignmentTarget of IdentifierReference is false. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ eval = 0 } of [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-expr.js
new file mode 100644
index 0000000000..109aac43d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-expr.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentProperty and within a generator function body, it should behave as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var iterationResult, x, iter;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ({ x = yield } of [{}]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x, undefined);
+
+iterationResult = iter.next(3);
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..b6d735805f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentProperty and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x = yield } of [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-ident-valid.js
new file mode 100644
index 0000000000..86e4ac341c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-init-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-init-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentProperty and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 3;
+var x;
+
+var counter = 0;
+
+for ({ x = yield } of [{}]) {
+ assert.sameValue(x, 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-const.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-const.js
new file mode 100644
index 0000000000..da31cbd7e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-const.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-put-const.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: The assignment target should obey `const` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [const, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+const c = null;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({ c } of [{ c: 1 }]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-let.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-let.js
new file mode 100644
index 0000000000..f5aad869cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-let.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-put-let.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: The assignment target should obey `let` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [let, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ({ x } of [{}]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+let x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..e7e0f4f855
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-unresolvable-no-strict.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-put-unresolvable-no-strict.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+{
+
+var counter = 0;
+
+for ({ unresolvable } of [{}]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+assert.sameValue(unresolvable, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-unresolvable-strict-strict.js
new file mode 100644
index 0000000000..3a29252147
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-put-unresolvable-strict-strict.js
@@ -0,0 +1,40 @@
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-put-unresolvable-strict.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ({ unresolvable } of [{}]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-simple-no-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-simple-no-strict.js
new file mode 100644
index 0000000000..3f70f5f919
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-simple-no-strict.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-simple-no-strict.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var eval, arguments;
+
+var counter = 0;
+
+for ({ eval, arguments } of [{ eval: 1, arguments: 2 }]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+assert.sameValue(eval, 1);
+assert.sameValue(arguments, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-id-simple-strict-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-simple-strict-strict.js
new file mode 100644
index 0000000000..7b10af83c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-id-simple-strict-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-id-simple-strict.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if IsValidSimpleAssignmentTarget of IdentifierReference is false. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ eval } of [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-missing.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-missing.js
new file mode 100644
index 0000000000..2b3e8553d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-missing.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-assignment-missing.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (non-existent property) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ({ y: x = 1 } of [{}]) {
+ assert.sameValue(x, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-null.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-null.js
new file mode 100644
index 0000000000..0bffa7dd8c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-null.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-assignment-null.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the Initializer is present and v is not undefined, the Initializer should be evaluated and the result assigned to the target reference (null value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ({ y: x = 1 } of [{ y: null }]) {
+ assert.sameValue(x, null);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-truthy.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-truthy.js
new file mode 100644
index 0000000000..e09ab3a74a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-truthy.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-assignment-truthy.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the Initializer is present and v is not undefined, the Initializer should be evaluated and the result assigned to the target reference (truthy value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ({ y: x = 1 } of [{ y: 2 }]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-undef.js
new file mode 100644
index 0000000000..a941f7a87a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-assignment-undef.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-assignment-undef.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (undefined value) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ({ y: x = 1 } of [{ y: undefined }]) {
+ assert.sameValue(x, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-evaluation.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-evaluation.js
new file mode 100644
index 0000000000..64720d42c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-evaluation.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-evaluation.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The Initializer should only be evaluated if v is undefined. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var flag1 = false;
+var flag2 = false;
+var x, y;
+
+var counter = 0;
+
+for ({ x: x = flag1 = true, y: y = flag2 = true } of [{ y: 1 }]) {
+ assert.sameValue(x, true, 'value of `x`');
+ assert.sameValue(flag1, true, 'value of `flag1`');
+ assert.sameValue(y, 1, 'value of `y`');
+ assert.sameValue(flag2, false, 'value of `flag2`');
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-arrow.js
new file mode 100644
index 0000000000..37d3bd6c71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-arrow.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-fn-name-arrow.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (ArrowFunction) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
+ GetReferencedName(lref)).
+
+---*/
+var arrow;
+
+var counter = 0;
+
+for ({ x: arrow = () => {} } of [{}]) {
+ verifyProperty(arrow, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'arrow'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-class.js
new file mode 100644
index 0000000000..a0c138ce84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-class.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-fn-name-class.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (ClassExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [class, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
+ GetReferencedName(lref)).
+
+---*/
+var xCls, cls, xCls2;
+
+var counter = 0;
+
+for ({ x: xCls = class x {}, x: cls = class {}, x: xCls2 = class { static name() {} } } of [{}]) {
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ verifyProperty(cls, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cls'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-cover.js
new file mode 100644
index 0000000000..a2195daf85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-cover.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-fn-name-cover.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (CoverParenthesizedExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
+ GetReferencedName(lref)).
+
+---*/
+var xCover, cover;
+
+var counter = 0;
+
+for ({ x: xCover = (0, function() {}), x: cover = (function() {}) } of [{}]) {
+ assert.notSameValue(xCover.name, 'xCover');
+
+ verifyProperty(cover, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'cover'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-fn.js
new file mode 100644
index 0000000000..6b4e905ab4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-fn.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-fn-name-fn.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (FunctionExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
+ GetReferencedName(lref)).
+
+---*/
+var xFn, fn;
+
+var counter = 0;
+
+for ({ x: xFn = function x() {}, x: fn = function() {} } of [{}]) {
+ assert.notSameValue(xFn.name, 'xFn');
+
+ verifyProperty(fn, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'fn'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-gen.js
new file mode 100644
index 0000000000..a96e87f2d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-fn-name-gen.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-fn-name-gen.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Assignment of function `name` attribute (GeneratorExpression) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
+ [...] 7. If Initializer is present and v is undefined and
+ IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
+ DestructuringAssignmentTarget are both true, then
+ a. Let hasNameProperty be HasOwnProperty(rhsValue, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(rhsValue,
+ GetReferencedName(lref)).
+
+---*/
+var xGen, gen;
+
+var counter = 0;
+
+for ({ x: xGen = function* x() {}, x: gen = function*() {} } of [{}]) {
+ assert.notSameValue(xGen.name, 'xGen');
+
+ verifyProperty(gen, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+ value: 'gen'
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-in.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-in.js
new file mode 100644
index 0000000000..ded1a2742b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-in.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-in.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The Initializer in an AssignmentElement may be an `in` expression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var prop;
+
+var counter = 0;
+
+for ({ x: prop = 'x' in {} } of [{}]) {
+ assert.sameValue(prop, false);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-let.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-let.js
new file mode 100644
index 0000000000..61d75dfe7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-let.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-let.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Value retrieval of Initializer obeys `let` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [let, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ({ x: x = y } of [{}]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+let y;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-expr.js
new file mode 100644
index 0000000000..e61d64d533
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-expr.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement and within a generator function body, it should behave as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var iterationResult, iter, x;
+iter = (function*() {
+
+var counter = 0;
+
+for ({ x: x = yield } of [{}]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x, undefined);
+
+iterationResult = iter.next(86);
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x, 86);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..a0488ae63a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: x = yield } of [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-ident-valid.js
new file mode 100644
index 0000000000..460952544f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-init-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-init-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 4;
+var x;
+
+var counter = 0;
+
+for ({ x: x = yield } of [{}]) {
+ assert.sameValue(x, 4);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..92718cc184
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js
@@ -0,0 +1,66 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (MemberExpression OptionalChain .IdentifierName Initializer) (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+var y = {};
+
+for ({ x: y?.z = 42 } of [{ x: 23 }]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js
new file mode 100644
index 0000000000..630f73e9b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js
@@ -0,0 +1,69 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [optional-chaining, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ OptionalExpression:
+ MemberExpression OptionalChain
+ CallExpression OptionalChain
+ OptionalExpression OptionalChain
+
+ OptionalChain:
+ ?. [ Expression ]
+ ?. IdentifierName
+ ?. Arguments
+ ?. TemplateLiteral
+ OptionalChain [ Expression ]
+ OptionalChain .IdentifierName
+ OptionalChain Arguments
+ OptionalChain TemplateLiteral
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
+
+ Static Semantics: IsValidSimpleAssignmentTarget
+
+ LeftHandSideExpression : OptionalExpression
+ 1. Return false.
+
+---*/
+$DONOTEVALUATE();
+
+for ({ x: {
+ set y(val) {
+ throw new Test262Error('The property should not be accessed.');
+ }
+}?.y = 42} of [{x: 42}]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref-init-active.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref-init-active.js
new file mode 100644
index 0000000000..69913adcac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref-init-active.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-obj-literal-prop-ref-init-active.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with active initializer. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentPattern : ObjectAssignmentPattern
+ ObjectAssignmentPattern : { AssignmentPropertyList }
+ AssignmentPropertyList : AssignmentProperty
+ AssignmentProperty : PropertyName : AssignmentElement
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern.
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple.
+
+ Runtime Semantics: DestructuringAssignmentEvaluation
+ ObjectAssignmentPattern : { AssignmentPropertyList }
+
+ 1. Perform ? RequireObjectCoercible(value).
+ 2. Perform ? PropertyDestructuringAssignmentEvaluation for AssignmentPropertyList using value as the argument.
+ 3. Return NormalCompletion(empty).
+
+ Runtime Semantics: PropertyDestructuringAssignmentEvaluation
+
+ AssignmentProperty : PropertyName : AssignmentElement
+
+ 1. Let name be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(name).
+ 3. Perform ? KeyedDestructuringAssignmentEvaluation of AssignmentElement with value and name as the arguments.
+ 4. Return a new List containing name.
+
+ Runtime Semantics: KeyedDestructuringAssignmentEvaluation
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ ...
+
+---*/
+var setValue;
+
+var counter = 0;
+
+for ({ x: {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+}.y = 42} of [{x: undefined}]) {
+ assert.sameValue(setValue, 42);
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref-init.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref-init.js
new file mode 100644
index 0000000000..f1b3e5c56f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref-init.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-obj-literal-prop-ref-init.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with initializer. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentPattern : ObjectAssignmentPattern
+ ObjectAssignmentPattern : { AssignmentPropertyList }
+ AssignmentPropertyList : AssignmentProperty
+ AssignmentProperty : PropertyName : AssignmentElement
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern.
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple.
+
+ Runtime Semantics: DestructuringAssignmentEvaluation
+ ObjectAssignmentPattern : { AssignmentPropertyList }
+
+ 1. Perform ? RequireObjectCoercible(value).
+ 2. Perform ? PropertyDestructuringAssignmentEvaluation for AssignmentPropertyList using value as the argument.
+ 3. Return NormalCompletion(empty).
+
+ Runtime Semantics: PropertyDestructuringAssignmentEvaluation
+
+ AssignmentProperty : PropertyName : AssignmentElement
+
+ 1. Let name be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(name).
+ 3. Perform ? KeyedDestructuringAssignmentEvaluation of AssignmentElement with value and name as the arguments.
+ 4. Return a new List containing name.
+
+ Runtime Semantics: KeyedDestructuringAssignmentEvaluation
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ ...
+
+---*/
+var setValue;
+
+var counter = 0;
+
+for ({ x: {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+}.y = 42} of [{x: 23}]) {
+ assert.sameValue(setValue, 23);
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref.js
new file mode 100644
index 0000000000..13851a5ef7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-obj-literal-prop-ref.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-obj-literal-prop-ref.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+
+ Syntax
+
+ AssignmentPattern : ObjectAssignmentPattern
+ ObjectAssignmentPattern : { AssignmentPropertyList }
+ AssignmentPropertyList : AssignmentProperty
+ AssignmentProperty : PropertyName : AssignmentElement
+ AssignmentElement : DestructuringAssignmentTarget Initializer_opt
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ Static Semantics: Early Errors
+
+ DestructuringAssignmentTarget : LeftHandSideExpression
+
+ - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern.
+ - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple.
+
+ Runtime Semantics: DestructuringAssignmentEvaluation
+ ObjectAssignmentPattern : { AssignmentPropertyList }
+
+ 1. Perform ? RequireObjectCoercible(value).
+ 2. Perform ? PropertyDestructuringAssignmentEvaluation for AssignmentPropertyList using value as the argument.
+ 3. Return NormalCompletion(empty).
+
+ Runtime Semantics: PropertyDestructuringAssignmentEvaluation
+
+ AssignmentProperty : PropertyName : AssignmentElement
+
+ 1. Let name be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(name).
+ 3. Perform ? KeyedDestructuringAssignmentEvaluation of AssignmentElement with value and name as the arguments.
+ 4. Return a new List containing name.
+
+ Runtime Semantics: KeyedDestructuringAssignmentEvaluation
+
+ AssignmentElement : DestructuringAssignmentTarget Initializer
+
+ 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
+ a. Let lref be the result of evaluating DestructuringAssignmentTarget.
+ ...
+
+---*/
+var setValue;
+
+var counter = 0;
+
+for ({ x: {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+}.y} of [{x: 23}]) {
+ assert.sameValue(setValue, 23);
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-expr.js
new file mode 100644
index 0000000000..26f4cfcae5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-expr.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and within a generator function body, it should behave as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = {};
+var iterationResult, iter;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ({ x: x[yield] } of [{ x: 23 }]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x.prop, undefined);
+
+iterationResult = iter.next('prop');
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x.prop, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..62023d02c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: x[yield] } of [{}]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-ident-valid.js
new file mode 100644
index 0000000000..8b8c4cf229
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-elem-target-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-elem-target-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 'prop';
+var x = {};
+
+var counter = 0;
+
+for ({ x: x[yield] } of [{ x: 23 }]) {
+ assert.sameValue(x.prop, 23);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-first.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-first.js
new file mode 100644
index 0000000000..4fa0e5c937
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-first.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-identifier-resolution-first.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (first of many). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+var y;
+
+var counter = 0;
+
+for ({ a: x, y } of [{ a: 3 }]) {
+ assert.sameValue(x, 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-last.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-last.js
new file mode 100644
index 0000000000..0b61fd7353
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-last.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-identifier-resolution-last.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (last of many). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+var w;
+
+var counter = 0;
+
+for ({ w, a: x } of [{ a: 4 }]) {
+ assert.sameValue(x, 4);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-lone.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-lone.js
new file mode 100644
index 0000000000..e1f99e8b72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-lone.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-identifier-resolution-lone.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone element). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+
+var counter = 0;
+
+for ({ a: x } of [{ a: 1 }]) {
+ assert.sameValue(x, 1);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-middle.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-middle.js
new file mode 100644
index 0000000000..e4a03ade77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-middle.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-identifier-resolution-middle.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (within many). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+var w, y;
+
+var counter = 0;
+
+for ({ w, a: x, y } of [{ a: 5 }]) {
+ assert.sameValue(x, 5);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-trlng.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-trlng.js
new file mode 100644
index 0000000000..1033983e67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-identifier-resolution-trlng.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-identifier-resolution-trlng.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Evaluation of DestructuringAssignmentTarget (lone element with trailing comma). (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = null;
+
+var counter = 0;
+
+for ({ a: x, } of [{ a: 2 }]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-name-evaluation-error.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-name-evaluation-error.js
new file mode 100644
index 0000000000..ee9a330569
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-name-evaluation-error.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-name-evaluation-error.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Any error raised as a result of evaluating PropertyName should be forwarded to the runtime. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a, x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({ [a.b]: x } of [{}]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-name-evaluation.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-name-evaluation.js
new file mode 100644
index 0000000000..1a36dd05bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-name-evaluation.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-name-evaluation.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: PropertyName of an AssignmentProperty may be a ComputedPropertyName. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x, y, xy;
+
+var counter = 0;
+
+for ({ ['x' + 'y']: x } of [{ x: 1, xy: 23, y: 2 }]) {
+ assert.sameValue(x, 23);
+ assert.sameValue(y, undefined);
+ assert.sameValue(xy, undefined);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-invalid.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-invalid.js
new file mode 100644
index 0000000000..32772b6af9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: [(x, y)] } of [{ x: [] }]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-null.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-null.js
new file mode 100644
index 0000000000..c303c01c77
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-null.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is `null`, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({ x: [ x ] } of [{ x: null }]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-undefined-own.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-undefined-own.js
new file mode 100644
index 0000000000..e2b7cbcef0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-undefined-own.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array-undefined-own.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is `undefined`, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({ x: [ x ] } of [{ x: undefined }]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-undefined.js
new file mode 100644
index 0000000000..3e1525fabf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-undefined.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array-undefined.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal and the value is not defined, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({ x: [ x ] } of [{}]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-expr.js
new file mode 100644
index 0000000000..c3f8ce19d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-expr.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var iterationResult, iter, x;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ({ x: [x = yield] } of [{ x: [] }]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x, undefined);
+
+iterationResult = iter.next(24601);
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x, 24601);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..bfd72bbcde
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: [x = yield] } of [{ x: [] }]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-ident-valid.js
new file mode 100644
index 0000000000..8649b19af2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 22;
+var x;
+
+var counter = 0;
+
+for ({ x: [x = yield] } of [{ x: [] }]) {
+ assert.sameValue(x, 22);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array.js
new file mode 100644
index 0000000000..854f71e280
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-array.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-array.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var y;
+
+var counter = 0;
+
+for ({ x: [y] } of [{ x: [321] }]) {
+ assert.sameValue(y, 321);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-invalid.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-invalid.js
new file mode 100644
index 0000000000..75a901e38c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-invalid.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: { get x() {} } } of [{ x: {} }]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-null.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-null.js
new file mode 100644
index 0000000000..a22a80241b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-null.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is `null`, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({ x: { x } } of [{ x: null }]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-undefined-own.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-undefined-own.js
new file mode 100644
index 0000000000..252451eda9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-undefined-own.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj-undefined-own.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is `undefined`, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({ x: { x } } of [{ x: undefined }]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-undefined.js
new file mode 100644
index 0000000000..050c25a20d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-undefined.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj-undefined.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal and the value is not defined, a TypeError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({ x: { x } } of [{}]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-expr.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-expr.js
new file mode 100644
index 0000000000..ab651a62d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-expr.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj-yield-expr.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var iterationResult, iter, x = undefined;
+
+iter = (function*() {
+
+var counter = 0;
+
+for ({ x: { x = yield } } of [{ x: {} }]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}());
+
+iterationResult = iter.next();
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, false);
+assert.sameValue(x, undefined);
+
+iterationResult = iter.next(4);
+
+assert.sameValue(iterationResult.value, undefined);
+assert.sameValue(iterationResult.done, true);
+assert.sameValue(x, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js
new file mode 100644
index 0000000000..34d4925441
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj-yield-ident-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+
+for ({ x: { x = yield } } of [{ x: {} }]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-ident-valid.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-ident-valid.js
new file mode 100644
index 0000000000..2e777bda32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj-yield-ident-valid.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj-yield-ident-valid.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var yield = 2;
+var result, x;
+
+var counter = 0;
+
+for ({ x: { x = yield } } of [{ x: {} }]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj.js
new file mode 100644
index 0000000000..a0bf42f420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-nested-obj.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-nested-obj.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var result, y;
+
+var counter = 0;
+
+for ({ x: { y } } of [{ x: { y: 2 } }]) {
+ assert.sameValue(y, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-const.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-const.js
new file mode 100644
index 0000000000..c4df6acda3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-const.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-put-const.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: The assignment target should obey `const` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [const, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+const c = 1;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({ a: c } of [{ a: 2 }]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-let.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-let.js
new file mode 100644
index 0000000000..e60d8ec97a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-let.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-put-let.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: The assignment target should obey `let` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [let, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ({ a: x } of [{}]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+let x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-order.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-order.js
new file mode 100644
index 0000000000..771ced57d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-order.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-put-order.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The AssignmentElements in an AssignmentElementList are evaluated in left- to-right order. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+
+var counter = 0;
+
+for ({ z: x, a: x } of [{ a: 2, z: 1 }]) {
+ assert.sameValue(x, 2);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref-no-get.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref-no-get.js
new file mode 100644
index 0000000000..e17cb37070
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref-no-get.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-put-prop-ref-no-get.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var setValue;
+var x = {
+ get y() {
+ throw new Test262Error('The property should not be accessed.');
+ },
+ set y(val) {
+ setValue = val;
+ }
+};
+
+var counter = 0;
+
+for ({ a: x.y } of [{ a: 23 }]) {
+ assert.sameValue(setValue, 23);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref-user-err.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref-user-err.js
new file mode 100644
index 0000000000..cc2ae08add
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref-user-err.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-put-prop-ref-user-err.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Any error raised as a result of setting the value should be forwarded to the runtime. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = {
+ set y(val) {
+ throw new Test262Error();
+ }
+};
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ({ a: x.y } of [{ a: 23 }]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref.js
new file mode 100644
index 0000000000..346f16d0eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-prop-ref.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-put-prop-ref.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x = {};
+
+var counter = 0;
+
+for ({ xy: x.y } of [{ xy: 4 }]) {
+ assert.sameValue(x.y, 4);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-unresolvable-no-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-unresolvable-no-strict.js
new file mode 100644
index 0000000000..e19b7538f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-unresolvable-no-strict.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-put-unresolvable-no-strict.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, noStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+{
+
+var counter = 0;
+
+for ({ x: unresolvable } of [{}]) {
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+}
+
+assert.sameValue(unresolvable, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-unresolvable-strict-strict.js
new file mode 100644
index 0000000000..90991b923c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-prop-put-unresolvable-strict-strict.js
@@ -0,0 +1,40 @@
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-prop-put-unresolvable-strict.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated, onlyStrict]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+
+var counter = 0;
+
+assert.throws(ReferenceError, function() {
+ for ({ x: unresolvable } of [{}]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-computed-property-no-strict.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-computed-property-no-strict.js
new file mode 100644
index 0000000000..4aa57feee7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-computed-property-no-strict.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-computed-property-no-strict.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Destructuring field can be a computed property, i.e it can be defined only at runtime. Rest operantion needs to skip these properties as well. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated, noStrict]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a = "foo";
+
+var counter = 0;
+
+for ({[a]:b, ...rest} of [{ foo: 1, bar: 2, baz: 3 }]) {
+ assert.sameValue(b, 1);
+ assert.sameValue(rest.bar, 2);
+ assert.sameValue(rest.baz, 3);
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "foo"), undefined);
+
+ verifyProperty(rest, "bar", {
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ verifyProperty(rest, "baz", {
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-computed-property.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-computed-property.js
new file mode 100644
index 0000000000..91efd46098
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-computed-property.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-computed-property.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Destructuring field can be a computed property, i.e it can be defined only at runtime. Rest operantion needs to skip these properties as well. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a = "foo";
+var b, rest;
+
+var counter = 0;
+
+for ({[a]:b, ...rest} of [{ foo: 1, bar: 2, baz: 3 }]) {
+ assert.sameValue(b, 1);
+ assert.sameValue(rest.bar, 2);
+ assert.sameValue(rest.baz, 3);
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "foo"), undefined);
+
+ verifyProperty(rest, "bar", {
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ verifyProperty(rest, "baz", {
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-descriptors.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-descriptors.js
new file mode 100644
index 0000000000..155d66471e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-descriptors.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-descriptors.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Object created from rest deconstruction doesn't copy source object property descriptors. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest;
+var obj = {};
+Object.defineProperty(obj, "a", { value: 3, configurable: false, enumerable: true });
+Object.defineProperty(obj, "b", { value: 4, writable: false, enumerable: true });
+
+var counter = 0;
+
+for ({...rest} of [obj]) {
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-empty-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-empty-obj.js
new file mode 100644
index 0000000000..9b8df060f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-empty-obj.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-empty-obj.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: RestBindingInitialization creates a new object even if lhs is an empty object (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest;
+
+
+var counter = 0;
+
+for ({...rest} of [{}]) {
+ assert.notSameValue(rest, undefined);
+ assert.notSameValue(rest, null);
+ assert.sameValue(typeof rest, "object");
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-getter-abrupt-get-error.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-getter-abrupt-get-error.js
new file mode 100644
index 0000000000..2ded1386e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-getter-abrupt-get-error.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-getter-abrupt-get-error.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: Rest deconstruction doesn't happen if getter return is abrupt (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+var count = 0;
+
+var counter = 0;
+
+assert.throws(Test262Error, function() {
+ for ({...x} of [{ get v() { count++; throw new Test262Error(); } }]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+assert.sameValue(count, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-getter.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-getter.js
new file mode 100644
index 0000000000..cbef6499a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-getter.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-getter.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var x;
+var count = 0;
+
+var counter = 0;
+
+for ({...x} of [{ get v() { count++; return 2; } }]) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1.js
new file mode 100644
index 0000000000..e792320e89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-non-string-computed-property-1.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a = 1.;
+var b, rest;
+
+var counter = 0;
+
+for ({[a]:b, ...rest} of [{[a]: 1, bar: 2 }]) {
+ assert.sameValue(b, 1);
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined);
+
+ verifyProperty(rest, "bar", {
+ value: 2,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1dot.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1dot.js
new file mode 100644
index 0000000000..35c257b14c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1dot.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-non-string-computed-property-1dot.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js, propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a = 1.;
+var b, rest;
+
+var counter = 0;
+
+for ({[a]:b, ...rest} of [{[a]: [1], bar: 2 }]) {
+ assert.compareArray(b, [1]);
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined);
+
+ verifyProperty(rest, "bar", {
+ value: 2,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1dot0.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1dot0.js
new file mode 100644
index 0000000000..7860eb4412
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1dot0.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-non-string-computed-property-1dot0.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a = 1.;
+var b, rest;
+
+var counter = 0;
+
+for ({[a]:b, ...rest} of [{[a]: 1.0, bar: 2 }]) {
+ assert.sameValue(b, 1);
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined);
+
+ verifyProperty(rest, "bar", {
+ value: 2,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1e0.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1e0.js
new file mode 100644
index 0000000000..8417f17694
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-1e0.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-non-string-computed-property-1e0.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a = 1.;
+var b, rest;
+
+var counter = 0;
+
+for ({[a]:b, ...rest} of [{[a]: 1e0, bar: 2 }]) {
+ assert.sameValue(b, 1);
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined);
+
+ verifyProperty(rest, "bar", {
+ value: 2,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-array-1.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-array-1.js
new file mode 100644
index 0000000000..17417644d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-array-1.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-non-string-computed-property-array-1.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js, propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a = 1.;
+var b, rest;
+
+var counter = 0;
+
+for ({[a]:b, ...rest} of [{[a]: [1], bar: 2 }]) {
+ assert.compareArray(b, [1]);
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined);
+
+ verifyProperty(rest, "bar", {
+ value: 2,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-array-1e0.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-array-1e0.js
new file mode 100644
index 0000000000..c11cded9aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-array-1e0.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-non-string-computed-property-array-1e0.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js, propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a = 1.;
+var b, rest;
+
+var counter = 0;
+
+for ({[a]:b, ...rest} of [{[a]: [1e0], bar: 2 }]) {
+ assert.compareArray(b, [1]);
+
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined);
+
+ verifyProperty(rest, "bar", {
+ value: 2,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-string-1.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-string-1.js
new file mode 100644
index 0000000000..d3929f611f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-non-string-computed-property-string-1.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-non-string-computed-property-string-1.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var a = 1.;
+var b, rest;
+
+var counter = 0;
+
+for ({[a]:b, ...rest} of [{[a]: "1", bar: 2 }]) {
+ assert.sameValue(b, "1");
+
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined);
+
+ verifyProperty(rest, "bar", {
+ value: 2,
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-not-last-element-invalid.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-not-last-element-invalid.js
new file mode 100644
index 0000000000..775541cf1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-not-last-element-invalid.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-not-last-element-invalid.case
+// - src/dstr-assignment/syntax/for-of.template
+/*---
+description: Object rest element needs to be the last AssignmenProperty in ObjectAssignmentPattern. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+$DONOTEVALUATE();
+var rest, b;
+
+for ({...rest, b} of [{}
+]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-number.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-number.js
new file mode 100644
index 0000000000..1f007579bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-number.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-number.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: RestBindingInitialization creates a new object even if lhs is a Number (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest;
+
+
+var counter = 0;
+
+for ({...rest} of [51]) {
+ assert.notSameValue(rest, undefined);
+ assert.notSameValue(rest, null);
+ assert(rest instanceof Object);
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-order.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-order.js
new file mode 100644
index 0000000000..8b6767c502
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-order.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-order.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Rest operation follows [[OwnPropertyKeys]] order (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol, object-rest, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest;
+var calls = [];
+var o = { get z() { calls.push('z') }, get a() { calls.push('a') } };
+Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true });
+Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true });
+
+var counter = 0;
+
+for ({...rest} of [o]) {
+ assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]);
+ assert.sameValue(Object.keys(rest).length, 3);
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-put-const.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-put-const.js
new file mode 100644
index 0000000000..0ddcc9aadd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-put-const.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-put-const.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: The object rest deconstruction assignment target should obey `const` semantics. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+const rest = null;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({...rest} of [{}
+]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-same-name.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-same-name.js
new file mode 100644
index 0000000000..a51b2c71ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-same-name.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-same-name.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Proper setting in the values for rest name equal to a property name. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var o = {
+ x: 42,
+ y: 39,
+ z: 'cheeseburger'
+};
+
+var x, y, z;
+
+var counter = 0;
+
+for ({ x, ...z } of [o]) {
+ assert.sameValue(x, 42);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z.y, 39);
+ assert.sameValue(z.z, 'cheeseburger');
+
+ var keys = Object.getOwnPropertyNames(z);
+ assert.sameValue(keys.length, 2);
+ assert.sameValue(keys[0], 'y');
+ assert.sameValue(keys[1], 'z');
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..9c0c4e53f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-skip-non-enumerable.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-skip-non-enumerable.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest;
+var obj = {a: 3, b: 4};
+Object.defineProperty(obj, "x", { value: 4, enumerable: false });
+
+var counter = 0;
+
+for ({...rest} of [obj]) {
+ assert.sameValue(Object.getOwnPropertyDescriptor(rest, "x"), undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-str-val.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-str-val.js
new file mode 100644
index 0000000000..e8593e80c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-str-val.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-str-val.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: RestBindingInitialization creats an object with indexes as property name (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest;
+
+
+var counter = 0;
+
+for ({...rest} of ["foo"]) {
+ assert.sameValue(rest["0"], "f");
+ assert.sameValue(rest["1"], "o");
+ assert.sameValue(rest["2"], "o");
+ assert(rest instanceof Object);
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-symbol-val.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-symbol-val.js
new file mode 100644
index 0000000000..1602f40ce1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-symbol-val.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-symbol-val.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: RestBindingInitialization creates a new object if lhs is a Symbol (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol, object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest;
+
+
+var counter = 0;
+
+for ({...rest} of [Symbol("foo")]) {
+ assert.notSameValue(rest, undefined);
+ assert.notSameValue(rest, null);
+ assert(rest instanceof Object);
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-to-property-with-setter.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-to-property-with-setter.js
new file mode 100644
index 0000000000..0ac23409db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-to-property-with-setter.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-to-property-with-setter.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object property setter, its value should be binded as rest object. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var settedValue;
+var executedGetter = false;
+var src = {
+ get y() { executedGetter = true; },
+ set y(v) {
+ settedValue = v;
+ }
+}
+src.y = undefined;
+
+var counter = 0;
+
+for ({...src.y} of [{ x: 1, y: 2}]) {
+ assert.sameValue(settedValue.x, 1);
+ assert.sameValue(settedValue.y, 2);
+ assert(!executedGetter, "The property should not be accessed");
+
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-to-property.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-to-property.js
new file mode 100644
index 0000000000..f04383825c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-to-property.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-to-property.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: When DestructuringAssignmentTarget is an object property, its value should be binded as rest object. (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var src = {};
+
+var counter = 0;
+
+for ({...src.y} of [{ x: 1, y: 2}]) {
+ assert.sameValue(src.y.x, 1);
+ assert.sameValue(src.y.y, 2);
+
+ verifyProperty(src, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-val-null.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-val-null.js
new file mode 100644
index 0000000000..a2509f70ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-val-null.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-val-null.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: TypeError is thrown when rhs is null because of 7.1.13 ToObject ( argument ) used by CopyDataProperties (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({...rest} of [null
+]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-val-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-val-undefined.js
new file mode 100644
index 0000000000..1390ffa8c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-val-undefined.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-val-undefined.case
+// - src/dstr-assignment/error/for-of.template
+/*---
+description: TypeError is thrown when rhs is ```undefined``` because of 7.1.13 ToObject ( argument ) used by CopyDataProperties (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest;
+
+var counter = 0;
+
+assert.throws(TypeError, function() {
+ for ({...rest} of [undefined
+]) {
+ counter += 1;
+ }
+ counter += 1;
+});
+
+assert.sameValue(counter, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-valid-object.js b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-valid-object.js
new file mode 100644
index 0000000000..ef2b94d0ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/obj-rest-valid-object.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-assignment/obj-rest-valid-object.case
+// - src/dstr-assignment/default/for-of.template
+/*---
+description: Rest object contains just unextracted data (For..of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
+ AssignmentExpression, iterate).
+ 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
+ keyResult, assignment, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 4. If destructuring is true and if lhsKind is assignment, then
+ a. Assert: lhs is a LeftHandSideExpression.
+ b. Let assignmentPattern be the parse of the source text corresponding to
+ lhs using AssignmentPattern as the goal symbol.
+ [...]
+---*/
+var rest, a, b;
+
+
+var counter = 0;
+
+for ({a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ counter += 1;
+}
+
+assert.sameValue(counter, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/shell.js b/js/src/tests/test262/language/statements/for-of/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-close.js
new file mode 100644
index 0000000000..d3f0dfb328
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-close.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [x] of [iter]) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..9677bf06a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Abrupt completion returned by GetIterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ for (var [x, y, z] of [[1, 2, 3]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..f0346537ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-get-err.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Abrupt completion returned by GetIterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ for (var [x] of [iter]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..94ecd846d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-init-iter-no-close.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [x] of [iter]) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-name-iter-val.js
new file mode 100644
index 0000000000..8541f8ba15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-name-iter-val.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: SingleNameBinding with normal value iteration (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..e436b89a97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [[x, y, z] = [4, 5, 6]] of [[]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..610d4adb76
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..084451edc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [[,] = g()] of [[]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..2ad18591b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [[,] = g()] of [[[]]]) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..048e325a0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [[] = function() { initCount += 1; return iter; }()] of [[]]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..93d9bbf8d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [[] = function() { initCount += 1; }()] of [[[23]]]) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..7cf152aead
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..1c2e600c19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..9ad7b4bf02
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Nested array destructuring with a null value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var [[x]] of [[null]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..fb414ef378
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Destructuring initializer with an exhausted iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [x = 23] of [[]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..e9e4b06253
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,60 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [arrow = () => {}] of [[]]) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..3c3f837137
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,62 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..d9aa65af14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,61 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [cover = (function () {}), xCover = (0, function() {})] of [[]]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..fda2eb92cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,61 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [fn = function () {}, xFn = function x() {}] of [[]]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..aff711e0a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,62 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [gen = function* () {}, xGen = function* x() {}] of [[]]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..912d08c43e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Destructuring initializer with a "hole" (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [x = 23] of [[,]]) {
+ assert.sameValue(x, 23);
+ // another statement
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..c6c0dea8a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..87515760c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Destructuring initializer returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ for (var [x = (function() { throw new Test262Error(); })()] of [[undefined]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..037cbc91a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Destructuring initializer with an undefined value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [x = 23] of [[undefined]]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..54ad3a10ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (var [ x = unresolvableReference ] of [[]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..0b3349f91f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: SingleNameBinding when value iteration completes (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..cbfae7148d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [_, x] of [[]]) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..919712dde1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var [x] of [g]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..7bc52580ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var iterCount = 0;
+
+for (var [x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..ff562dc6b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var [x] of [g]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..e85402c55f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [x, y, z] of [[1, 2, 3]]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..54993d3226
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..ac5579dfa9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..ec4268c041
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,70 @@
+// 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-of-var.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..7e2679764d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..2d60795965
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Nested object destructuring with a null value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var [{ x }] of [[null]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..20784131d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Nested object destructuring with a value of `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var [{ x }] of [[]]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..89d53d7e2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Elision accepts exhausted iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [,] of [iter]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..b3bafbb48b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding/iter-close/for-of-var.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (var [,] of [iter]) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..472c07b379
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision-step-err.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (var [,] of [iter]) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision.js
new file mode 100644
index 0000000000..825866ae24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-elision.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Elision advances iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [,] of [g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-empty.js
new file mode 100644
index 0000000000..5f231ae680
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-empty.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [] of [iter]) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-init-err.js
new file mode 100644
index 0000000000..c46e67f5cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-init-err.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForBinding position.
+info: |
+ IterationStatement:
+ for (var ForBinding of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var [x] = 1 of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..796759d802
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element containing an array BindingElementList pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [...[x, y, z]] of [[3, 4, 5]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..ab25275749
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element containing an elision (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [...[,]] of [g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..8888d31dde
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element containing an "empty" array pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [...[]] of [iter]) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..25a6d7b401
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element containing a rest element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..91ada24c57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Lone rest element (direct binding) (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var iterCount = 0;
+
+for (var [...x] of [[1]]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..35e56ada55
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Rest element following elision elements (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ for (var [, ...x] of [iter]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..171d45bd62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element following elision elements (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..da5af0d7cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: RestElement applied to an exhausted iterator (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [, , ...x] of [[1, 2]]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..dbff7e55b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding/iter-close/for-of-var.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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.
+ [...]
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (var [...x] of [iter]) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..d243017b82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (var [...x] of [iter]) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..4ef4dd47cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var [...x] of [iter]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..26f87e48ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-id.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Lone rest element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..f1e04d9601
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,55 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...[ x ] = []] of [[]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..fd2ac5b50e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-id.js
@@ -0,0 +1,55 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element (identifier) does not support initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...x = []] of [[]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..233d21059e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,55 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...{ x } = []] of [[]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..e86e6dcb97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,55 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...[x], y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..e1d647b8d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,55 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element (identifier) may not be followed by any element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...x, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..cbc74de10d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,55 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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 ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...{ x }, y] of [[1, 2, 3]]) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..01b6daecdd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element containing an object binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var [...{ length }] of [[1, 2, 3]]) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..477f4c5e9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Rest element containing an object binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+
+for (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.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-init-null.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-init-null.js
new file mode 100644
index 0000000000..f000d07a54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-init-null.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var {} of [null]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-init-undefined.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-init-undefined.js
new file mode 100644
index 0000000000..3b94ad21fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-init-undefined.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var {} of [undefined]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-empty.js
new file mode 100644
index 0000000000..53508700b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-empty.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var {} of [obj]) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..1fc9af43c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (var { poisoned } of [poisonedProperty]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..05332ad39b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,59 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var { arrow = () => {} } of [{}]) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..7f8cce3325
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,61 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..b2c855f183
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,60 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var { cover = (function () {}), xCover = (0, function() {}) } of [{}]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..98b78fd411
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,60 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var { fn = function () {}, xFn = function x() {} } of [{}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..6f7ee71468
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,61 @@
+// 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-of-var.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var { gen = function* () {}, xGen = function* x() {} } of [{}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..b7af3e4968
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..d6cfe57116
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-throws.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Error thrown when evaluating the initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (var { x = thrower() } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..273fc8422f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (var { x = unresolvableReference } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..0f8c247d2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var { x, } of [{ x: 23 }]) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-init-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-init-err.js
new file mode 100644
index 0000000000..6d912b28a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-init-err.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForBinding position.
+info: |
+ IterationStatement:
+ for (var ForBinding of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var {x} = 1 of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..c9534bd7d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-list-err.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (var { a, b = thrower(), c = ++initCount } of [{}]) {
+ return;
+ }
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..25ad8096dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..ede1ac1210
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var { x: [y], } of [{ x: [45] }]) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..1ffcf14f73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (var { w: [x, y, z] = [4, 5, 6] } of [{ w: null }]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..a6ddc5865a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-ary.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..527d6303a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Evaluation of property name returns an abrupt completion (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (var { [thrower()]: x } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..ca4c6e44a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (var { poisoned: x = ++initEvalCount } of [poisonedProperty]) {
+ return;
+ }
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..d6cb0f7c9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..d732cee124
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Error thrown when evaluating the initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (var { x: y = thrower() } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..11550ff952
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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
+ a. Let defaultValue be the result of evaluating Initializer.
+ b. Let v be GetValue(defaultValue).
+ c. ReturnIfAbrupt(v).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (var { x: y = unresolvableReference } of [{}]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..d8edc4fcdd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-init.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var { x: y = 33 } of [{ }]) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..e8c9fbaff1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var { x: y, } of [{ x: 23 }]) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..fbfb842c58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-id.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Binding as specified via property name and identifier (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var { x: y } of [{ x: 23 }]) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..6b148f8351
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..4f5578046f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } of [{ w: null }]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..1816ef51ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/for-of-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (var { w: { x, y, z } = undefined } of [{ }]) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..38214fd142
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-prop-obj.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..a45a39a69b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-getter.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/for-of-var.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var {...x} of [{ get v() { count++; return 2; } }]) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..27820d5b91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/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-of-var.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var {...rest} of [o]) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for-of/dstr/var-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..b0cec431bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/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-of-var.template
+/*---
+description: Rest object contains just unextracted data (for-of statement)
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+
+ [...]
+ 3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
+ varBinding, labelSet).
+
+ 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;
+
+for (var {a, b, ...rest} of [{x: 1, y: 2, a: 5, b: 3}]) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/escaped-of.js b/js/src/tests/test262/language/statements/for-of/escaped-of.js
new file mode 100644
index 0000000000..6544e04603
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/escaped-of.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-grammar-notation
+description: >
+ The `of` contextual keyword must not contain Unicode escape sequences.
+info: |
+ Terminal symbols are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x o\u0066 []) ;
diff --git a/js/src/tests/test262/language/statements/for-of/float32array-mutate.js b/js/src/tests/test262/language/statements/for-of/float32array-mutate.js
new file mode 100644
index 0000000000..08de44b6fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/float32array-mutate.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Float32Array mutation during traversal using for..of
+info: |
+ Float32Array instances should be able to be traversed using a `for..of`
+ loop, and dynamic changes to their contents should be reflected in the
+ iterated values.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Float32Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 64;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ array[1] = 64;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/float32array.js b/js/src/tests/test262/language/statements/for-of/float32array.js
new file mode 100644
index 0000000000..71555e9ecd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/float32array.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Float32Array traversal using for..of
+info: |
+ Float32Array instances should be able to be traversed using a `for..of`
+ loop.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Float32Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 2;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/float64array-mutate.js b/js/src/tests/test262/language/statements/for-of/float64array-mutate.js
new file mode 100644
index 0000000000..2b88e4687d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/float64array-mutate.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Float64Array mutation during traversal using for..of
+info: |
+ Float64Array instances should be able to be traversed using a `for..of`
+ loop, and dynamic changes to their contents should be reflected in the
+ iterated values.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Float64Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 64;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ array[1] = 64;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/float64array.js b/js/src/tests/test262/language/statements/for-of/float64array.js
new file mode 100644
index 0000000000..82c4115661
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/float64array.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Float64Array traversal using for..of
+info: |
+ Float64Array instances should be able to be traversed using a `for..of`
+ loop.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Float64Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 2;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/generator-close-via-break.js b/js/src/tests/test262/language/statements/for-of/generator-close-via-break.js
new file mode 100644
index 0000000000..7548f0fccd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/generator-close-via-break.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Generators should be closed via their `return` method when iteration is
+ interrupted via a `break` statement.
+features: [generators]
+---*/
+
+var startedCount = 0;
+var finallyCount = 0;
+var iterationCount = 0;
+function* values() {
+ startedCount += 1;
+ try {
+ yield;
+ throw new Test262Error('This code is unreachable (within `try` block)');
+ } finally {
+ finallyCount += 1;
+ }
+ throw new Test262Error('This code is unreachable (following `try` statement)');
+}
+var iterable = values();
+
+assert.sameValue(
+ startedCount, 0, 'Generator is initialized in suspended state'
+);
+
+for (var x of iterable) {
+ assert.sameValue(
+ startedCount, 1, 'Generator executes prior to first iteration'
+ );
+ assert.sameValue(
+ finallyCount, 0, 'Generator is paused during first iteration'
+ );
+ iterationCount += 1;
+ break;
+}
+
+assert.sameValue(
+ startedCount, 1, 'Generator does not restart following interruption'
+);
+assert.sameValue(iterationCount, 1, 'A single iteration occurs');
+assert.sameValue(
+ finallyCount, 1, 'Generator is closed after `break` statement'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/generator-close-via-continue.js b/js/src/tests/test262/language/statements/for-of/generator-close-via-continue.js
new file mode 100644
index 0000000000..8e6088fca7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/generator-close-via-continue.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset
+description: >
+ Generators should be closed via their `return` method when iteration is
+ interrupted via a `continue` statement.
+info: |
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation ( lhs, stmt, iteratorRecord, iterationKind, lhsKind, labelSet )
+ ...
+ 5. Repeat,
+ ...
+ i. Let result be the result of evaluating stmt.
+ ...
+ k. If LoopContinues(result, labelSet) is false, then
+ i. If iterationKind is enumerate, then
+ ...
+ ii. Else,
+ 1. Assert: iterationKind is iterate.
+ 2. Return ? IteratorClose(iteratorRecord, UpdateEmpty(result, V)).
+ ...
+
+features: [generators]
+---*/
+
+var startedCount = 0;
+var finallyCount = 0;
+var iterationCount = 0;
+function* values() {
+ startedCount += 1;
+ try {
+ yield;
+ throw new Test262Error('This code is unreachable (within `try` block)');
+ } finally {
+ finallyCount += 1;
+ }
+ throw new Test262Error('This code is unreachable (following `try` statement)');
+}
+var iterable = values();
+
+assert.sameValue(
+ startedCount, 0, 'Generator is initialized in suspended state'
+);
+
+L: do {
+ for (var x of iterable) {
+ assert.sameValue(
+ startedCount, 1, 'Generator executes prior to first iteration'
+ );
+ assert.sameValue(
+ finallyCount, 0, 'Generator is paused during first iteration'
+ );
+ iterationCount += 1;
+ continue L;
+ }
+} while (false);
+
+assert.sameValue(
+ startedCount, 1, 'Generator does not restart following interruption'
+);
+assert.sameValue(iterationCount, 1, 'A single iteration occurs');
+assert.sameValue(
+ finallyCount, 1, 'Generator is closed after `continue` statement'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/generator-close-via-return.js b/js/src/tests/test262/language/statements/for-of/generator-close-via-return.js
new file mode 100644
index 0000000000..93ad8963ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/generator-close-via-return.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Generators should be closed via their `return` method when iteration is
+ interrupted via a `return` statement.
+features: [generators]
+---*/
+
+var startedCount = 0;
+var finallyCount = 0;
+var iterationCount = 0;
+function* values() {
+ startedCount += 1;
+ try {
+ yield;
+ throw new Test262Error('This code is unreachable (within `try` block)');
+ } finally {
+ finallyCount += 1;
+ }
+ throw new Test262Error('This code is unreachable (following `try` statement)');
+}
+var iterable = values();
+
+assert.sameValue(
+ startedCount, 0, 'Generator is initialized in suspended state'
+);
+
+(function() {
+ for (var x of iterable) {
+ assert.sameValue(
+ startedCount, 1, 'Generator executes prior to first iteration'
+ );
+ assert.sameValue(
+ finallyCount, 0, 'Generator is paused during first iteration'
+ );
+ iterationCount += 1;
+ return;
+ }
+}());
+
+assert.sameValue(
+ startedCount, 1, 'Generator does not restart following interruption'
+);
+assert.sameValue(iterationCount, 1, 'A single iteration occurs');
+assert.sameValue(
+ finallyCount, 1, 'Generator is closed after `return` statement'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/generator-close-via-throw.js b/js/src/tests/test262/language/statements/for-of/generator-close-via-throw.js
new file mode 100644
index 0000000000..0b5c83cb3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/generator-close-via-throw.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Generators should be closed via their `return` method when iteration is
+ interrupted via a `throw` statement.
+features: [generators]
+---*/
+
+var startedCount = 0;
+var finallyCount = 0;
+var iterationCount = 0;
+function* values() {
+ startedCount += 1;
+ try {
+ yield;
+ throw new Test262Error('This code is unreachable (within `try` block)');
+ } finally {
+ finallyCount += 1;
+ }
+ throw new Test262Error('This code is unreachable (following `try` statement)');
+}
+var iterable = values();
+
+assert.sameValue(
+ startedCount, 0, 'Generator is initialized in suspended state'
+);
+
+try {
+ for (var x of iterable) {
+ assert.sameValue(
+ startedCount, 1, 'Generator executes prior to first iteration'
+ );
+ assert.sameValue(
+ finallyCount, 0, 'Generator is paused during first iteration'
+ );
+ iterationCount += 1;
+ throw 0;
+ }
+} catch(err) {}
+
+assert.sameValue(
+ startedCount, 1, 'Generator does not restart following interruption'
+);
+assert.sameValue(iterationCount, 1, 'A single iteration occurs');
+assert.sameValue(
+ finallyCount, 1, 'Generator is closed after `throw` statement'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/generator-next-error.js b/js/src/tests/test262/language/statements/for-of/generator-next-error.js
new file mode 100644
index 0000000000..178b6ca22a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/generator-next-error.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.g
+description: >
+ If `nextResult` is an abrupt completion as per IteratorStep (ES6 7.4.5),
+ return the completion.
+features: [generators]
+---*/
+
+var iterable = (function*() {
+ throw new Test262Error();
+}());
+var iterationCount = 0;
+
+assert.throws(Test262Error, function() {
+ for (var x of iterable) {
+ iterationCount += 1;
+ }
+});
+
+assert.sameValue(iterationCount, 0, 'The loop body is not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/generator.js b/js/src/tests/test262/language/statements/for-of/generator.js
new file mode 100644
index 0000000000..9e9029864e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/generator.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Generator function should return valid iterable objects.
+features: [generators]
+---*/
+
+function* values() {
+ yield 2;
+ yield 4;
+ yield 8;
+}
+var iterable = values();
+var expected = [2, 4, 8];
+var i = 0;
+
+for (var x of iterable) {
+ assert.sameValue(x, expected[i]);
+ i++;
+}
+
+assert.sameValue(i, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/generic-iterable.js b/js/src/tests/test262/language/statements/for-of/generic-iterable.js
new file mode 100644
index 0000000000..8787060dcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/generic-iterable.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Generic objects with `@@iterator` protocols should function as iterables.
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ var j = 0;
+ return {
+ next: function() {
+ j = j + 2;
+ return { value: j, done: j === 8 };
+ }
+ }
+};
+var expected = [2, 4, 6];
+var i = 0;
+
+for (var x of iterable) {
+ assert.sameValue(x, expected[i]);
+ i++;
+}
+
+assert.sameValue(i, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-const-bound-names-dup.js b/js/src/tests/test262/language/statements/for-of/head-const-bound-names-dup.js
new file mode 100644
index 0000000000..dac34945b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-const-bound-names-dup.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The head's declaration may not contain duplicate entries
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if the BoundNames of ForDeclaration contains any
+ duplicate entries.
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (const [x, x] of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-const-bound-names-fordecl-tdz.js b/js/src/tests/test262/language/statements/for-of/head-const-bound-names-fordecl-tdz.js
new file mode 100644
index 0000000000..db87ea84d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-const-bound-names-fordecl-tdz.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.12_S2
+description: >
+ ForIn/Of: Bound names of ForDeclaration are in TDZ (for-of)
+---*/
+
+assert.throws(ReferenceError, function() {
+ let x = 1;
+ for (const x of [x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-const-bound-names-in-stmt.js b/js/src/tests/test262/language/statements/for-of/head-const-bound-names-in-stmt.js
new file mode 100644
index 0000000000..709f942812
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-const-bound-names-in-stmt.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The body may not re-declare variables declared in the head
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if any element of the BoundNames of ForDeclaration
+ also occurs in the VarDeclaredNames of Statement.
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (const x of []) {
+ var x;
+}
diff --git a/js/src/tests/test262/language/statements/for-of/head-const-bound-names-let.js b/js/src/tests/test262/language/statements/for-of/head-const-bound-names-let.js
new file mode 100644
index 0000000000..0cc7d7f69d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-const-bound-names-let.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The declaration may not contain a binding for `let`
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if the BoundNames of ForDeclaration contains "let".
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+for (const let of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-const-fresh-binding-per-iteration.js b/js/src/tests/test262/language/statements/for-of/head-const-fresh-binding-per-iteration.js
new file mode 100644
index 0000000000..6e71d31904
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-const-fresh-binding-per-iteration.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ const ForDeclaration: creates a fresh binding per iteration
+---*/
+
+let s = 0;
+let f = [undefined, undefined, undefined];
+
+for (const x of [1, 2, 3]) {
+ s += x;
+ f[x-1] = function() { return x; }
+}
+assert.sameValue(s, 6, "The value of `s` is `6`");
+assert.sameValue(f[0](), 1, "`f[0]()` returns `1`");
+assert.sameValue(f[1](), 2, "`f[1]()` returns `2`");
+assert.sameValue(f[2](), 3, "`f[2]()` returns `3`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-const-init.js b/js/src/tests/test262/language/statements/for-of/head-const-init.js
new file mode 100644
index 0000000000..add93cf2df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-const-init.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (const x = 1 of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-decl-no-expr.js b/js/src/tests/test262/language/statements/for-of/head-decl-no-expr.js
new file mode 100644
index 0000000000..0c87d9f38c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-decl-no-expr.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Expression not allowed in head's AssignmentExpression position
+info: |
+ IterationStatement :
+ for ( ForDeclaration of AssignmentExpression ) Statement
+es6id: 13.7
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (let x of [], []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-expr-no-expr.js b/js/src/tests/test262/language/statements/for-of/head-expr-no-expr.js
new file mode 100644
index 0000000000..1eaee5c3cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-expr-no-expr.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Expression not allowed in head's AssignmentExpression position
+info: |
+ IterationStatement :
+ for ( LeftHandSideExpression of AssignmentExpression ) Statement
+es6id: 13.7
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var x;
+for (x of [], []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-expr-obj-iterator-method.js b/js/src/tests/test262/language/statements/for-of/head-expr-obj-iterator-method.js
new file mode 100644
index 0000000000..f154ee03ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-expr-obj-iterator-method.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.12 S8.b
+description: >
+ The value of the expression in a for-of statement's head must have an
+ `@@iterator` method.
+---*/
+var x;
+
+assert.throws(TypeError, function() {
+ for (x of {}) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-expr-primitive-iterator-method.js b/js/src/tests/test262/language/statements/for-of/head-expr-primitive-iterator-method.js
new file mode 100644
index 0000000000..3326899d4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-expr-primitive-iterator-method.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.12 S8.b
+description: >
+ The value of the expression in a for-of statement's head must have an
+ `@@iterator` method.
+---*/
+var x;
+
+assert.throws(TypeError, function() {
+ for (x of false) {}
+});
+
+assert.throws(TypeError, function() {
+ for (x of 37) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-expr-to-obj.js b/js/src/tests/test262/language/statements/for-of/head-expr-to-obj.js
new file mode 100644
index 0000000000..c099d8514e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-expr-to-obj.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.12 S8.b
+description: >
+ The value of the expression in a for-of statement's head is subject to the
+ semantics of the ToObject abstract operation.
+---*/
+var x;
+
+assert.throws(TypeError, function() {
+ for (x of null) {}
+});
+
+assert.throws(TypeError, function() {
+ for (x of undefined) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-let-bound-names-dup.js b/js/src/tests/test262/language/statements/for-of/head-let-bound-names-dup.js
new file mode 100644
index 0000000000..6ba5438e46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-let-bound-names-dup.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The head's declaration may not contain duplicate entries
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if the BoundNames of ForDeclaration contains any
+ duplicate entries.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (let [x, x] of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-let-bound-names-fordecl-tdz.js b/js/src/tests/test262/language/statements/for-of/head-let-bound-names-fordecl-tdz.js
new file mode 100644
index 0000000000..f10b0aee99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-let-bound-names-fordecl-tdz.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.12_S2
+description: >
+ ForIn/Of: Bound names of ForDeclaration are in TDZ (for-of)
+---*/
+
+assert.throws(ReferenceError, function() {
+ let x = 1;
+ for (let x of [x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-let-bound-names-in-stmt.js b/js/src/tests/test262/language/statements/for-of/head-let-bound-names-in-stmt.js
new file mode 100644
index 0000000000..d369c7500a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-let-bound-names-in-stmt.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The body may not re-declare variables declared in the head
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if any element of the BoundNames of ForDeclaration
+ also occurs in the VarDeclaredNames of Statement.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (let x of []) {
+ var x;
+}
diff --git a/js/src/tests/test262/language/statements/for-of/head-let-bound-names-let.js b/js/src/tests/test262/language/statements/for-of/head-let-bound-names-let.js
new file mode 100644
index 0000000000..a655ce474b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-let-bound-names-let.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The declaration may not contain a binding for `let`
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ It is a Syntax Error if the BoundNames of ForDeclaration contains "let".
+flags: [noStrict]
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+---*/
+
+$DONOTEVALUATE();
+
+for (let let of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-let-destructuring.js b/js/src/tests/test262/language/statements/for-of/head-let-destructuring.js
new file mode 100644
index 0000000000..38a486c702
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-let-destructuring.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+description: >
+ The token sequence `let [`is interpreted as the beginning of a destructuring
+ binding pattern
+info: |
+ Syntax
+
+ IterationStatement[Yield, Return]:
+
+ for ( [lookahead ≠ let]LeftHandSideExpression[?Yield] of
+ AssignmentExpression[+In, ?Yield] ) Statement[?Yield, ?Return]
+
+ for ( ForDeclaration[?Yield] of AssignmentExpression[+In, ?Yield] )
+ Statement[?Yield, ?Return]
+---*/
+
+var value;
+
+for ( let[x] of [[34]] ) {
+ value = x;
+}
+
+assert.sameValue(typeof x, 'undefined', 'binding is block-scoped');
+assert.sameValue(value, 34);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-let-fresh-binding-per-iteration.js b/js/src/tests/test262/language/statements/for-of/head-let-fresh-binding-per-iteration.js
new file mode 100644
index 0000000000..63fa65a902
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-let-fresh-binding-per-iteration.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ let ForDeclaration: creates a fresh binding per iteration
+---*/
+
+let s = 0;
+let f = [undefined, undefined, undefined];
+
+for (let x of [1, 2, 3]) {
+ s += x;
+ f[x-1] = function() { return x; }
+}
+assert.sameValue(s, 6, "The value of `s` is `6`");
+assert.sameValue(f[0](), 1, "`f[0]()` returns `1`");
+assert.sameValue(f[1](), 2, "`f[1]()` returns `2`");
+assert.sameValue(f[2](), 3, "`f[2]()` returns `3`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-let-init.js b/js/src/tests/test262/language/statements/for-of/head-let-init.js
new file mode 100644
index 0000000000..12c5474626
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-let-init.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForDeclaration position.
+info: |
+ IterationStatement:
+ for (ForDeclaration of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (let x = 1 of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-async-dot.js b/js/src/tests/test262/language/statements/for-of/head-lhs-async-dot.js
new file mode 100644
index 0000000000..17df347635
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-async-dot.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2021 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: leading `async` token in for-of LHS
+info: |
+ The `async` token is allowed in the LHS if not followed by `of`
+esid: sec-for-in-and-for-of-statements
+---*/
+
+var async = { x: 0 };
+
+for (async.x of [1]) ;
+
+assert.sameValue(async.x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-async-escaped.js b/js/src/tests/test262/language/statements/for-of/head-lhs-async-escaped.js
new file mode 100644
index 0000000000..1ca7a75819
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-async-escaped.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 Stuart Cook. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ The left-hand-side of a for-of loop may be the identifier `async` written
+ with an escape sequence.
+info: |
+ ForInOfStatement[Yield, Await, Return] :
+ for ( [lookahead ∉ { let, async of }] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+---*/
+
+let async;
+
+for (\u0061sync of [7]);
+
+assert.sameValue(async, 7);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-async-invalid.js b/js/src/tests/test262/language/statements/for-of/head-lhs-async-invalid.js
new file mode 100644
index 0000000000..3d8d10bec5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-async-invalid.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: leading `async` token in for-of LHS
+info: |
+ The `async` token is disallowed in the LHS when followed by `of`
+esid: sec-for-in-and-for-of-statements
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var async;
+for (async of [1]) ;
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-async-parens.js b/js/src/tests/test262/language/statements/for-of/head-lhs-async-parens.js
new file mode 100644
index 0000000000..34eb4bd373
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-async-parens.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 Stuart Cook. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ The left-hand-side of a for-of loop may be the identifier `async`
+ surrounded by parentheses.
+info: |
+ ForInOfStatement[Yield, Await, Return] :
+ for ( [lookahead ∉ { let, async of }] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+---*/
+
+let async;
+
+for ((async) of [7]);
+
+assert.sameValue(async, 7);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-cover-non-asnmt-trgt.js b/js/src/tests/test262/language/statements/for-of/head-lhs-cover-non-asnmt-trgt.js
new file mode 100644
index 0000000000..2806eb1eaf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-cover-non-asnmt-trgt.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Head's LeftHandSideExpression must be a simple assignment target
+info: |
+ It is a Syntax Error if IsValidSimpleAssignmentTarget of
+ LeftHandSideExpression is false.
+
+ It is a Syntax Error if the LeftHandSideExpression is
+ CoverParenthesizedExpressionAndArrowParameterList : ( Expression ) and
+ Expression derives a production that would produce a Syntax Error according
+ to these rules if that production is substituted for
+ LeftHandSideExpression. This rule is recursively applied.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ((this) of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-cover.js b/js/src/tests/test262/language/statements/for-of/head-lhs-cover.js
new file mode 100644
index 0000000000..49858e3dc0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-cover.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Head's AssignmentExpression may be CoverParenthesizedExpressionAndArrowParameterList
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+var iterCount = 0;
+var x;
+
+for ((x) of [23]) {
+ assert.sameValue(x, 23);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-ary.js b/js/src/tests/test262/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-ary.js
new file mode 100644
index 0000000000..830700bec8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-ary.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Invalid destructuring assignment pattern (array literal)
+info: |
+ It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral
+ or an ArrayLiteral and if the lexical token sequence matched by
+ LeftHandSideExpression cannot be parsed with no tokens left over using
+ AssignmentPattern as the goal symbol.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ([(x, y)] of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-obj.js b/js/src/tests/test262/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-obj.js
new file mode 100644
index 0000000000..2c212c6c8c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-invalid-asnmt-ptrn-obj.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Invalid destructuring assignment pattern (object literal)
+info: |
+ It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral
+ or an ArrayLiteral and if the lexical token sequence matched by
+ LeftHandSideExpression cannot be parsed with no tokens left over using
+ AssignmentPattern as the goal symbol.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ({ m() {} } of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-let.js b/js/src/tests/test262/language/statements/for-of/head-lhs-let.js
new file mode 100644
index 0000000000..9872264ab4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-let.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements
+es6id: 13.7.5
+description: >
+ The `let` token is disallowed when not followed by a `[` token
+info: |
+ Syntax
+
+ IterationStatement[Yield, Return]:
+
+ for ( [lookahead ≠ let]LeftHandSideExpression[?Yield] of
+ AssignmentExpression[+In, ?Yield] ) Statement[?Yield, ?Return]
+
+ for ( ForDeclaration[?Yield] of AssignmentExpression[+In, ?Yield] )
+ Statement[?Yield, ?Return]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ( let of [] ) ;
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-member.js b/js/src/tests/test262/language/statements/for-of/head-lhs-member.js
new file mode 100644
index 0000000000..5b856d14cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-member.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Head's AssignmentExpression may be a MemberExpression
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+var iterCount = 0;
+var x = {};
+
+for (x.y of [23]) {
+ assert.sameValue(x.y, 23);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-lhs-non-asnmt-trgt.js b/js/src/tests/test262/language/statements/for-of/head-lhs-non-asnmt-trgt.js
new file mode 100644
index 0000000000..718bf845bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-lhs-non-asnmt-trgt.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Head's LeftHandSideExpression must be a simple assignment target
+info: |
+ It is a Syntax Error if IsValidSimpleAssignmentTarget of
+ LeftHandSideExpression is false.
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (this of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-var-bound-names-dup.js b/js/src/tests/test262/language/statements/for-of/head-var-bound-names-dup.js
new file mode 100644
index 0000000000..a7b14d9bba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-var-bound-names-dup.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: The head's declaration may contain duplicate entries
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+var iterCount = 0;
+
+for (var [x, x] of [[1, 2]]) {
+ assert.sameValue(x, 2);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-var-bound-names-in-stmt.js b/js/src/tests/test262/language/statements/for-of/head-var-bound-names-in-stmt.js
new file mode 100644
index 0000000000..2802adff96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-var-bound-names-in-stmt.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The body may re-declare variables declared in the head
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+---*/
+
+var iterCount = 0;
+
+for (var x of [99]) {
+ var x;
+
+ assert.sameValue(x, 99);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-var-bound-names-let.js b/js/src/tests/test262/language/statements/for-of/head-var-bound-names-let.js
new file mode 100644
index 0000000000..b81e65bb9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-var-bound-names-let.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: The head's bound names may include "let"
+esid: sec-for-in-and-for-of-statements-static-semantics-early-errors
+es6id: 13.7.5
+flags: [noStrict]
+---*/
+
+var iterCount = 0;
+
+for (var let of [23]) {
+ assert.sameValue(let, 23);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/head-var-init.js b/js/src/tests/test262/language/statements/for-of/head-var-init.js
new file mode 100644
index 0000000000..a135479d83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-var-init.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+description: >
+ Initializer is not allowed in head's ForBinding position.
+info: |
+ IterationStatement:
+ for (var ForBinding of AssignmentExpression) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x = 1 of []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/head-var-no-expr.js b/js/src/tests/test262/language/statements/for-of/head-var-no-expr.js
new file mode 100644
index 0000000000..995fd4e45e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/head-var-no-expr.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Expression not allowed in head's AssignmentExpression position
+info: |
+ IterationStatement :
+ for ( var ForBinding of AssignmentExpression ) Statement
+es6id: 13.7
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of [], []) {}
diff --git a/js/src/tests/test262/language/statements/for-of/int16array-mutate.js b/js/src/tests/test262/language/statements/for-of/int16array-mutate.js
new file mode 100644
index 0000000000..fe86a96857
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/int16array-mutate.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Int16Array mutation during traversal using for..of
+info: |
+ Int16Array instances should be able to be traversed using a `for..of` loop,
+ and dynamic changes to their contents should be reflected in the iterated
+ values.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Int16Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 64;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ array[1] = 64;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/int16array.js b/js/src/tests/test262/language/statements/for-of/int16array.js
new file mode 100644
index 0000000000..413dff5488
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/int16array.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: >
+ Int16Array instances should be able to be traversed using a `for..of` loop.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Int16Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 2;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/int32array-mutate.js b/js/src/tests/test262/language/statements/for-of/int32array-mutate.js
new file mode 100644
index 0000000000..f19f70e27a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/int32array-mutate.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Int32Array mutation during traversal using for..of
+info: |
+ Int32Array instances should be able to be traversed using a `for..of` loop,
+ and dynamic changes to their contents should be reflected in the iterated
+ values.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Int32Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 64;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ array[1] = 64;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/int32array.js b/js/src/tests/test262/language/statements/for-of/int32array.js
new file mode 100644
index 0000000000..3bbbd033e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/int32array.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: >
+ Int32Array instances should be able to be traversed using a `for..of` loop.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Int32Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 2;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/int8array-mutate.js b/js/src/tests/test262/language/statements/for-of/int8array-mutate.js
new file mode 100644
index 0000000000..96a79760f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/int8array-mutate.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Int8Array mutation during traversal using for..of
+info: |
+ Int8Array instances should be able to be traversed using a `for..of` loop,
+ and dynamic changes to their contents should be reflected in the iterated
+ values.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Int8Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 64;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ array[1] = 64;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/int8array.js b/js/src/tests/test262/language/statements/for-of/int8array.js
new file mode 100644
index 0000000000..a4351d6b0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/int8array.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: >
+ Int8Array instances should be able to be traversed using a `for..of` loop.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Int8Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 2;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-as-proxy.js b/js/src/tests/test262/language/statements/for-of/iterator-as-proxy.js
new file mode 100644
index 0000000000..89bab3e8ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-as-proxy.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Iterators that are implemented as proxies should behave identically to
+ non-proxy versions.
+features: [Proxy, Symbol.iterator]
+---*/
+
+var iterable = {};
+var nextResult = { value: 23, done: false };
+var lastResult = { value: null, done: true };
+var i;
+
+var iterator = {
+ next: function() {
+ var result = nextResult;
+ nextResult = lastResult;
+ return result;
+ }
+};
+var proxiedIterator = new Proxy(iterator, {
+ get: function(target, name) {
+ return target[name];
+ }
+});
+iterable[Symbol.iterator] = function() { return proxiedIterator; };
+
+i = 0;
+for (var x of iterable) {
+ assert.sameValue(x, 23);
+ i++;
+}
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-non-object.js b/js/src/tests/test262/language/statements/for-of/iterator-close-non-object.js
new file mode 100644
index 0000000000..6d1f4a8ad9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-non-object.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ If an iterator's `return` method returns a non-Object value, a TypeError
+ should be thrown.
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var iterationCount = 0;
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: null };
+ },
+ return: function() {
+ return 0;
+ }
+ };
+};
+
+assert.throws(TypeError, function() {
+ for (var x of iterable) {
+ iterationCount += 1;
+ break;
+ }
+});
+
+assert.sameValue(iterationCount, 1, 'The loop body is evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-abrupt.js b/js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-abrupt.js
new file mode 100644
index 0000000000..4d5be580ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-abrupt.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteratorclose
+description: >
+ If retrieving an iterator's `return` method generates an error while
+ closing the iterator with non-throw completion, the error should be
+ forwarded to the runtime.
+info: |
+ IteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ [...]
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var iterationCount = 0;
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: null };
+ },
+ get return() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var x of iterable) {
+ iterationCount += 1;
+ break;
+ }
+});
+
+assert.sameValue(iterationCount, 1, 'The loop body is evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-is-null.js b/js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-is-null.js
new file mode 100644
index 0000000000..509d32f420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-is-null.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteratorclose
+description: >
+ If iterator's "return" method is `null`,
+ received non-throw completion is forwarded to the runtime.
+info: |
+ IteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ a. Let return be innerResult.[[Value]].
+ b. If return is undefined, return Completion(completion).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+features: [Symbol.iterator]
+---*/
+
+var iterationCount = 0;
+var returnGets = 0;
+
+var iterable = {};
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return {value: 1, done: false};
+ },
+ get return() {
+ returnGets += 1;
+ return null;
+ },
+ };
+};
+
+for (var _ of iterable) {
+ iterationCount += 1;
+ break;
+}
+
+assert.sameValue(iterationCount, 1);
+assert.sameValue(returnGets, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-non-callable.js b/js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-non-callable.js
new file mode 100644
index 0000000000..f7715d3135
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-non-throw-get-method-non-callable.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteratorclose
+description: >
+ If retrieving an iterator's `return` method generates an error while
+ closing the iterator with non-throw completion, the error should be
+ forwarded to the runtime.
+info: |
+ IteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ [...]
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var iterationCount = 0;
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: null };
+ },
+ return: 1,
+ };
+};
+
+assert.throws(TypeError, function() {
+ for (var x of iterable) {
+ iterationCount += 1;
+ break;
+ }
+});
+
+assert.sameValue(iterationCount, 1, 'The loop body is evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-throw-get-method-abrupt.js b/js/src/tests/test262/language/statements/for-of/iterator-close-throw-get-method-abrupt.js
new file mode 100644
index 0000000000..926a58efc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-throw-get-method-abrupt.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteratorclose
+description: >
+ If retrieving an iterator's `return` method generates an error while
+ closing the iterator with throw completion, this error should be suppressed.
+info: |
+ IteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ [...]
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var iterationCount = 0;
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: null };
+ },
+ get return() {
+ throw { name: 'inner error' };
+ },
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var x of iterable) {
+ iterationCount += 1;
+ throw new Test262Error('should not be overriden');
+ }
+});
+
+assert.sameValue(iterationCount, 1, 'The loop body is evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-throw-get-method-non-callable.js b/js/src/tests/test262/language/statements/for-of/iterator-close-throw-get-method-non-callable.js
new file mode 100644
index 0000000000..ffb7be7ea1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-throw-get-method-non-callable.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteratorclose
+description: >
+ If retrieving an iterator's `return` method generates an error while
+ closing the iterator with throw completion, this error should be suppressed.
+info: |
+ IteratorClose ( iteratorRecord, completion )
+
+ [...]
+ 4. Let innerResult be GetMethod(iterator, "return").
+ 5. If innerResult.[[Type]] is normal,
+ [...]
+ 6. If completion.[[Type]] is throw, return Completion(completion).
+ 7. If innerResult.[[Type]] is throw, return Completion(innerResult).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var iterationCount = 0;
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return { done: false, value: null };
+ },
+ return: 'str',
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var x of iterable) {
+ iterationCount += 1;
+ throw new Test262Error('should not be overriden');
+ }
+});
+
+assert.sameValue(iterationCount, 1, 'The loop body is evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-via-break.js b/js/src/tests/test262/language/statements/for-of/iterator-close-via-break.js
new file mode 100644
index 0000000000..c324bffe55
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-via-break.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Iterators should be closed via their `return` method when iteration is
+ interrupted via a `break` statement.
+features: [Symbol.iterator]
+---*/
+
+var startedCount = 0;
+var returnCount = 0;
+var iterationCount = 0;
+var iterable = {};
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ startedCount += 1;
+ return { done: false, value: null };
+ },
+ return: function() {
+ returnCount += 1;
+ return {};
+ }
+ };
+};
+
+for (var x of iterable) {
+ assert.sameValue(
+ startedCount, 1, 'Value is retrieved'
+ );
+ assert.sameValue(
+ returnCount, 0, 'Iterator is not closed'
+ );
+ iterationCount += 1;
+ break;
+}
+
+assert.sameValue(
+ startedCount, 1, 'Iterator does not restart following interruption'
+);
+assert.sameValue(iterationCount, 1, 'A single iteration occurs');
+assert.sameValue(
+ returnCount, 1, 'Iterator is closed after `break` statement'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-via-continue.js b/js/src/tests/test262/language/statements/for-of/iterator-close-via-continue.js
new file mode 100644
index 0000000000..f2ffaedcd0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-via-continue.js
@@ -0,0 +1,66 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset
+description: >
+ Iterators should be closed via their `return` method when iteration is
+ interrupted via a `continue` statement.
+info: |
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation ( lhs, stmt, iteratorRecord, iterationKind, lhsKind, labelSet )
+ ...
+ 5. Repeat,
+ ...
+ i. Let result be the result of evaluating stmt.
+ ...
+ k. If LoopContinues(result, labelSet) is false, then
+ i. If iterationKind is enumerate, then
+ ...
+ ii. Else,
+ 1. Assert: iterationKind is iterate.
+ 2. Return ? IteratorClose(iteratorRecord, UpdateEmpty(result, V)).
+ ...
+
+features: [Symbol.iterator]
+---*/
+
+var startedCount = 0;
+var returnCount = 0;
+var iterationCount = 0;
+var iterable = {};
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ startedCount += 1;
+ return { done: false, value: null };
+ },
+ return: function() {
+ returnCount += 1;
+ return {};
+ }
+ };
+};
+
+L: do {
+ for (var x of iterable) {
+ assert.sameValue(
+ startedCount, 1, 'Value is retrieved'
+ );
+ assert.sameValue(
+ returnCount, 0, 'Iterator is not closed'
+ );
+ iterationCount += 1;
+ continue L;
+ }
+} while (false);
+
+assert.sameValue(
+ startedCount, 1, 'Iterator does not restart following interruption'
+);
+assert.sameValue(iterationCount, 1, 'A single iteration occurs');
+assert.sameValue(
+ returnCount, 1, 'Iterator is closed after `continue` statement'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-via-return.js b/js/src/tests/test262/language/statements/for-of/iterator-close-via-return.js
new file mode 100644
index 0000000000..b82fbfa4a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-via-return.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Iterators should be closed via their `return` method when iteration is
+ interrupted via a `return` statement.
+features: [Symbol.iterator]
+---*/
+
+var startedCount = 0;
+var returnCount = 0;
+var iterationCount = 0;
+var iterable = {};
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ startedCount += 1;
+ return { done: false, value: null };
+ },
+ return: function() {
+ returnCount += 1;
+ return {};
+ }
+ };
+};
+
+(function() {
+ for (var x of iterable) {
+ assert.sameValue(
+ startedCount, 1, 'Value is retrieved'
+ );
+ assert.sameValue(
+ returnCount, 0, 'Iterator is not closed'
+ );
+ iterationCount += 1;
+ return;
+ }
+}());
+
+assert.sameValue(
+ startedCount, 1, 'Iterator does not restart following interruption'
+);
+assert.sameValue(iterationCount, 1, 'A single iteration occurs');
+assert.sameValue(
+ returnCount, 1, 'Iterator is closed after `return` statement'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-close-via-throw.js b/js/src/tests/test262/language/statements/for-of/iterator-close-via-throw.js
new file mode 100644
index 0000000000..675d73b01e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-close-via-throw.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Iterators should be closed via their `return` method when iteration is
+ interrupted via a `throw` statement.
+features: [Symbol.iterator]
+---*/
+
+var startedCount = 0;
+var returnCount = 0;
+var iterationCount = 0;
+var iterable = {};
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ startedCount += 1;
+ return { done: false, value: null };
+ },
+ return: function() {
+ returnCount += 1;
+ return {};
+ }
+ };
+};
+
+try {
+ for (var x of iterable) {
+ assert.sameValue(
+ startedCount, 1, 'Value is retrieved'
+ );
+ assert.sameValue(
+ returnCount, 0, 'Iterator is not closed'
+ );
+ iterationCount += 1;
+ throw 0;
+ }
+} catch (err) {}
+
+assert.sameValue(
+ startedCount, 1, 'Iterator does not restart following interruption'
+);
+assert.sameValue(iterationCount, 1, 'A single iteration occurs');
+assert.sameValue(
+ returnCount, 1, 'Iterator is closed after `throw` statement'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-next-error.js b/js/src/tests/test262/language/statements/for-of/iterator-next-error.js
new file mode 100644
index 0000000000..1df2e8ef29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-next-error.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.d
+description: >
+ If `nextResult` is an abrupt completion as per IteratorStep (ES6 7.4.5),
+ return the completion.
+info: |
+ [...]
+ 5. Repeat
+ a. Let nextResult be ? IteratorStep(iterator).
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var iterationCount = 0;
+var returnCount = 0;
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ },
+ return: function() {
+ returnCount += 1;
+ return {};
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var x of iterable) {
+ iterationCount += 1;
+ }
+});
+
+assert.sameValue(iterationCount, 0, 'The loop body is not evaluated');
+assert.sameValue(returnCount, 0, 'Iterator is not closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-next-reference.js b/js/src/tests/test262/language/statements/for-of/iterator-next-reference.js
new file mode 100644
index 0000000000..29b9cc4080
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-next-reference.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-getiterator
+description: >
+ The iterator's `next` method should be accessed only once with each
+ iteration as per the `GetIterator` abstract operation (7.4.1).
+features: [Symbol.iterator, for-of]
+---*/
+
+var iterable = {};
+var iterator = {};
+var iterationCount = 0;
+var loadNextCount = 0;
+
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+
+function next() {
+ if (iterationCount) return { done: true };
+ return { value: 45, done: false };
+}
+Object.defineProperty(iterator, 'next', {
+ get() { loadNextCount++; return next; },
+ configurable: true
+});
+
+for (var x of iterable) {
+ assert.sameValue(x, 45);
+
+ Object.defineProperty(iterator, 'next', {
+ get: function() {
+ throw new Test262Error(
+ 'Should not access the `next` method after the iteration prologue.');
+ }
+ });
+ iterationCount++;
+}
+assert.sameValue(iterationCount, 1);
+assert.sameValue(loadNextCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-next-result-done-attr.js b/js/src/tests/test262/language/statements/for-of/iterator-next-result-done-attr.js
new file mode 100644
index 0000000000..415e5997e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-next-result-done-attr.js
@@ -0,0 +1,132 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 7.4.3
+description: >
+ The `done` value of iteration result objects should be interpreted as
+ incomplete as per `ToBoolean` (7.1.2).
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var i, firstIterResult;
+
+iterable[Symbol.iterator] = function() {
+ var finalIterResult = { value: null, done: true };
+ var nextIterResult = firstIterResult;
+
+ return {
+ next: function() {
+ var iterResult = nextIterResult;
+
+ nextIterResult = finalIterResult;
+
+ return iterResult;
+ }
+ };
+};
+
+firstIterResult = { value: null, done: undefined };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 1);
+
+firstIterResult = { value: null };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 1);
+
+firstIterResult = { value: null, done: null };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 1);
+
+firstIterResult = { value: null, done: false };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 1);
+
+firstIterResult = { value: null, done: true };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 0);
+
+firstIterResult = { value: null, done: 1 };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 0);
+
+firstIterResult = { value: null, done: 0 };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 1);
+
+firstIterResult = { value: null, done: -0 };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 1);
+
+firstIterResult = { value: null, done: NaN };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 1);
+
+firstIterResult = { value: null, done: '' };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 1);
+
+firstIterResult = { value: null, done: '0' };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 0);
+
+firstIterResult = { value: null, done: Symbol() };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 0);
+
+firstIterResult = { value: null, done: {} };
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 0);
+
+firstIterResult = { value: null };
+Object.defineProperty(firstIterResult, 'done', {
+ get: function() {
+ return true;
+ }
+});
+i = 0;
+for (var x of iterable) {
+ i++;
+}
+assert.sameValue(i, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-next-result-type.js b/js/src/tests/test262/language/statements/for-of/iterator-next-result-type.js
new file mode 100644
index 0000000000..46bc36d784
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-next-result-type.js
@@ -0,0 +1,108 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.c
+description: >
+ If Type(result) is not Object, throw a TypeError exception as per
+ `IteratorNext` (7.4.2 S4)
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var firstIterResult;
+
+iterable[Symbol.iterator] = function() {
+ var finalIterResult = { value: null, done: true };
+ var nextIterResult = firstIterResult;
+
+ return {
+ next: function() {
+ var iterResult = nextIterResult;
+
+ nextIterResult = finalIterResult;
+
+ return iterResult;
+ }
+ };
+};
+
+firstIterResult = true;
+assert.throws(TypeError, function() {
+ for (var x of iterable) {}
+});
+
+firstIterResult = false;
+assert.throws(TypeError, function() {
+ for (var x of iterable) {}
+});
+
+firstIterResult = 'string';
+assert.throws(TypeError, function() {
+ for (var x of iterable) {}
+});
+
+firstIterResult = undefined;
+assert.throws(TypeError, function() {
+ for (var x of iterable) {}
+});
+
+firstIterResult = null;
+assert.throws(TypeError, function() {
+ for (var x of iterable) {}
+});
+
+firstIterResult = 4;
+assert.throws(TypeError, function() {
+ for (var x of iterable) {}
+});
+
+firstIterResult = NaN;
+assert.throws(TypeError, function() {
+ for (var x of iterable) {}
+});
+
+firstIterResult = Symbol('s');
+assert.throws(TypeError, function() {
+ for (var x of iterable) {}
+});
+
+firstIterResult = /regexp/;
+for (var x of iterable) {}
+
+firstIterResult = {};
+for (var x of iterable) {}
+
+firstIterResult = new Proxy({}, {
+ get: function(receiver, name) {
+ if (name === 'done') {
+ return true;
+ }
+ if (name === 'value') {
+ return null;
+ }
+ throw new Test262Error('This code is unreachable.');
+ }
+});
+for (var x of iterable) {
+ throw new Test262Error('This code is unreachable.');
+}
+
+firstIterResult = new Proxy({}, {
+ get: function(receiver, name) {
+ if (name === 'done') {
+ return false;
+ }
+ if (name === 'value') {
+ return 23;
+ }
+ throw new Test262Error('This code is unreachable.');
+ }
+});
+var i = 0;
+for (var x of iterable) {
+ assert.sameValue(x, 23);
+ i++;
+}
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-next-result-value-attr-error.js b/js/src/tests/test262/language/statements/for-of/iterator-next-result-value-attr-error.js
new file mode 100644
index 0000000000..1f0592f4a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-next-result-value-attr-error.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.g
+description: >
+ If `nextValue` is an abrupt completion as per IteratorValue (ES6 7.4.4),
+ return the completion.
+info: |
+ [...]
+ 5. Repeat
+ a. Let nextResult be ? IteratorStep(iterator).
+ b. If nextResult is false, return NormalCompletion(V).
+ c. Let nextValue be ? IteratorValue(nextResult).
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var iterationCount = 0;
+var returnCount = 0;
+
+iterable[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return {
+ done: false,
+ get value() {
+ throw new Test262Error();
+ }
+ };
+ },
+ return: function() {
+ returnCount += 1;
+ return {};
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var x of iterable) {
+ iterationCount += 1;
+ }
+});
+
+assert.sameValue(iterationCount, 0, 'The loop body is not evaluated');
+assert.sameValue(returnCount, 0, 'Iterator is not closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/iterator-next-result-value-attr.js b/js/src/tests/test262/language/statements/for-of/iterator-next-result-value-attr.js
new file mode 100644
index 0000000000..27076c53de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/iterator-next-result-value-attr.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13 S5.f
+description: >
+ The `value` of iteration result objects should be retrieved using the Get
+ abstract operation.
+features: [Symbol.iterator]
+---*/
+
+var iterable = {};
+var i, firstIterResult;
+
+iterable[Symbol.iterator] = function() {
+ var finalIterResult = { value: null, done: true };
+ var nextIterResult = firstIterResult;
+
+ return {
+ next: function() {
+ var iterResult = nextIterResult;
+
+ nextIterResult = finalIterResult;
+
+ return iterResult;
+ }
+ };
+};
+
+firstIterResult = { value: 45, done: false };
+i = 0;
+for (var x of iterable) {
+ assert.sameValue(x, 45);
+ i++;
+}
+assert.sameValue(i, 1);
+
+firstIterResult = { done: false };
+Object.defineProperty(firstIterResult, 'value', {
+ get: function() {
+ return 23;
+ }
+});
+i = 0;
+for (var x of iterable) {
+ assert.sameValue(x, 23);
+ i++;
+}
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-const.js b/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-const.js
new file mode 100644
index 0000000000..fa964e8d6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-const.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (const x of []) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-let.js b/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-let.js
new file mode 100644
index 0000000000..6ae9837cae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-let.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (let x of []) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-lhs.js b/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-lhs.js
new file mode 100644
index 0000000000..efdb27cd32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-lhs.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (x of []) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-var.js b/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-var.js
new file mode 100644
index 0000000000..086cc38999
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/labelled-fn-stmt-var.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of []) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for-of/let-array-with-newline.js b/js/src/tests/test262/language/statements/for-of/let-array-with-newline.js
new file mode 100644
index 0000000000..179fdad77f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/let-array-with-newline.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x of []) let
+[a] = 0;
diff --git a/js/src/tests/test262/language/statements/for-of/let-block-with-newline.js b/js/src/tests/test262/language/statements/for-of/let-block-with-newline.js
new file mode 100644
index 0000000000..a5ca01e125
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/let-block-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let {`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+for (var x of []) let // ASI
+{}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/let-identifier-with-newline.js b/js/src/tests/test262/language/statements/for-of/let-identifier-with-newline.js
new file mode 100644
index 0000000000..e383835c93
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/let-identifier-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-in-and-for-of-statements
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+for (var x of []) let // ASI
+x = 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/map-contract-expand.js b/js/src/tests/test262/language/statements/for-of/map-contract-expand.js
new file mode 100644
index 0000000000..c9cc3ed190
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/map-contract-expand.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Map entry removal and re-insertion during traversal using for..of
+info: |
+ Entries removed from a Map instance during traversal should be visited if
+ they are re-inserted prior to iterator exhaustion.
+es6id: 13.6.4
+features: [Map]
+---*/
+
+var map = new Map();
+var iterationCount = 0;
+
+var first = [0, 'a'];
+var second = [1, 'b'];
+
+map.set(0, 'a');
+map.set(1, 'b');
+
+for (var x of map) {
+ assert.sameValue(x[0], first[0]);
+ assert.sameValue(x[1], first[1]);
+
+ first = second;
+ second = null;
+
+ if (first !== null) {
+ map.delete(1);
+ map.set(1, 'b');
+ }
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/map-contract.js b/js/src/tests/test262/language/statements/for-of/map-contract.js
new file mode 100644
index 0000000000..e068d4f51f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/map-contract.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Entries removed from a Map instance during traversal should not be visited.
+es6id: 13.6.4
+features: [Map]
+---*/
+
+var map = new Map();
+var iterationCount = 0;
+
+map.set(0, 'a');
+map.set(1, 'b');
+
+for (var x of map) {
+ assert.sameValue(x[0], 0);
+ assert.sameValue(x[1], 'a');
+ map.delete(1);
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/map-expand-contract.js b/js/src/tests/test262/language/statements/for-of/map-expand-contract.js
new file mode 100644
index 0000000000..cd1c2ed6dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/map-expand-contract.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Map entry insertion during traversal using for..of
+info: |
+ New entries inserted into a Map instance during traversal should not be
+ visited if they are removed prior to visitation.
+es6id: 13.6.4
+features: [Map]
+---*/
+
+var map = new Map();
+var iterationCount = 0;
+
+map.set(0, 'a');
+
+for (var x of map) {
+ assert.sameValue(x[0], 0);
+ assert.sameValue(x[1], 'a');
+
+ map.set(1, 'b');
+ map.delete(1);
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/map-expand.js b/js/src/tests/test262/language/statements/for-of/map-expand.js
new file mode 100644
index 0000000000..044dd0cf2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/map-expand.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Map entry insertion during traversal using for..of
+info: |
+ New entries inserted into a Map instance during traversal should be
+ visited.
+es6id: 13.6.4
+features: [Map]
+---*/
+
+var map = new Map();
+var iterationCount = 0;
+
+var first = [0, 'a'];
+var second = [1, 'b'];
+
+map.set(0, 'a');
+
+for (var x of map) {
+ assert.sameValue(x[0], first[0]);
+ assert.sameValue(x[1], first[1]);
+
+ first = second;
+ second = null;
+
+ map.set(1, 'b');
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/map.js b/js/src/tests/test262/language/statements/for-of/map.js
new file mode 100644
index 0000000000..c7a936192c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/map.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Map traversal using for..of
+info: |
+ Map instances should be able to be traversed using a `for...of` loop.
+es6id: 13.6.4
+features: [Map]
+---*/
+
+var map = new Map();
+var obj = {};
+var iterationCount = 0;
+
+var first = [0, 'a'];
+var second = [true, false];
+var third = [null, undefined];
+var fourth = [NaN, obj];
+
+map.set(0, 'a');
+map.set(true, false);
+map.set(null, undefined);
+map.set(NaN, obj);
+
+for (var x of map) {
+ assert.sameValue(x[0], first[0]);
+ assert.sameValue(x[1], first[1]);
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/nested.js b/js/src/tests/test262/language/statements/for-of/nested.js
new file mode 100644
index 0000000000..54fefe3876
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/nested.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Nested statements should operate independently.
+features: [generators]
+---*/
+
+function* values() {
+ yield 3;
+ yield 7;
+}
+
+var outerIterable, expectedOuter, i, innerIterable, expectedInner, j;
+
+outerIterable = values();
+expectedOuter = 3;
+i = 0;
+
+for (var x of outerIterable) {
+ assert.sameValue(x, expectedOuter);
+ expectedOuter = 7;
+ i++;
+
+ innerIterable = values();
+ expectedInner = 3;
+ j = 0;
+ for (var y of innerIterable) {
+ assert.sameValue(y, expectedInner);
+ expectedInner = 7;
+ j++;
+ }
+
+ assert.sameValue(j, 2);
+}
+
+assert.sameValue(i, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/return-from-catch.js b/js/src/tests/test262/language/statements/for-of/return-from-catch.js
new file mode 100644
index 0000000000..ac33a21d23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/return-from-catch.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `return` statements within
+ the `catch` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+var result = (function() {
+ for (var x of iterator) {
+ try {
+ throw new Error();
+ } catch(err) {
+ i++;
+ return 34;
+
+ throw new Test262Error('This code is unreachable (following `return` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..in` statement).');
+})();
+
+assert.sameValue(result, 34);
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/return-from-finally.js b/js/src/tests/test262/language/statements/for-of/return-from-finally.js
new file mode 100644
index 0000000000..24d4895616
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/return-from-finally.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `return` statements within
+ the `finally` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+var result = (function() {
+ for (var x of iterator) {
+ try {
+ } finally {
+ i++;
+ return 34;
+
+ throw new Test262Error('This code is unreachable (following `return` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..in` statement).');
+})();
+
+assert.sameValue(result, 34);
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/return-from-try.js b/js/src/tests/test262/language/statements/for-of/return-from-try.js
new file mode 100644
index 0000000000..1804b1a6f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/return-from-try.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `return` statements within
+ `try` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+var result = (function() {
+ for (var x of iterator) {
+ try {
+ i++;
+ return 34;
+
+ throw new Test262Error('This code is unreachable (following `return` statement).');
+ } catch(err) {
+ throw new Test262Error('This code is unreachable (within `catch` block).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..in` statement).');
+})();
+
+assert.sameValue(result, 34);
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/return.js b/js/src/tests/test262/language/statements/for-of/return.js
new file mode 100644
index 0000000000..79657ef84c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/return.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `return` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var iterator = values();
+var i = 0;
+
+var result = (function() {
+ for (var x of iterator) {
+ i++;
+ return 34;
+
+ throw new Test262Error('This code is unreachable (following `return` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..of` statement).');
+})();
+
+assert.sameValue(result, 34);
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/scope-body-lex-boundary.js b/js/src/tests/test262/language/statements/for-of/scope-body-lex-boundary.js
new file mode 100644
index 0000000000..7377a24939
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/scope-body-lex-boundary.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Creation of new lexical environment for each evaluation of the statement
+ body
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. Repeat
+ [...]
+ i. Let result be the result of evaluating stmt.
+ j. Set the running execution context's LexicalEnvironment to oldEnv.
+ k. If LoopContinues(result, labelSet) is false, return ?
+ IteratorClose(iterator, UpdateEmpty(result, V)).
+ l. If result.[[Value]] is not empty, let V be result.[[Value]].
+features: [let]
+---*/
+
+let x = 'outside';
+var probeFirst, probeSecond;
+
+for (let x of ['first', 'second'])
+ if (!probeFirst)
+ probeFirst = function() { return x; };
+ else
+ probeSecond = function() { return x; };
+
+assert.sameValue(probeFirst(), 'first');
+assert.sameValue(probeSecond(), 'second');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/scope-body-lex-close.js b/js/src/tests/test262/language/statements/for-of/scope-body-lex-close.js
new file mode 100644
index 0000000000..96689c07c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/scope-body-lex-close.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Removal of lexical environment for the initial evaluation of the statement
+ body
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. Repeat
+ [...]
+ i. Let result be the result of evaluating stmt.
+ j. Set the running execution context's LexicalEnvironment to oldEnv.
+ k. If LoopContinues(result, labelSet) is false, return ?
+ IteratorClose(iterator, UpdateEmpty(result, V)).
+ l. If result.[[Value]] is not empty, let V be result.[[Value]].
+features: [let]
+---*/
+
+let x = 'outside';
+var probeDecl, probeBody;
+
+for (
+ let [x, _ = probeDecl = function() { return x; }]
+ of
+ [['inside']]
+ )
+ probeBody = function() { return x; };
+
+assert.sameValue(probeDecl(), 'inside', 'reference from ForDeclaration');
+assert.sameValue(probeBody(), 'inside', 'reference from statement body');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/scope-body-lex-open.js b/js/src/tests/test262/language/statements/for-of/scope-body-lex-open.js
new file mode 100644
index 0000000000..39459e016a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/scope-body-lex-open.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Creation of new lexical environment for the initial evaluation of the
+ statement body
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. Repeat
+ [...]
+ d. If lhsKind is either assignment or varBinding, then
+ [...]
+ e. Else,
+ i. Assert: lhsKind is lexicalBinding.
+ ii. Assert: lhs is a ForDeclaration.
+ iii. Let iterationEnv be NewDeclarativeEnvironment(oldEnv).
+ iv. Perform BindingInstantiation for lhs passing iterationEnv as the
+ argument.
+ v. Set the running execution context's LexicalEnvironment to
+ iterationEnv.
+ [...]
+features: [let]
+---*/
+
+var probeBefore = function() { return x; };
+let x = 'outside';
+var probeExpr, probeDecl, probeBody;
+
+for (
+ let [x, _, __ = probeDecl = function() { return x; }]
+ of
+ [['inside', probeExpr = function() { typeof x; }]]
+ )
+ probeBody = function() { return x; };
+
+assert.sameValue(probeBefore(), 'outside');
+assert.throws(ReferenceError, probeExpr);
+assert.sameValue(probeDecl(), 'inside', 'reference from ForDeclaration');
+assert.sameValue(probeBody(), 'inside', 'reference from statement body');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/scope-body-var-none.js b/js/src/tests/test262/language/statements/for-of/scope-body-var-none.js
new file mode 100644
index 0000000000..dddb7964a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/scope-body-var-none.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: No variable environment is created for the statement body
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ [...]
+ 2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+
+ 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
+
+ [...]
+ 5. Repeat
+ [...]
+ d. If lhsKind is either assignment or varBinding, then
+ [...]
+ e. Else,
+ i. Assert: lhsKind is lexicalBinding.
+ ii. Assert: lhs is a ForDeclaration.
+ iii. Let iterationEnv be NewDeclarativeEnvironment(oldEnv).
+ iv. Perform BindingInstantiation for lhs passing iterationEnv as the
+ argument.
+ v. Set the running execution context's LexicalEnvironment to
+ iterationEnv.
+ [...]
+features: [let]
+---*/
+
+var probeBefore = function() { return x; };
+var probeExpr, probeDecl, probeBody;
+var x = 1;
+
+for (
+ let [_, __ = probeDecl = function() { return x; }]
+ of
+ [[probeExpr = function() { return x; }]]
+ )
+ var x = 2, ___ = probeBody = function() { return x; };
+
+
+assert.sameValue(probeBefore(), 2, 'reference preceding statement');
+assert.sameValue(probeExpr(), 2, 'reference from AssignmentExpression');
+assert.sameValue(probeDecl(), 2, 'reference from ForDelaration');
+assert.sameValue(probeBody(), 2, 'reference from statement body');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/scope-head-lex-close.js b/js/src/tests/test262/language/statements/for-of/scope-head-lex-close.js
new file mode 100644
index 0000000000..d84859e4c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/scope-head-lex-close.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Removal of lexical environment to serve as a temporal dead zone for the
+ statement's AssignmentExpresson
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ?
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration,
+ AssignmentExpression, iterate).
+ [...]
+
+ 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation
+
+ [...]
+ 2. If TDZnames is not an empty List, then
+ a. Assert: TDZnames has no duplicate entries.
+ b. Let TDZ be NewDeclarativeEnvironment(oldEnv).
+ c. Let TDZEnvRec be TDZ's EnvironmentRecord.
+ d. For each string name in TDZnames, do
+ i. Perform ! TDZEnvRec.CreateMutableBinding(name, false).
+ e. Set the running execution context's LexicalEnvironment to TDZ.
+ 3. Let exprRef be the result of evaluating expr.
+ 4. Set the running execution context's LexicalEnvironment to oldEnv.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeDecl, probeExpr, probeBody;
+
+for (
+ let [x, _ = probeDecl = function() { return x; }]
+ of
+ (probeExpr = function() { typeof x; }, [['inside']])
+ )
+ probeBody = function() { return x; };
+
+assert.throws(ReferenceError, probeExpr);
+assert.sameValue(probeDecl(), 'inside', 'reference from ForDeclaration');
+assert.sameValue(probeBody(), 'inside', 'reference from statement body');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/scope-head-lex-open.js b/js/src/tests/test262/language/statements/for-of/scope-head-lex-open.js
new file mode 100644
index 0000000000..36789d239a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/scope-head-lex-open.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ Creation of new lexical environment to serve as a temporal dead zone for
+ the statement's AssignmentExpresson
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ?
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration,
+ AssignmentExpression, iterate).
+ [...]
+
+ 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation
+
+ [...]
+ 2. If TDZnames is not an empty List, then
+ a. Assert: TDZnames has no duplicate entries.
+ b. Let TDZ be NewDeclarativeEnvironment(oldEnv).
+ c. Let TDZEnvRec be TDZ's EnvironmentRecord.
+ d. For each string name in TDZnames, do
+ i. Perform ! TDZEnvRec.CreateMutableBinding(name, false).
+ e. Set the running execution context's LexicalEnvironment to TDZ.
+ 3. Let exprRef be the result of evaluating expr.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeBefore = function() { return x; };
+var probeExpr;
+
+for (let x of (probeExpr = function() { typeof x; }, [])) ;
+
+assert.sameValue(probeBefore(), 'outside');
+assert.throws(ReferenceError, probeExpr);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/scope-head-var-none.js b/js/src/tests/test262/language/statements/for-of/scope-head-var-none.js
new file mode 100644
index 0000000000..18268d0959
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/scope-head-var-none.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
+description: >
+ No variable environment is created for the statement "head"
+info: |
+ IterationStatement : for ( ForDeclaration of AssignmentExpression ) Statement
+
+ 1. Let keyResult be the result of performing ?
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration,
+ AssignmentExpression, iterate).
+ [...]
+
+ 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation
+
+ [...]
+ 2. If TDZnames is not an empty List, then
+ a. Assert: TDZnames has no duplicate entries.
+ b. Let TDZ be NewDeclarativeEnvironment(oldEnv).
+ c. Let TDZEnvRec be TDZ's EnvironmentRecord.
+ d. For each string name in TDZnames, do
+ i. Perform ! TDZEnvRec.CreateMutableBinding(name, false).
+ e. Set the running execution context's LexicalEnvironment to TDZ.
+ 3. Let exprRef be the result of evaluating expr.
+ [...]
+flags: [noStrict]
+---*/
+
+var probeBefore = function() { return x; };
+var x = 1;
+var probeDecl, probeExpr, probeBody;
+
+for (
+ let [_ = probeDecl = function() { return x; }]
+ of
+ [[eval('var x = 2;'), probeExpr = function() { return x; }]]
+ )
+ probeBody = function() { return x; };
+
+assert.sameValue(probeBefore(), 2, 'reference preceding statement');
+assert.sameValue(probeDecl(), 2, 'reference from ForDeclaration');
+assert.sameValue(probeExpr(), 2, 'reference from AssignmentExpression');
+assert.sameValue(probeBody(), 2, 'reference from statement body');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/set-contract-expand.js b/js/src/tests/test262/language/statements/for-of/set-contract-expand.js
new file mode 100644
index 0000000000..4a397815e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/set-contract-expand.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Set entry removal and re-insertion during traversal using for..of
+info: |
+ Entries removed from a Set instance during traversal should be visited if
+ they are re-inserted prior to iterator exhaustion.
+es6id: 13.6.4
+features: [Set]
+---*/
+
+var set = new Set();
+var iterationCount = 0;
+
+var first = 0;
+var second = 1;
+
+set.add(0);
+set.add(1);
+
+for (var x of set) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = null;
+
+ if (first !== null) {
+ set.delete(1);
+ set.add(1);
+ }
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/set-contract.js b/js/src/tests/test262/language/statements/for-of/set-contract.js
new file mode 100644
index 0000000000..7b952027bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/set-contract.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Entries removed from a Set instance during traversal should not be visited.
+es6id: 13.6.4
+features: [Set]
+---*/
+
+var set = new Set();
+var iterationCount = 0;
+
+set.add(0);
+set.add(1);
+
+for (var x of set) {
+ assert.sameValue(x, 0);
+ set.delete(1);
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/set-expand-contract.js b/js/src/tests/test262/language/statements/for-of/set-expand-contract.js
new file mode 100644
index 0000000000..29264dde6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/set-expand-contract.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Set entry insertion and removal during traversal using for..of
+info: |
+ New entries inserted into a Set instance during traversal should not be
+ visited if they are removed prior to visitation.
+es6id: 13.6.4
+features: [Set]
+---*/
+
+var set = new Set();
+var iterationCount = 0;
+
+set.add(0);
+
+for (var x of set) {
+ assert.sameValue(x, 0);
+
+ set.add(1);
+ set.delete(1);
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/set-expand.js b/js/src/tests/test262/language/statements/for-of/set-expand.js
new file mode 100644
index 0000000000..56aca39e95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/set-expand.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Set entry insertaion during traversal using for..of
+info: |
+ New entries inserted into a Set instance during traversal should be
+ visited.
+es6id: 13.6.4
+features: [Set]
+---*/
+
+var set = new Set();
+var iterationCount = 0;
+
+var first = 0;
+var second = 1;
+
+set.add(0);
+
+for (var x of set) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = null;
+
+ set.add(1);
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/set.js b/js/src/tests/test262/language/statements/for-of/set.js
new file mode 100644
index 0000000000..ad11782018
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/set.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Set instances should be able to be traversed using a `for...of` loop.
+es6id: 13.6.4
+features: [Set]
+---*/
+
+var set = new Set();
+var obj = {};
+var iterationCount = 0;
+
+var first = 0;
+var second = 'a';
+var third = true;
+var fourth = false;
+var fifth = null;
+var sixth = undefined;
+var seventh = NaN;
+var eight = obj;
+
+set.add(0);
+set.add('a');
+set.add(true);
+set.add(false);
+set.add(null);
+set.add(undefined);
+set.add(NaN);
+set.add(obj);
+
+for (var x of set) {
+ assert.sameValue(x, first);
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = fifth;
+ fifth = sixth;
+ sixth = seventh;
+ seventh = eight;
+ eight = null;
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 8);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/shell.js b/js/src/tests/test262/language/statements/for-of/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/shell.js
diff --git a/js/src/tests/test262/language/statements/for-of/string-astral-truncated.js b/js/src/tests/test262/language/statements/for-of/string-astral-truncated.js
new file mode 100644
index 0000000000..97f580b52a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/string-astral-truncated.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: String traversal using for..of (incomplete surrogate pairs)
+info: |
+ String literals should be able to be traversed using a `for...of` loop. The
+ loop body should execute once for each incomplete surrogate pair.
+es6id: 13.6.4
+---*/
+
+var string = 'a\ud801b\ud801';
+var first = 'a';
+var second = '\ud801';
+var third = 'b';
+var fourth = '\ud801';
+
+var iterationCount = 0;
+
+for (var value of string) {
+ assert.sameValue(value, first);
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/string-astral.js b/js/src/tests/test262/language/statements/for-of/string-astral.js
new file mode 100644
index 0000000000..f203124fb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/string-astral.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: String traversal using for..of (astral symbols)
+info: |
+ String literals should be able to be traversed using a `for...of` loop. The
+ loop body should execute once for each astral symbol.
+es6id: 13.6.4
+---*/
+
+var string = 'a\ud801\udc28b\ud801\udc28';
+var first = 'a';
+var second = '𐐨';
+var third = 'b';
+var fourth = '𐐨';
+
+var iterationCount = 0;
+
+for (var value of string) {
+ assert.sameValue(value, first);
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/string-bmp.js b/js/src/tests/test262/language/statements/for-of/string-bmp.js
new file mode 100644
index 0000000000..1f5d4334b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/string-bmp.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: String traversal using for..of
+info: |
+ String literals should be able to be traversed using a `for...of` loop. The
+ loop body should execute once for every BMP character.
+es6id: 13.6.4
+---*/
+
+var string = 'abc';
+var first = 'a';
+var second = 'b';
+var third = 'c';
+
+var iterationCount = 0;
+
+for (var value of string) {
+ assert.sameValue(value, first);
+ first = second;
+ second = third;
+ third = null;
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/throw-from-catch.js b/js/src/tests/test262/language/statements/for-of/throw-from-catch.js
new file mode 100644
index 0000000000..554f35185a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/throw-from-catch.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `throw` statements within
+ the `catch` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var CustomError = function() {};
+var iterator = values();
+var i = 0;
+var error = new CustomError();
+
+assert.throws(CustomError, function() {
+ for (var x of iterator) {
+ try {
+ throw new Error();
+ } catch (err) {
+ i++;
+ throw error;
+
+ throw new Test262Error('This code is unreachable (following `throw` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..in` statement).');
+});
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/throw-from-finally.js b/js/src/tests/test262/language/statements/for-of/throw-from-finally.js
new file mode 100644
index 0000000000..860f6919e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/throw-from-finally.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `throw` statements within
+ the `finally` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var CustomError = function() {};
+var iterator = values();
+var i = 0;
+var error = new CustomError();
+
+assert.throws(CustomError, function() {
+ for (var x of iterator) {
+ try {
+ } finally {
+ i++;
+ throw error;
+
+ throw new Test262Error('This code is unreachable (following `throw` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `try` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..in` statement).');
+});
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/throw.js b/js/src/tests/test262/language/statements/for-of/throw.js
new file mode 100644
index 0000000000..65998a1e27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/throw.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `throw` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ throw new Test262Error('This code is unreachable (following `yield` statement).');
+}
+var CustomError = function() {};
+var iterator = values();
+var i = 0;
+var error = new CustomError();
+
+assert.throws(CustomError, function() {
+ for (var x of iterator) {
+ i++;
+ throw error;
+
+ throw new Test262Error('This code is unreachable (following `throw` statement).');
+ }
+
+ throw new Test262Error('This code is unreachable (following `for..in` statement).');
+});
+
+assert.sameValue(i, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/uint16array-mutate.js b/js/src/tests/test262/language/statements/for-of/uint16array-mutate.js
new file mode 100644
index 0000000000..1ad2c43635
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/uint16array-mutate.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Uint16Array mutation during traversal using for..of
+info: |
+ Uint16Array instances should be able to be traversed using a `for..of`
+ loop, and dynamic changes to their contents should be reflected in the
+ iterated values.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Uint16Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 64;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ array[1] = 64;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/uint16array.js b/js/src/tests/test262/language/statements/for-of/uint16array.js
new file mode 100644
index 0000000000..1bd129216f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/uint16array.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Uint16Array traversal using for..of
+info: |
+ Uint16Array instances should be able to be traversed using a `for..of`
+ loop.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Uint16Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 2;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/uint32array-mutate.js b/js/src/tests/test262/language/statements/for-of/uint32array-mutate.js
new file mode 100644
index 0000000000..d1330b8124
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/uint32array-mutate.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Uint32Array mutation during traversal using for..of
+info: |
+ Uint32Array instances should be able to be traversed using a `for..of`
+ loop, and dynamic changes to their contents should be reflected in the
+ iterated values.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Uint32Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 64;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ array[1] = 64;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/uint32array.js b/js/src/tests/test262/language/statements/for-of/uint32array.js
new file mode 100644
index 0000000000..0f39d498a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/uint32array.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Uint32Array traversal using for..of
+info: |
+ Uint32Array instances should be able to be traversed using a `for..of`
+ loop.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Uint32Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 2;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/uint8array-mutate.js b/js/src/tests/test262/language/statements/for-of/uint8array-mutate.js
new file mode 100644
index 0000000000..6bd78fcd7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/uint8array-mutate.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Uint8Array mutation during traversal using for..of
+info: |
+ Uint8Array instances should be able to be traversed using a `for..of` loop,
+ and dynamic changes to their contents should be reflected in the iterated
+ values.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Uint8Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 64;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ array[1] = 64;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/uint8array.js b/js/src/tests/test262/language/statements/for-of/uint8array.js
new file mode 100644
index 0000000000..df5e234b48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/uint8array.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: >
+ Uint8Array instances should be able to be traversed using a `for..of` loop.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Uint8Array([3, 2, 4, 1]);
+
+var first = 3;
+var second = 2;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/uint8clampedarray-mutate.js b/js/src/tests/test262/language/statements/for-of/uint8clampedarray-mutate.js
new file mode 100644
index 0000000000..63623ac6f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/uint8clampedarray-mutate.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: Uint8ClampedArray mutation during traversal using for..of
+info: |
+ Uint8ClampedArray instances should be able to be traversed using a
+ `for..of` loop, and dynamic changes to their contents should be reflected
+ in the iterated values.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Uint8ClampedArray([3, 2, 4, 1]);
+
+var first = 3;
+var second = 64;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ array[1] = 64;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/uint8clampedarray.js b/js/src/tests/test262/language/statements/for-of/uint8clampedarray.js
new file mode 100644
index 0000000000..62feb76911
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/uint8clampedarray.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4
+description: >
+ Uint8ClampedArray instances should be able to be traversed using a
+ `for..of` loop.
+features: [TypedArray]
+---*/
+
+var iterationCount = 0;
+var array = new Uint8ClampedArray([3, 2, 4, 1]);
+
+var first = 3;
+var second = 2;
+var third = 4;
+var fourth = 1;
+
+for (var x of array) {
+ assert.sameValue(x, first);
+
+ first = second;
+ second = third;
+ third = fourth;
+ fourth = null;
+
+ iterationCount += 1;
+}
+
+assert.sameValue(iterationCount, 4);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/yield-from-catch.js b/js/src/tests/test262/language/statements/for-of/yield-from-catch.js
new file mode 100644
index 0000000000..c5d18a33ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/yield-from-catch.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `yield` statements within
+ the `catch` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var dataIterator = values();
+var controlIterator = (function*() {
+ for (var x of dataIterator) {
+ try {
+ throw new Error();
+ throw new Test262Error('This code is unreachable.');
+ } catch (err) {
+ i++;
+ yield;
+ j++;
+ }
+ k++;
+ }
+
+ l++;
+})();
+var i = 0;
+var j = 0;
+var k = 0;
+var l = 0;
+
+controlIterator.next();
+assert.sameValue(i, 1, 'First iteration: pre-yield');
+assert.sameValue(j, 0, 'First iteration: post-yield');
+assert.sameValue(k, 0, 'First iteration: post-try');
+assert.sameValue(l, 0, 'First iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Second iteration: pre-yield');
+assert.sameValue(j, 1, 'Second iteration: post-yield');
+assert.sameValue(k, 1, 'Second iteration: post-try');
+assert.sameValue(l, 0, 'Second iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Third iteration: pre-yield');
+assert.sameValue(j, 2, 'Third iteration: post-yield');
+assert.sameValue(k, 2, 'Third iteration: post-try');
+assert.sameValue(l, 1, 'Third iteration: post-for-of');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/yield-from-finally.js b/js/src/tests/test262/language/statements/for-of/yield-from-finally.js
new file mode 100644
index 0000000000..f569b64420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/yield-from-finally.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `yield` statements within
+ the `finally` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var dataIterator = values();
+var controlIterator = (function*() {
+ for (var x of dataIterator) {
+ try {
+ } finally {
+ i++;
+ yield;
+ j++;
+ }
+ k++;
+ }
+
+ l++;
+})();
+var i = 0;
+var j = 0;
+var k = 0;
+var l = 0;
+
+controlIterator.next();
+assert.sameValue(i, 1, 'First iteration: pre-yield');
+assert.sameValue(j, 0, 'First iteration: post-yield');
+assert.sameValue(k, 0, 'First iteration: post-try');
+assert.sameValue(l, 0, 'First iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Second iteration: pre-yield');
+assert.sameValue(j, 1, 'Second iteration: post-yield');
+assert.sameValue(k, 1, 'Second iteration: post-try');
+assert.sameValue(l, 0, 'Second iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Third iteration: pre-yield');
+assert.sameValue(j, 2, 'Third iteration: post-yield');
+assert.sameValue(k, 2, 'Third iteration: post-try');
+assert.sameValue(l, 1, 'Third iteration: post-for-of');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/yield-from-try.js b/js/src/tests/test262/language/statements/for-of/yield-from-try.js
new file mode 100644
index 0000000000..068491f968
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/yield-from-try.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `yield` statements within
+ `try` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var dataIterator = values();
+var controlIterator = (function*() {
+ for (var x of dataIterator) {
+ try {
+ i++;
+ yield;
+ j++;
+ } catch (err) {}
+ k++;
+ }
+
+ l++;
+})();
+var i = 0;
+var j = 0;
+var k = 0;
+var l = 0;
+
+controlIterator.next();
+assert.sameValue(i, 1, 'First iteration: pre-yield');
+assert.sameValue(j, 0, 'First iteration: post-yield');
+assert.sameValue(k, 0, 'First iteration: post-try');
+assert.sameValue(l, 0, 'First iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Second iteration: pre-yield');
+assert.sameValue(j, 1, 'Second iteration: post-yield');
+assert.sameValue(k, 1, 'Second iteration: post-try');
+assert.sameValue(l, 0, 'Second iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Third iteration: pre-yield');
+assert.sameValue(j, 2, 'Third iteration: post-yield');
+assert.sameValue(k, 2, 'Third iteration: post-try');
+assert.sameValue(l, 1, 'Third iteration: post-for-of');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/yield-star-from-catch.js b/js/src/tests/test262/language/statements/for-of/yield-star-from-catch.js
new file mode 100644
index 0000000000..d1232b52ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/yield-star-from-catch.js
@@ -0,0 +1,66 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `yield *` statements
+ within the `catch` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var dataIterator = values();
+var controlIterator = (function*() {
+ for (var x of dataIterator) {
+ try {
+ throw new Error();
+ throw new Test262Error('This code is unreachable.');
+ } catch (err) {
+ i++;
+ yield * values();
+ j++;
+ }
+ k++;
+ }
+
+ l++;
+})();
+var i = 0;
+var j = 0;
+var k = 0;
+var l = 0;
+
+controlIterator.next();
+assert.sameValue(i, 1, 'First iteration: pre-yield');
+assert.sameValue(j, 0, 'First iteration: post-yield');
+assert.sameValue(k, 0, 'First iteration: post-try');
+assert.sameValue(l, 0, 'First iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 1, 'Second iteration: pre-yield');
+assert.sameValue(j, 0, 'Second iteration: post-yield');
+assert.sameValue(k, 0, 'Second iteration: post-try');
+assert.sameValue(l, 0, 'Second iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Third iteration: pre-yield');
+assert.sameValue(j, 1, 'Third iteration: post-yield');
+assert.sameValue(k, 1, 'Third iteration: post-try');
+assert.sameValue(l, 0, 'Third iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Fourth iteration: pre-yield');
+assert.sameValue(j, 1, 'Fourth iteration: post-yield');
+assert.sameValue(k, 1, 'Fourth iteration: post-try');
+assert.sameValue(l, 0, 'Fourth iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Fifth iteration: pre-yield');
+assert.sameValue(j, 2, 'Fifth iteration: post-yield');
+assert.sameValue(k, 2, 'Fifth iteration: post-try');
+assert.sameValue(l, 1, 'Fifth iteration: post-for-of');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/yield-star-from-finally.js b/js/src/tests/test262/language/statements/for-of/yield-star-from-finally.js
new file mode 100644
index 0000000000..b11ba7c3d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/yield-star-from-finally.js
@@ -0,0 +1,64 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `yield *` statements
+ within the `finally` block of `try` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var dataIterator = values();
+var controlIterator = (function*() {
+ for (var x of dataIterator) {
+ try {
+ } finally {
+ i++;
+ yield * values();
+ j++;
+ }
+ k++;
+ }
+
+ l++;
+})();
+var i = 0;
+var j = 0;
+var k = 0;
+var l = 0;
+
+controlIterator.next();
+assert.sameValue(i, 1, 'First iteration: pre-yield');
+assert.sameValue(j, 0, 'First iteration: post-yield');
+assert.sameValue(k, 0, 'First iteration: post-try');
+assert.sameValue(l, 0, 'First iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 1, 'Second iteration: pre-yield');
+assert.sameValue(j, 0, 'Second iteration: post-yield');
+assert.sameValue(k, 0, 'Second iteration: post-try');
+assert.sameValue(l, 0, 'Second iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Third iteration: pre-yield');
+assert.sameValue(j, 1, 'Third iteration: post-yield');
+assert.sameValue(k, 1, 'Third iteration: post-try');
+assert.sameValue(l, 0, 'Third iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Fourth iteration: pre-yield');
+assert.sameValue(j, 1, 'Fourth iteration: post-yield');
+assert.sameValue(k, 1, 'Fourth iteration: post-try');
+assert.sameValue(l, 0, 'Fourth iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Fifth iteration: pre-yield');
+assert.sameValue(j, 2, 'Fifth iteration: post-yield');
+assert.sameValue(k, 2, 'Fifth iteration: post-try');
+assert.sameValue(l, 1, 'Fifth iteration: post-for-of');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/yield-star-from-try.js b/js/src/tests/test262/language/statements/for-of/yield-star-from-try.js
new file mode 100644
index 0000000000..ba838353d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/yield-star-from-try.js
@@ -0,0 +1,63 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `yield *` statements
+ within `try` blocks.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var dataIterator = values();
+var controlIterator = (function*() {
+ for (var x of dataIterator) {
+ try {
+ i++;
+ yield * values();
+ j++;
+ } catch (err) {}
+ k++;
+ }
+
+ l++;
+})();
+var i = 0;
+var j = 0;
+var k = 0;
+var l = 0;
+
+controlIterator.next();
+assert.sameValue(i, 1, 'First iteration: pre-yield');
+assert.sameValue(j, 0, 'First iteration: post-yield');
+assert.sameValue(k, 0, 'First iteration: post-try');
+assert.sameValue(l, 0, 'First iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 1, 'Second iteration: pre-yield');
+assert.sameValue(j, 0, 'Second iteration: post-yield');
+assert.sameValue(k, 0, 'Second iteration: post-try');
+assert.sameValue(l, 0, 'Second iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Third iteration: pre-yield');
+assert.sameValue(j, 1, 'Third iteration: post-yield');
+assert.sameValue(k, 1, 'Third iteration: post-try');
+assert.sameValue(l, 0, 'Third iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Fourth iteration: pre-yield');
+assert.sameValue(j, 1, 'Fourth iteration: post-yield');
+assert.sameValue(k, 1, 'Fourth iteration: post-try');
+assert.sameValue(l, 0, 'Fourth iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Fifth iteration: pre-yield');
+assert.sameValue(j, 2, 'Fifth iteration: post-yield');
+assert.sameValue(k, 2, 'Fifth iteration: post-try');
+assert.sameValue(l, 1, 'Fifth iteration: post-for-of');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/yield-star.js b/js/src/tests/test262/language/statements/for-of/yield-star.js
new file mode 100644
index 0000000000..699788a190
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/yield-star.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `yield *` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var dataIterator = values();
+var controlIterator = (function*() {
+ for (var x of dataIterator) {
+ i++;
+ yield * values();
+ j++;
+ }
+
+ k++;
+})();
+var i = 0;
+var j = 0;
+var k = 0;
+
+controlIterator.next();
+assert.sameValue(i, 1, 'First iteration: pre-yield');
+assert.sameValue(j, 0, 'First iteration: post-yield');
+assert.sameValue(k, 0, 'First iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 1, 'Second iteration: pre-yield');
+assert.sameValue(j, 0, 'Second iteration: post-yield');
+assert.sameValue(k, 0, 'Second iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Third iteration: pre-yield');
+assert.sameValue(j, 1, 'Third iteration: post-yield');
+assert.sameValue(k, 0, 'Third iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Fourth iteration: pre-yield');
+assert.sameValue(j, 1, 'Fourth iteration: post-yield');
+assert.sameValue(k, 0, 'Fourth iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Fifth iteration: pre-yield');
+assert.sameValue(j, 2, 'Fifth iteration: post-yield');
+assert.sameValue(k, 1, 'Fifth iteration: post-for-of');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for-of/yield.js b/js/src/tests/test262/language/statements/for-of/yield.js
new file mode 100644
index 0000000000..fab8e89393
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-of/yield.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ Control flow during body evaluation should honor `yield` statements.
+features: [generators]
+---*/
+
+function* values() {
+ yield 1;
+ yield 1;
+}
+var dataIterator = values();
+var controlIterator = (function*() {
+ for (var x of dataIterator) {
+ i++;
+ yield;
+ j++;
+ }
+
+ k++;
+})();
+var i = 0;
+var j = 0;
+var k = 0;
+
+controlIterator.next();
+assert.sameValue(i, 1, 'First iteration: pre-yield');
+assert.sameValue(j, 0, 'First iteration: post-yield');
+assert.sameValue(k, 0, 'First iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Second iteration: pre-yield');
+assert.sameValue(j, 1, 'Second iteration: post-yield');
+assert.sameValue(k, 0, 'Second iteration: post-for-of');
+
+controlIterator.next();
+assert.sameValue(i, 2, 'Third iteration: pre-yield');
+assert.sameValue(j, 2, 'Third iteration: post-yield');
+assert.sameValue(k, 1, 'Third iteration: post-for-of');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-1.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-1.js
new file mode 100644
index 0000000000..c337a1302d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-1.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-1
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is an Object with value false
+---*/
+
+ var accessed = false;
+ var obj = { value: false };
+ for (var i = 0; obj; ) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-10.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-10.js
new file mode 100644
index 0000000000..a02e76edef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-10.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-10
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a String object (value is '1')
+---*/
+
+ var accessed = false;
+ var strObj = new String("1");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-11.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-11.js
new file mode 100644
index 0000000000..07e91cfd7d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-11.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-11
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is undefined
+---*/
+
+ var count = 0;
+ for (var i = 0; undefined;) {
+ count++;
+ }
+
+assert.sameValue(count, 0, 'count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-12.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-12.js
new file mode 100644
index 0000000000..fdaf1f751d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-12.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-12
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is null
+---*/
+
+ var count = 0;
+ for (var i = 0; null;) {
+ count++;
+ }
+
+assert.sameValue(count, 0, 'count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-13.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-13.js
new file mode 100644
index 0000000000..ae34a2917d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-13.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-13
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a boolean (value is false)
+---*/
+
+ var count = 0;
+ for (var i = 0; false;) {
+ count++;
+ }
+
+assert.sameValue(count, 0, 'count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-14.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-14.js
new file mode 100644
index 0000000000..1b455c1ac0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-14.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-14
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a number (value is NaN)
+---*/
+
+ var count = 0;
+ for (var i = 0; NaN;) {
+ count++;
+ }
+
+assert.sameValue(count, 0, 'count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-15.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-15.js
new file mode 100644
index 0000000000..26060a95d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-15.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-15
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a number (value is +0)
+---*/
+
+ var count = 0;
+ for (var i = 0; +0;) {
+ count++;
+ }
+
+assert.sameValue(count, 0, 'count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-16.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-16.js
new file mode 100644
index 0000000000..1b3125a691
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-16.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-16
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a number (value is -0)
+---*/
+
+ var count = 0;
+ for (var i = 0; -0;) {
+ count++;
+ }
+
+assert.sameValue(count, 0, 'count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-17.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-17.js
new file mode 100644
index 0000000000..4fd130f7c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-17.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-17
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a number (value is a positive)
+---*/
+
+ var accessed = false;
+ for (var i = 0; 2;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-18.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-18.js
new file mode 100644
index 0000000000..1d2676a07f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-18.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-18
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a string (value is empty string)
+---*/
+
+ var count = 0;
+ for (var i = 0; "";) {
+ count++;
+ }
+
+assert.sameValue(count, 0, 'count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-19.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-19.js
new file mode 100644
index 0000000000..6681abc773
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-19.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-19
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a string (value is 'undefined')
+---*/
+
+ var accessed = false;
+ for (var i = 0; "undefined";) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-2.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-2.js
new file mode 100644
index 0000000000..1ae1af7d08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-2.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-2
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a Boolean object
+---*/
+
+ var accessed = false;
+ var boolObj = new Boolean(false);
+ for (var i = 0; boolObj;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-20.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-20.js
new file mode 100644
index 0000000000..7b5c8cbf46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-20.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-20
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a string (value is 'null')
+---*/
+
+ var accessed = false;
+ for (var i = 0; "null";) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-21.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-21.js
new file mode 100644
index 0000000000..01cfc0da72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-21.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-21
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a string (value is '1')
+---*/
+
+ var accessed = false;
+ for (var i = 0; "1";) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-3.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-3.js
new file mode 100644
index 0000000000..8d00480e0d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-3.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-3
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a Number object (value is NaN)
+---*/
+
+ var accessed = false;
+ var numObj = new Number(NaN);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-4.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-4.js
new file mode 100644
index 0000000000..c9e9a84750
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-4.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-4
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a Number object (value is +0)
+---*/
+
+ var accessed = false;
+ var numObj = new Number(+0);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-5.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-5.js
new file mode 100644
index 0000000000..55a88c0387
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-5.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-5
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a Number object (value is -0)
+---*/
+
+ var accessed = false;
+ var numObj = new Number(-0);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-6.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-6.js
new file mode 100644
index 0000000000..78e7059eb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-6.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-6
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a Number object (value is a positive)
+---*/
+
+ var accessed = false;
+ var numObj = new Number(12);
+ for (var i = 0; numObj;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-7.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-7.js
new file mode 100644
index 0000000000..c7e9bd29d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-7.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-7
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a String object (value is empty string)
+---*/
+
+ var accessed = false;
+ var strObj = new String("");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-8.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-8.js
new file mode 100644
index 0000000000..678b538288
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-8.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-8
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a String object (value is 'undefined')
+---*/
+
+ var accessed = false;
+ var strObj = new String("undefined");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-9.js b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-9.js
new file mode 100644
index 0000000000..2fc3a7b5e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/12.6.3_2-3-a-ii-9.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 12.6.3;
+ The production
+ IterationStatement : for ( var VariableDeclarationListNoIn ; Expressionopt ; Expressionopt ) Statement
+ is evaluated as follows:
+es5id: 12.6.3_2-3-a-ii-9
+description: >
+ The for Statement - (normal, V, empty) will be returned when first
+ Expression is a String object (value is 'null')
+---*/
+
+ var accessed = false;
+ var strObj = new String("null");
+ for (var i = 0; strObj;) {
+ accessed = true;
+ break;
+ }
+
+assert(accessed, 'accessed !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A1.js
new file mode 100644
index 0000000000..ad9d1e1beb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A1.js
@@ -0,0 +1,37 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The "for {;;}" for Statement with empty expressions is allowed and leads
+ to performing an infinite loop
+es5id: 12.6.3_A1
+description: Breaking an infinite loop by throwing exception
+---*/
+
+var __in__for = 0;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ for (;;){
+ //__in__for++;
+ if(++__in__for>100)throw 1;
+}
+} catch (e) {
+ if (e !== 1) {
+ throw new Test262Error('#1: for {;;} is admitted and leads to infinite loop');
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__in__for !== 101) {
+ throw new Test262Error('#2: __in__for === 101. Actual: __in__for ==='+ __in__for );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A10.1_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A10.1_T1.js
new file mode 100644
index 0000000000..9a33fbb53e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A10.1_T1.js
@@ -0,0 +1,114 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Nested "var-loops" nine blocks depth is evaluated properly
+es5id: 12.6.3_A10.1
+description: >
+ Checking if executing nested "var-loops" nine blocks depth is
+ evaluated properly
+flags: [noStrict]
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ __in__deepest__loop=__in__deepest__loop;
+} catch (e) {
+ throw new Test262Error('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try {
+ index0=index0;
+} catch (e) {
+ throw new Test262Error('#2: "index0=index0" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+try {
+ index1=index1;
+} catch (e) {
+ throw new Test262Error('#3: "index1=index1" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+try {
+ index4=index4;
+} catch (e) {
+ throw new Test262Error('#4: "index4=index4" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+try {
+ index5=index5;
+} catch (e) {
+ throw new Test262Error('#4: "index5=index5" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#6
+try {
+ index7=index7;
+} catch (e) {
+ throw new Test262Error('#6: "index7=index7" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#7
+try {
+ index8=index8;
+} catch (e) {
+ throw new Test262Error('#7: "index8=index8" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+for( var index0=0; index0<=1; index0++) {
+ for(var index1=0; index1<=index0; index1++) {
+ for( index2=0; index2<=index1; index2++) {
+ for( index3=0; index3<=index2; index3++) {
+ for(var index4=0; index4<=index3; index4++) {
+ for(var index5=0; index5<=index4; index5++) {
+ for( index6=0; index6<=index5; index6++) {
+ for(var index7=0; index7<=index6; index7++) {
+ for(var index8=0; index8<=index1; index8++) {
+ var __in__deepest__loop;
+ __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") {
+ throw new Test262Error('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A10.1_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A10.1_T2.js
new file mode 100644
index 0000000000..cea5e89e7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A10.1_T2.js
@@ -0,0 +1,115 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Nested "var-loops" nine blocks depth is evaluated properly
+es5id: 12.6.3_A10.1
+description: >
+ Checking if executing nested "var-loops" nine blocks depth is
+ evaluated properly
+---*/
+
+var __str, index2, index3, index6;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ __in__deepest__loop=__in__deepest__loop;
+} catch (e) {
+ throw new Test262Error('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try {
+ index0=index0;
+} catch (e) {
+ throw new Test262Error('#2: "index0=index0" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+try {
+ index1=index1;
+} catch (e) {
+ throw new Test262Error('#3: "index1=index1" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+try {
+ index4=index4;
+} catch (e) {
+ throw new Test262Error('#4: "index4=index4" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+try {
+ index5=index5;
+} catch (e) {
+ throw new Test262Error('#4: "index5=index5" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#6
+try {
+ index7=index7;
+} catch (e) {
+ throw new Test262Error('#6: "index7=index7" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#7
+try {
+ index8=index8;
+} catch (e) {
+ throw new Test262Error('#7: "index8=index8" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+for( var index0=0; index0<=1; index0++) {
+ for(var index1=0; index1<=index0; index1++) {
+ for( index2=0; index2<=index1; index2++) {
+ for( index3=0; index3<=index2; index3++) {
+ for(var index4=0; index4<=index3; index4++) {
+ for(var index5=0; index5<=index4; index5++) {
+ for( index6=0; index6<=index5; index6++) {
+ for(var index7=0; index7<=index6; index7++) {
+ for(var index8=0; index8<=index1; index8++) {
+ var __in__deepest__loop;
+ __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") {
+ throw new Test262Error('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A10_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A10_T1.js
new file mode 100644
index 0000000000..6f0ba53944
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A10_T1.js
@@ -0,0 +1,54 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Nested "var-loops" nine blocks depth is evaluated properly
+es5id: 12.6.3_A10
+description: >
+ Checking if executing nested "var-loops" nine blocks depth is
+ evaluated properly
+flags: [noStrict]
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+try {
+ __in__deepest__loop=__in__deepest__loop;
+} catch (e) {
+ throw new Test262Error('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+for( index0=0; index0<=1; index0++) {
+ for( index1=0; index1<=index0; index1++) {
+ for( index2=0; index2<=index1; index2++) {
+ for( index3=0; index3<=index2; index3++) {
+ for( index4=0; index4<=index3; index4++) {
+ for( index5=0; index5<=index4; index5++) {
+ for( index6=0; index6<=index5; index6++) {
+ for( index7=0; index7<=index6; index7++) {
+ for( index8=0; index8<=index1; index8++) {
+ var __in__deepest__loop;
+ __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") {
+ throw new Test262Error('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A10_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A10_T2.js
new file mode 100644
index 0000000000..49d3a67eb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A10_T2.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Nested "var-loops" nine blocks depth is evaluated properly
+es5id: 12.6.3_A10
+description: >
+ Checking if executing nested "var-loops" nine blocks depth is
+ evaluated properly
+---*/
+
+var __str, index0, index1, index2, index3, index4, index5, index6, index7, index8;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+try {
+ __in__deepest__loop=__in__deepest__loop;
+} catch (e) {
+ throw new Test262Error('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+for( index0=0; index0<=1; index0++) {
+ for( index1=0; index1<=index0; index1++) {
+ for( index2=0; index2<=index1; index2++) {
+ for( index3=0; index3<=index2; index3++) {
+ for( index4=0; index4<=index3; index4++) {
+ for( index5=0; index5<=index4; index5++) {
+ for( index6=0; index6<=index5; index6++) {
+ for( index7=0; index7<=index6; index7++) {
+ for( index8=0; index8<=index1; index8++) {
+ var __in__deepest__loop;
+ __str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") {
+ throw new Test262Error('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T1.js
new file mode 100644
index 0000000000..b3d47480b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "continue" and (Evaluate
+ Statement).target is in the current label set, iteration of labeled
+ "var-loop" breaks
+es5id: 12.6.3_A11.1_T1
+description: Using "continue" in order to continue a loop
+---*/
+
+var __str;
+__str=""
+
+for(var index=0; index<10; index+=1) {
+ if (index<5)continue;
+ __str+=index;
+}
+
+if (__str!=="56789") {
+ throw new Test262Error('#1: __str === "56789". Actual: __str ==='+ __str );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T2.js
new file mode 100644
index 0000000000..b805332fea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T2.js
@@ -0,0 +1,64 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "continue" and (Evaluate
+ Statement).target is in the current label set, iteration of labeled
+ "var-loop" breaks
+es5id: 12.6.3_A11.1_T2
+description: Embedded loops
+---*/
+
+var __str;
+__str="";
+
+outer : for(var index=0; index<4; index+=1) {
+ nested : for(var index_n=0; index_n<=index; index_n++) {
+ if (index*index_n == 6)continue nested;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__str !== "001011202122303133") {
+ throw new Test262Error('#1: __str === "001011202122303133". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+outer : for(var index=0; index<4; index+=1) {
+ nested : for(var index_n=0; index_n<=index; index_n++) {
+ if (index*index_n == 6)continue outer;
+ __str+=""+index+index_n;
+ }
+}
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str !== "0010112021223031") {
+ throw new Test262Error('#2: __str === "0010112021223031". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+outer : for(var index=0; index<4; index+=1) {
+ nested : for(var index_n=0; index_n<=index; index_n++) {
+ if (index*index_n == 6)continue ;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__str !== "001011202122303133") {
+ throw new Test262Error('#3: __str === "001011202122303133". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T3.js b/js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T3.js
new file mode 100644
index 0000000000..c754761f9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A11.1_T3.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "continue" and (Evaluate
+ Statement).target is in the current label set, iteration of labeled
+ "var-loop" breaks
+es5id: 12.6.3_A11.1_T3
+description: Trying to continue non-existent label
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+__str="";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+outer:for(var index=0;index<4;index+=1){
+ nested:for(var index_n=0;index_n<=index;index_n++){
+ if(index*index_n == 6)continue nonexist;
+ __str+=""+index+index_n;
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A11_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A11_T1.js
new file mode 100644
index 0000000000..a60d2cf56f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A11_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "continue" and (Evaluate
+ Statement).target is in the current label set, iteration of labeled loop
+ breaks
+es5id: 12.6.3_A11_T1
+description: Simple test of continue loop with using "continue"
+---*/
+
+var __str, index;
+__str=""
+
+for(index=0; index<10; index+=1) {
+ if (index<5)continue;
+ __str+=index;
+}
+
+if (__str!=="56789") {
+ throw new Test262Error('#1: __str === "56789". Actual: __str ==='+ __str );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A11_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A11_T2.js
new file mode 100644
index 0000000000..ad315eb00a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A11_T2.js
@@ -0,0 +1,64 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "continue" and (Evaluate
+ Statement).target is in the current label set, iteration of labeled loop
+ breaks
+es5id: 12.6.3_A11_T2
+description: Embedded loops
+---*/
+
+var __str, index, index_n;
+__str="";
+
+outer : for(index=0; index<4; index+=1) {
+ nested : for(index_n=0; index_n<=index; index_n++) {
+ if (index*index_n == 6)continue nested;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__str !== "001011202122303133") {
+ throw new Test262Error('#1: __str === "001011202122303133". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+outer : for(index=0; index<4; index+=1) {
+ nested : for(index_n=0; index_n<=index; index_n++) {
+ if (index*index_n == 6)continue outer;
+ __str+=""+index+index_n;
+ }
+}
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str !== "0010112021223031") {
+ throw new Test262Error('#2: __str === "0010112021223031". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+outer : for(index=0; index<4; index+=1) {
+ nested : for(index_n=0; index_n<=index; index_n++) {
+ if (index*index_n == 6)continue ;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__str !== "001011202122303133") {
+ throw new Test262Error('#3: __str === "001011202122303133". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A11_T3.js b/js/src/tests/test262/language/statements/for/S12.6.3_A11_T3.js
new file mode 100644
index 0000000000..f122b39247
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A11_T3.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "continue" and (Evaluate
+ Statement).target is in the current label set, iteration of labeled loop
+ breaks
+es5id: 12.6.3_A11_T3
+description: Trying to continue non-existent label
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+__str="";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+outer:for(index=0;index<4;index+=1){
+ nested:for(index_n=0;index_n<=index;index_n++){
+ if(index*index_n == 6)continue nonexist;
+ __str+=""+index+index_n;
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T1.js
new file mode 100644
index 0000000000..e3d68943fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "break" and (Evaluate Statement).target
+ is in the current label set, (normal, (Evaluate Statement), empty) is
+ returned while evaluating a "var-loop"
+es5id: 12.6.3_A12.1_T1
+description: Breaking a loop with "break"
+---*/
+
+var __str;
+__str=""
+
+for(var index=0; index<10; index+=1) {
+ if (index>5)break;
+ __str+=index;
+}
+
+if (__str!=="012345") {
+ throw new Test262Error('#1: __str === "012345". Actual: __str ==='+ __str );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T2.js
new file mode 100644
index 0000000000..7d02e4afa1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T2.js
@@ -0,0 +1,65 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "break" and (Evaluate Statement).target
+ is in the current label set, (normal, (Evaluate Statement), empty) is
+ returned while evaluating a "var-loop"
+es5id: 12.6.3_A12.1_T2
+description: Embedded loops
+---*/
+
+var __str;
+__str="";
+
+outer : for(var index=0; index<4; index+=1) {
+ nested : for(var index_n=0; index_n<=index; index_n++) {
+ if (index*index_n >= 4)break nested;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__str !== "00101120213031") {
+ throw new Test262Error('#1: __str === "00101120213031". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+outer : for(var index=0; index<4; index+=1) {
+ nested : for(var index_n=0; index_n<=index; index_n++) {
+ if (index*index_n >= 4)break outer;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str !== "0010112021") {
+ throw new Test262Error('#2: __str === "0010112021". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+outer : for(var index=0; index<4; index+=1) {
+ nested : for(var index_n=0; index_n<=index; index_n++) {
+ if (index*index_n >= 4)break ;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__str !== "00101120213031") {
+ throw new Test262Error('#3: __str === "00101120213031". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T3.js b/js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T3.js
new file mode 100644
index 0000000000..1dddd219a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A12.1_T3.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "break" and (Evaluate Statement).target
+ is in the current label set, (normal, (Evaluate Statement), empty) is
+ returned while evaluating a "var-loop"
+es5id: 12.6.3_A12.1_T3
+description: Trying to break non-existent label
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+__str="";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+outer:for(var index=0;index<4;index+=1){
+ nested:for(var index_n=0;index_n<=index;index_n++){
+ if(index*index_n >= 4)break nonexist;
+ __str+=""+index+index_n;
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A12_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A12_T1.js
new file mode 100644
index 0000000000..e0b1ab218a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A12_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "break" and (Evaluate Statement).target
+ is in the current label set, (normal, (Evaluate Statement), empty) is
+ returned while evaluating a loop
+es5id: 12.6.3_A12_T1
+description: Breaking a loop with "break"
+---*/
+
+var __str, index;
+__str=""
+
+for(index=0; index<10; index+=1) {
+ if (index>5)break;
+ __str+=index;
+}
+
+if (__str!=="012345") {
+ throw new Test262Error('#1:__str === "012345". Actual: __str ==='+__str );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A12_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A12_T2.js
new file mode 100644
index 0000000000..c696a9150c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A12_T2.js
@@ -0,0 +1,65 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "break" and (Evaluate Statement).target
+ is in the current label set, (normal, (Evaluate Statement), empty) is
+ returned while evaluating a loop
+es5id: 12.6.3_A12_T2
+description: Embedded loops
+---*/
+
+var __str, index, index_n;
+__str="";
+
+outer : for(index=0; index<4; index+=1) {
+ nested : for(index_n=0; index_n<=index; index_n++) {
+ if (index*index_n >= 4)break nested;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__str !== "00101120213031") {
+ throw new Test262Error('#1: __str === "00101120213031". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+outer : for(index=0; index<4; index+=1) {
+ nested : for(index_n=0; index_n<=index; index_n++) {
+ if (index*index_n >= 4)break outer;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__str !== "0010112021") {
+ throw new Test262Error('#2: __str === "0010112021". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__str="";
+
+outer : for(index=0; index<4; index+=1) {
+ nested : for(index_n=0; index_n<=index; index_n++) {
+ if (index*index_n >= 4)break ;
+ __str+=""+index+index_n;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__str !== "00101120213031") {
+ throw new Test262Error('#3: __str === "00101120213031". Actual: __str ==='+ __str );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A12_T3.js b/js/src/tests/test262/language/statements/for/S12.6.3_A12_T3.js
new file mode 100644
index 0000000000..1b1016fb47
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A12_T3.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If (Evaluate Statement).type is "break" and (Evaluate Statement).target
+ is in the current label set, (normal, (Evaluate Statement), empty) is
+ returned while evaluating a loop
+es5id: 12.6.3_A12_T3
+description: Trying to break non-existent label
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+__str="";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+outer:for(index=0;index<4;index+=1){
+ nested:for(index_n=0;index_n<=index;index_n++){
+ if(index*index_n >= 4)break nonexist;
+ __str+=""+index+index_n;
+ }
+};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A13.js b/js/src/tests/test262/language/statements/for/S12.6.3_A13.js
new file mode 100644
index 0000000000..7ea5f84ef7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A13.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ VariableDeclaration in "var VariableDeclarationListNoIn" of for
+ IterationStatement is allowed
+es5id: 12.6.3_A13
+description: Declaring variable in "for" ExpressionNoIn
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ index = index;
+} catch (e) {
+ throw new Test262Error('#1: VariableDeclaration in "var VariableDeclarationListNoIn" of for IterationStatement is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+for(var index=0; index<6; index++) {
+ ;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A14.js b/js/src/tests/test262/language/statements/for/S12.6.3_A14.js
new file mode 100644
index 0000000000..49c3b859e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A14.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationListNoIn;
+ Expression; Expression) Statement"
+es5id: 12.6.3_A14
+description: Using +,*,/, as the second Expression
+---*/
+
+//CHECK#1
+for(var i=0;i<10;i++){}
+if (i!==10) throw new Test262Error('#1: i === 10. Actual: i ==='+ i );
+
+//CHECK#2
+var j=0;
+for(var i=1;i<10;i*=2){
+ j++;
+}
+if (i!==16) throw new Test262Error('#2.1: i === 16. Actual: i ==='+ i );
+if (j!==4) throw new Test262Error('#2.2: j === 4. Actual: j ==='+ j );
+
+//CHECK#3
+var j=0;
+for(var i=16;i>1;i=i/2){
+ j++;
+}
+if (i!==1) throw new Test262Error('#3.1: i === 1. Actual: i ==='+ i );
+if (j!==4) throw new Test262Error('#3.2: j === 4. Actual: j ==='+ j );
+
+//CHECK#4
+var j=0;
+for(var i=10;i>1;i--){
+ j++;
+}
+if (i!==1) throw new Test262Error('#4.1: i === 1. Actual: i ==='+ i );
+if (j!==9) throw new Test262Error('#4.2: j === 9. Actual: j ==='+ j );
+
+//CHECK#5
+var j=0;
+for(var i=2;i<10;i*=i){
+ j++;
+}
+if (i!==16) throw new Test262Error('#5.1: i === 16. Actual: i ==='+ i );
+if (j!==2) throw new Test262Error('#5.2: j === 2. Actual: j ==='+ j );
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A15.js b/js/src/tests/test262/language/statements/for/S12.6.3_A15.js
new file mode 100644
index 0000000000..f64d5e5cb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A15.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationListNoIn;
+ Expression; Expression) Statement"
+es5id: 12.6.3_A15
+description: Statement must be evaluated before second Expression is evaluated
+---*/
+
+//CHECK#1
+for(var i=0;i<10;i++){
+ i*=2;
+ break;
+}
+if (i!==0) throw new Test262Error('#1: i === 0. Actual: i ==='+ i );
+
+//CHECK#2
+for(var i=0;i<10;i++){
+ i*=2;
+ if (i===3) throw new Test262Error('#2: i !== 3');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A2.1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A2.1.js
new file mode 100644
index 0000000000..9eff956a4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A2.1.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ While evaluating "for (ExpressionNoIn ; ; Expression) Statement",
+ Statement is evaulated first
+es5id: 12.6.3_A2.1
+description: Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ for((function(){throw "NoInExpression"})(); ;(function(){throw "SecondExpression"})()) {
+ throw "Statement";
+ }
+ throw new Test262Error('#1: (function(){throw "NoInExpression"})() lead to throwing exception');
+} catch (e) {
+ if (e !== "NoInExpression") {
+ throw new Test262Error('#2: When for (ExpressionNoIn ; ; Expression) Statement is evaluated NoInExpression evaluates first');
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A2.2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A2.2.js
new file mode 100644
index 0000000000..fce84ba3de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A2.2.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ While evaluating "for (ExpressionNoIn;;) Statement", Statement is
+ evaulated first
+es5id: 12.6.3_A2.2
+description: Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ for((function(){throw "NoInExpression"})();;) {
+ throw "Statement";
+ }
+ throw new Test262Error('#1: (function(){throw "NoInExpression"})() lead to throwing exception');
+} catch (e) {
+ if (e !== "NoInExpression") {
+ throw new Test262Error('#1: When for (ExpressionNoIn ; ; ) Statement is evaluated NoInExpression evaluates first');
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A2.js
new file mode 100644
index 0000000000..01386e3457
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A2.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ While evaluating "for (ExpressionNoIn; Expression; Expression)
+ Statement", ExpressionNoIn is evaulated first
+es5id: 12.6.3_A2
+description: Using "(function(){throw "NoInExpression"})()" as ExpressionNoIn
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ for((function(){throw "NoInExpression";})(); (function(){throw "FirstExpression";})(); (function(){throw "SecondExpression";})()) {
+ var in_for = "reached";
+ }
+ throw new Test262Error('#1: (function(){throw "NoInExpression";})() lead to throwing exception');
+} catch (e) {
+ if (e !== "NoInExpression") {
+ throw new Test262Error('#1: When for (ExpressionNoIn ; Expression ; Expression) Statement is evaluated ExpressionNoIn evaluates first');
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (in_for !== undefined) {
+ throw new Test262Error('#2: in_for === undefined. Actual: in_for ==='+ in_for );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A3.js b/js/src/tests/test262/language/statements/for/S12.6.3_A3.js
new file mode 100644
index 0000000000..a43f6502d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A3.js
@@ -0,0 +1,46 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ While evaluating "for (ExpressionNoIn; FirstExpression; SecondExpression)
+ Statement", ExpressionNoIn is evaulated first, FirstExpressoin is
+ evaluated second
+es5id: 12.6.3_A3
+description: Using "(function(){throw "FirstExpression"})()" as FirstExpression
+---*/
+
+var __in__NotInExpression__, __in__NotInExpression__2, __in__for;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ for((function(){__in__NotInExpression__ = "checked";__in__NotInExpression__2 = "passed";})(); (function(){throw "FirstExpression"})(); (function(){throw "SecondExpression"})()) {
+ __in__for="reached";
+ }
+ throw new Test262Error('#1: (function(){throw "SecondExpression"} lead to throwing exception');
+} catch (e) {
+ if (e !== "FirstExpression") {
+ throw new Test262Error('#1: When for (ExpressionNoIn ; FirstExpression ; SecondExpression) Statement is evaluated first evaluates ExpressionNoIn then FirstExpression');
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if ((__in__NotInExpression__ !== "checked")&(__in__NotInExpression__2!=="passed")) {
+ throw new Test262Error('#2: (__in__NotInExpression__ === "checked")&(__in__NotInExpression__2==="passed")');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (typeof __in__for !== "undefined") {
+ throw new Test262Error('#3: typeof __in__for === "undefined". Actual: typeof __in__for ==='+ typeof __in__for );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A4.1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A4.1.js
new file mode 100644
index 0000000000..5eba293fbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A4.1.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "in"-expression is not allowed as a ExpressionNoIn in "for
+ (ExpressionNoIn; FirstExpression; SecondExpression) Statement"
+ IterationStatement
+es5id: 12.6.3_A4.1
+description: Checking if execution of "for (var a in arr;1;){}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+arr = [1,2,3,4,5];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for (var a in arr;1;){
+ break;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A4_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A4_T1.js
new file mode 100644
index 0000000000..0c35e9b3c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A4_T1.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "in"-expression is not allowed as a ExpressionNoIn in "for
+ (ExpressionNoIn; FirstExpression; SecondExpression) Statement"
+ IterationStatement
+es5id: 12.6.3_A4_T1
+description: Checking if execution of "for (a in arr;1;){}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+arr = [1,2,3,4,5];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for (a in arr;1;){
+ break;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A4_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A4_T2.js
new file mode 100644
index 0000000000..d91dc7cb6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A4_T2.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "in"-expression is not allowed as a ExpressionNoIn in "for
+ (ExpressionNoIn; FirstExpression; SecondExpression) Statement"
+ IterationStatement
+es5id: 12.6.3_A4_T2
+description: Checking if execution of "for (1 in arr;1;){}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+arr = [1,2,3,4,5];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for(1 in arr;1;) {
+ break;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A5.js b/js/src/tests/test262/language/statements/for/S12.6.3_A5.js
new file mode 100644
index 0000000000..326a843c48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A5.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "in"-expression wrapped into "eval" statement is allowed as a
+ ExpressionNoIn in "for (ExpressionNoIn; FirstExpression;
+ SecondExpression) Statement" IterationStatement
+es5id: 12.6.3_A5
+description: Using eval "for(eval("i in arr");1;)"
+---*/
+
+var arr, i;
+
+arr = [1,2,3,4,5];
+i = 1;
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ for(eval("i in arr");1;) {break;};
+} catch (e) {
+ throw new Test262Error('#1.1: for(eval("i in arr");1;) {break;}; does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try {
+ for(eval("var i = 1 in arr");1;) {break;};
+} catch (e) {
+ throw new Test262Error('#2.1: for(eval("var i = 1 in arr");1;) {break;}; does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+try {
+ for(eval("1 in arr");1;) {break;};
+} catch (e) {
+ throw new Test262Error('#3.1: for(eval("1 in arr");1;) {break;}; does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A6.js b/js/src/tests/test262/language/statements/for/S12.6.3_A6.js
new file mode 100644
index 0000000000..4b7333c0f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A6.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ While evaluating "for ( ; ; Expression) Statement", Statement is
+ evaluated first and then Expression is evaluated
+es5id: 12.6.3_A6
+description: Using "(function(){throw "SecondExpression";})()" as an Expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ for(;;(function(){throw "SecondExpression";})()){
+ var __in__for = "reached";
+ }
+ throw new Test262Error('#1: (function(){throw "SecondExpression"}() lead to throwing exception');
+} catch (e) {
+ if (e !== "SecondExpression") {
+ throw new Test262Error('#1: When for ( ; ; Expression) Statement is evaluated Statement evaluates first then Expression evaluates');
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__in__for !== "reached") {
+ throw new Test262Error('#2: __in__for === "reached". Actual: __in__for ==='+ __in__for );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A7.1_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A7.1_T1.js
new file mode 100644
index 0000000000..c559744eb9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A7.1_T1.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Only three expressions and two semicolons in "for(with var)" braces are allowed.
+ Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError
+es5id: 12.6.3_A7.1_T1
+description: >
+ Checking if execution of "for(var index=0; index<10; index++;
+ index--)" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for(var index=0; index<10; index++; index--);
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A7.1_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A7.1_T2.js
new file mode 100644
index 0000000000..b92537a908
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A7.1_T2.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Only three expressions and two semicolons in "for(with var)" braces are allowed.
+ Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError
+es5id: 12.6.3_A7.1_T2
+description: >
+ Checking if execution of "for(var index=0; index<10; index+=4;
+ index++; index--)" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for(var index=0; index<10; index+=4; index++; index--) ;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A7_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A7_T1.js
new file mode 100644
index 0000000000..67bbcec565
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A7_T1.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Only three expressions and two semicolons in "for" braces are allowed.
+ Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError
+es5id: 12.6.3_A7_T1
+description: >
+ Checking if execution of "for(index=0; index<10; index++;
+ index--)" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for(index=0; index<10; index++; index--) ;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A7_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A7_T2.js
new file mode 100644
index 0000000000..1c096168ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A7_T2.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Only three expressions and two semicolons in "for" braces are allowed.
+ Appearing of for (ExpressionNoIn_opt ; Expression_opt ; Expression_opt; Expression_opt; Expression_opt;) statement leads to SyntaxError
+es5id: 12.6.3_A7_T2
+description: >
+ Checking if execution of "for(index=0; index<10; index+=4;
+ index++; index--)" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for(index=0; index<10; index+=4; index++; index--) ;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T1.js
new file mode 100644
index 0000000000..0f39351c30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T1.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Blocks within "for(with var)" braces are not allowed
+es5id: 12.6.3_A8.1_T1
+description: >
+ Checking if execution of "for(var index=0; index<100; {index++;
+ index*2;}) { arr.add(""+index);}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arr = [];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for(var index=0; index<100; {index++; index*2;}) { arr.add(""+index);};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T2.js
new file mode 100644
index 0000000000..178959911f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T2.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Blocks within "for(with var)" braces are not allowed
+es5id: 12.6.3_A8.1_T2
+description: >
+ Checking if execution of "for(var index=0; {index++;index<100;};
+ index*2;) { arr.add(""+index);}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arr = [];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for(var index=0; {index++;index<100;}; index*2;) { arr.add(""+index);};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T3.js b/js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T3.js
new file mode 100644
index 0000000000..ce23f03e5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A8.1_T3.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Blocks within "for(with var)" braces are not allowed
+es5id: 12.6.3_A8.1_T3
+description: >
+ Checking if execution of "for({var index=0; index+=1;}
+ index++<=10; index*2;) { arr.add(""+index);}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arr = [];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+for({var index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A8_T1.js b/js/src/tests/test262/language/statements/for/S12.6.3_A8_T1.js
new file mode 100644
index 0000000000..d05ab70c44
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A8_T1.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Blocks within "for" braces are not allowed
+es5id: 12.6.3_A8_T1
+description: >
+ Checking if execution of "for(index=0; index<100; {index++;
+ index*2;}) { arr.add(""+index);}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arr = [];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for(index=0; index<100; {index++; index*2;}) { arr.add(""+index);};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A8_T2.js b/js/src/tests/test262/language/statements/for/S12.6.3_A8_T2.js
new file mode 100644
index 0000000000..d9723488c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A8_T2.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Blocks within "for" braces are not allowed
+es5id: 12.6.3_A8_T2
+description: >
+ Checking if execution of "for(index=0; {index++;index<100;};
+ index*2;) { arr.add(""+index);}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arr = [];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for(index=0; {index++;index<100;}; index*2;) { arr.add(""+index);};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/S12.6.3_A8_T3.js b/js/src/tests/test262/language/statements/for/S12.6.3_A8_T3.js
new file mode 100644
index 0000000000..2869385ad0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/S12.6.3_A8_T3.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Blocks within "for" braces are not allowed
+es5id: 12.6.3_A8_T3
+description: >
+ Checking if execution of "for({index=0; index+=1;} index++<=10;
+ index*2;) { arr.add(""+index);}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arr = [];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for({index=0; index+=1;} index++<=10; index*2;) { arr.add(""+index);};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/for/browser.js b/js/src/tests/test262/language/statements/for/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/browser.js
diff --git a/js/src/tests/test262/language/statements/for/cptn-decl-expr-iter.js b/js/src/tests/test262/language/statements/for/cptn-decl-expr-iter.js
new file mode 100644
index 0000000000..9785901687
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/cptn-decl-expr-iter.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.4.7
+description: >
+ Completion value when head has a declaration and a "test" expression and iteration occurs
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(varDcl).
+ 3. Return ForBodyEvaluation(the first Expression, the second Expression,
+ Statement, « », labelSet).
+
+ 13.7.4.8 Runtime Semantics: ForBodyEvaluation
+ 1. Let V = undefined.
+ [...]
+ 4. Repeat
+ a. If test is not [empty], then
+ i. Let testRef be the result of evaluating test.
+ ii. Let testValue be GetValue(testRef).
+ iii. ReturnIfAbrupt(testValue).
+ iv. If ToBoolean(testValue) is false, return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; for (var runA = true; runA; runA = false) { }'), undefined
+);
+assert.sameValue(
+ eval('2; for (var runB = true; runB; runB = false) { 3; }'), 3
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/cptn-decl-expr-no-iter.js b/js/src/tests/test262/language/statements/for/cptn-decl-expr-no-iter.js
new file mode 100644
index 0000000000..e0d0603f94
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/cptn-decl-expr-no-iter.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.4.7
+description: >
+ Completion value when head has a declaration and a "test" expression and no iteration occurs
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(varDcl).
+ 3. Return ForBodyEvaluation(the first Expression, the second Expression,
+ Statement, « », labelSet).
+
+ 13.7.4.8 Runtime Semantics: ForBodyEvaluation
+ 1. Let V = undefined.
+ [...]
+ 4. Repeat
+ a. If test is not [empty], then
+ i. Let testRef be the result of evaluating test.
+ ii. Let testValue be GetValue(testRef).
+ iii. ReturnIfAbrupt(testValue).
+ iv. If ToBoolean(testValue) is false, return NormalCompletion(V).
+---*/
+
+assert.sameValue(eval('1; for (var run = false; run; ) { }'), undefined);
+assert.sameValue(eval('2; for (var run = false; run; ) { 3; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/cptn-expr-expr-iter.js b/js/src/tests/test262/language/statements/for/cptn-expr-expr-iter.js
new file mode 100644
index 0000000000..471aa47a9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/cptn-expr-expr-iter.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.4.7
+description: >
+ Completion value when head has no declaration and a "test" expression and
+ iteration occurs
+info: |
+ IterationStatement :
+ for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement
+
+ 1. If the first Expression is present, then
+ a. Let exprRef be the result of evaluating the first Expression.
+ b. Let exprValue be GetValue(exprRef).
+ c. ReturnIfAbrupt(exprValue).
+ 2. Return ForBodyEvaluation(the second Expression, the third Expression,
+ Statement, « », labelSet).
+
+ 13.7.4.8 Runtime Semantics: ForBodyEvaluation
+ 1. Let V = undefined.
+ [...]
+ 4. Repeat
+ a. If test is not [empty], then
+ i. Let testRef be the result of evaluating test.
+ ii. Let testValue be GetValue(testRef).
+ iii. ReturnIfAbrupt(testValue).
+ iv. If ToBoolean(testValue) is false, return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('var runA; 1; for (runA = true; runA; runA = false) { }'), undefined
+);
+assert.sameValue(
+ eval('var runB; 2; for (runB = true; runB; runB = false) { 3; }'), 3
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/cptn-expr-expr-no-iter.js b/js/src/tests/test262/language/statements/for/cptn-expr-expr-no-iter.js
new file mode 100644
index 0000000000..9397a63d5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/cptn-expr-expr-no-iter.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.4.7
+description: >
+ Completion value when head has no declaration and a "test" expression and no iteration occurs
+info: |
+ IterationStatement :
+ for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement
+
+ 1. If the first Expression is present, then
+ a. Let exprRef be the result of evaluating the first Expression.
+ b. Let exprValue be GetValue(exprRef).
+ c. ReturnIfAbrupt(exprValue).
+ 2. Return ForBodyEvaluation(the second Expression, the third Expression,
+ Statement, « », labelSet).
+
+ 13.7.4.8 Runtime Semantics: ForBodyEvaluation
+ 1. Let V = undefined.
+ [...]
+ 4. Repeat
+ a. If test is not [empty], then
+ i. Let testRef be the result of evaluating test.
+ ii. Let testValue be GetValue(testRef).
+ iii. ReturnIfAbrupt(testValue).
+ iv. If ToBoolean(testValue) is false, return NormalCompletion(V).
+---*/
+
+assert.sameValue(eval('1; for ( ; false; ) { }'), undefined);
+assert.sameValue(eval('2; for ( ; false; ) { 3; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/decl-async-fun.js b/js/src/tests/test262/language/statements/for/decl-async-fun.js
new file mode 100644
index 0000000000..4e3999054d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/decl-async-fun.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+for ( ; false; ) async function f() {}
diff --git a/js/src/tests/test262/language/statements/for/decl-async-gen.js b/js/src/tests/test262/language/statements/for/decl-async-gen.js
new file mode 100644
index 0000000000..5cdc92d353
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/decl-async-gen.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+for ( ; false; ) async function* g() {}
diff --git a/js/src/tests/test262/language/statements/for/decl-cls.js b/js/src/tests/test262/language/statements/for/decl-cls.js
new file mode 100644
index 0000000000..7bed947edd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/decl-cls.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-for-statement
+es6id: 13.7.4
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ( ; false; ) class C {}
diff --git a/js/src/tests/test262/language/statements/for/decl-const.js b/js/src/tests/test262/language/statements/for/decl-const.js
new file mode 100644
index 0000000000..80e7509f65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/decl-const.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-for-statement
+es6id: 13.7.4
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ( ; false; ) const x = null;
diff --git a/js/src/tests/test262/language/statements/for/decl-fun.js b/js/src/tests/test262/language/statements/for/decl-fun.js
new file mode 100644
index 0000000000..edf212db56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/decl-fun.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Function declaration not allowed in statement position
+esid: sec-for-statement
+es6id: 13.7.4
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ( ; false; ) function f() {}
diff --git a/js/src/tests/test262/language/statements/for/decl-gen.js b/js/src/tests/test262/language/statements/for/decl-gen.js
new file mode 100644
index 0000000000..94de156ced
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/decl-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-for-statement
+es6id: 13.7.4
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+for ( ; false; ) function* g() {}
diff --git a/js/src/tests/test262/language/statements/for/decl-let.js b/js/src/tests/test262/language/statements/for/decl-let.js
new file mode 100644
index 0000000000..626d01ff39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/decl-let.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-for-statement
+es6id: 13.7.4
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+for ( ; false; ) let x;
diff --git a/js/src/tests/test262/language/statements/for/dstr/browser.js b/js/src/tests/test262/language/statements/for/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-close.js
new file mode 100644
index 0000000000..82b8dcccb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [x] = iter; iterCount < 1; ) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..a8a6141051
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Abrupt completion returned by GetIterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ for (const [x, y, z] = [1, 2, 3]; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..b2d551a7f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-get-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Abrupt completion returned by GetIterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ for (const [x] = iter; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..f2a591d689
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [x] = iter; iterCount < 1; ) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-name-iter-val.js
new file mode 100644
index 0000000000..1155e61c1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding with normal value iteration (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..d9ae3db7bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [[x, y, z] = [4, 5, 6]] = []; iterCount < 1; ) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..8aeffa2527
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]; iterCount < 1; ) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..633be24808
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [[,] = g()] = []; iterCount < 1; ) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..d99f5f3c9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [[,] = g()] = [[]]; iterCount < 1; ) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..9d0d0edbfd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [[] = function() { initCount += 1; return iter; }()] = []; iterCount < 1; ) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..41cb484112
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [[] = function() { initCount += 1; }()] = [[23]]; iterCount < 1; ) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..e999f90e58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [[...x] = values] = []; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..cf579a270b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [[...x] = function() { initCount += 1; }()] = [values]; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..9d27df4662
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Nested array destructuring with a null value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const [[x]] = [null]; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..bd92b0f02f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Destructuring initializer with an exhausted iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [x = 23] = []; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..e799ee7f5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [arrow = () => {}] = []; iterCount < 1; ) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..e51e737b3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []; iterCount < 1; ) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..982e819c20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [cover = (function () {}), xCover = (0, function() {})] = []; iterCount < 1; ) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..ed27fff8c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [fn = function () {}, xFn = function x() {}] = []; iterCount < 1; ) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..34ecbf8f24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// 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-const.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [gen = function* () {}, xGen = function* x() {}] = []; iterCount < 1; ) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..eb79898c9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Destructuring initializer with a "hole" (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [x = 23] = [,]; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+ // another statement
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..2ee1c9d75a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']; iterCount < 1; ) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..0196c4863f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Destructuring initializer returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ for (const [x = (function() { throw new Test262Error(); })()] = [undefined]; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..40ffe0553d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Destructuring initializer with an undefined value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [x = 23] = [undefined]; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..dfacdf5de4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (const [ x = unresolvableReference ] = []; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..b897e7ee3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding when value iteration completes (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [x] = []; iterCount < 1; ) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..36b1422ed1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [_, x] = []; iterCount < 1; ) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..a728f01648
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (const [x] = g; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..98ae3362c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var iterCount = 0;
+
+for (const [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..81fcf8b192
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (const [x] = g; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..bca24af5b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..3aa212bb2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [{ x, y, z } = { x: 44, y: 55, z: 66 }] = []; iterCount < 1; ) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..8f19eb03d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]; iterCount < 1; ) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..daa57464db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..7af2967d3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..a3327710d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Nested object destructuring with a null value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const [{ x }] = [null]; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..6c8646eecd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Nested object destructuring with a value of `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const [{ x }] = []; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..cf5b500fb9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Elision accepts exhausted iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [,] = iter; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..711f4efb8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding/iter-close/for-const.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (const [,] = iter; ; ) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..a0ee1f3409
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision-step-err.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (const [,] = iter; ; ) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-elision.js
new file mode 100644
index 0000000000..dacc91f8e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Elision advances iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [,] = g(); iterCount < 1; ) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-empty.js
new file mode 100644
index 0000000000..511fcbbd64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [] = iter; iterCount < 1; ) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..8dc450d5eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Rest element containing an array BindingElementList pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [...[x, y, z]] = [3, 4, 5]; iterCount < 1; ) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..b32cf05e5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Rest element containing an elision (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [...[,]] = g(); iterCount < 1; ) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..6f2bed0ff0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Rest element containing an "empty" array pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [...[]] = iter; iterCount < 1; ) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..916036de12
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Rest element containing a rest element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [...[...x]] = values; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..27cf937eb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Lone rest element (direct binding) (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var iterCount = 0;
+
+for (const [...x] = [1]; iterCount < 1; ) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..0f9ff83330
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Rest element following elision elements (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ for (const [, ...x] = iter; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..661a007a00
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Rest element following elision elements (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [ , , ...x] = values; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..7535e7ad0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: RestElement applied to an exhausted iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [, , ...x] = [1, 2]; iterCount < 1; ) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..6944224356
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding/iter-close/for-const.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (const [...x] = iter; ; ) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..08002818b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (const [...x] = iter; ; ) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..3bd553bc52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (const [...x] = iter; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..fb77daed83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Lone rest element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [...x] = values; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..4110b965a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...[ x ] = []] = []; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..dcb35c356c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Rest element (identifier) does not support initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...x = []] = []; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..5af8cddb87
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...{ x } = []] = []; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..585619c48f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...[x], y] = [1, 2, 3]; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..df2ffe4347
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Rest element (identifier) may not be followed by any element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...x, y] = [1, 2, 3]; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..b8fdc570ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (const [...{ x }, y] = [1, 2, 3]; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..07b35b16ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Rest element containing an object binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const [...{ length }] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..6a9e1e0d4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Rest element containing an object binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+
+for (const [...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]; iterCount < 1; ) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-init-null.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-init-null.js
new file mode 100644
index 0000000000..68ef6e2d0b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-init-null.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const {} = null; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-init-undefined.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-init-undefined.js
new file mode 100644
index 0000000000..ad8c5af4da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-init-undefined.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ for (const {} = undefined; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-empty.js
new file mode 100644
index 0000000000..bf2a673944
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const {} = obj; iterCount < 1; ) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..03babd9f86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (const { poisoned } = poisonedProperty; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..994be64197
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { arrow = () => {} } = {}; iterCount < 1; ) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..1c74976df0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}; iterCount < 1; ) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..948ebc828b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { cover = (function () {}), xCover = (0, function() {}) } = {}; iterCount < 1; ) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..126b172d8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { fn = function () {}, xFn = function x() {} } = {}; iterCount < 1; ) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..d911b27e27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,64 @@
+// 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-const.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { gen = function* () {}, xGen = function* x() {} } = {}; iterCount < 1; ) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..221f28a559
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }; iterCount < 1; ) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..e06d8b8ade
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Error thrown when evaluating the initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (const { x = thrower() } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..ac987849aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (const { x = unresolvableReference } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..4dff9fa61b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var iterCount = 0;
+
+for (const { x, } = { x: 23 }; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..a4b4e86927
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-list-err.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (const { a, b = thrower(), c = ++initCount } = {}; ; ) {
+ return;
+ }
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..7aedeedf91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { w: [x, y, z] = [4, 5, 6] } = {}; iterCount < 1; ) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..ec65932309
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var iterCount = 0;
+
+for (const { x: [y], } = { x: [45] }; iterCount < 1; ) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..f411e7aa64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (const { w: [x, y, z] = [4, 5, 6] } = { w: null }; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..38ccfb74e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }; iterCount < 1; ) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..4a827b7bc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Evaluation of property name returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (const { [thrower()]: x } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..5a3b29e4e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (const { poisoned: x = ++initEvalCount } = poisonedProperty; ; ) {
+ return;
+ }
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..0368f83485
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..408eed7502
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Error thrown when evaluating the initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (const { x: y = thrower() } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..946f6274bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (const { x: y = unresolvableReference } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..0ec7e0c7e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+for (const { x: y = 33 } = { }; iterCount < 1; ) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..17c0198427
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var iterCount = 0;
+
+for (const { x: y, } = { x: 23 }; iterCount < 1; ) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..9fe44433ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Binding as specified via property name and identifier (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+for (const { x: y } = { x: 23 }; iterCount < 1; ) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..01c5de1836
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }; iterCount < 1; ) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..0074f7be11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..bde5850380
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/for-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (const { w: { x, y, z } = undefined } = { }; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..0952820109
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (const { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }; iterCount < 1; ) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..0c1e3bac81
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-getter.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/for-const.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+var count = 0;
+
+var iterCount = 0;
+
+for (const {...x} = { get v() { count++; return 2; } }; iterCount < 1; ) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..cc1e0ba07a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var iterCount = 0;
+
+for (const {...rest} = o; iterCount < 1; ) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for/dstr/const-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..5e5831fcc4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/const-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-const.template
+/*---
+description: Rest object contains just unextracted data (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+
+var iterCount = 0;
+
+for (const {a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}; iterCount < 1; ) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-close.js
new file mode 100644
index 0000000000..b46d5fd597
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [x] = iter; iterCount < 1; ) {
+ assert.sameValue(doneCallCount, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..beb50ef2c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Abrupt completion returned by GetIterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ for (let [x, y, z] = [1, 2, 3]; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..790cc5eb81
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-get-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Abrupt completion returned by GetIterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ for (let [x] = iter; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..245bc645cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [x] = iter; iterCount < 1; ) {
+ assert.sameValue(doneCallCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-name-iter-val.js
new file mode 100644
index 0000000000..b4b1112b23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding with normal value iteration (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..0f3756a158
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [[x, y, z] = [4, 5, 6]] = []; iterCount < 1; ) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..94de4d43ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]; iterCount < 1; ) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..445298a95b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [[,] = g()] = []; iterCount < 1; ) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..99458724a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [[,] = g()] = [[]]; iterCount < 1; ) {
+ assert.sameValue(callCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..3c9585ccf5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [[] = function() { initCount += 1; return iter; }()] = []; iterCount < 1; ) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..466820ed07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [[] = function() { initCount += 1; }()] = [[23]]; iterCount < 1; ) {
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..436a374073
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [[...x] = values] = []; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..a7d995ea65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [[...x] = function() { initCount += 1; }()] = [values]; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..635ba4adb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Nested array destructuring with a null value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let [[x]] = [null]; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..b295973196
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Destructuring initializer with an exhausted iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [x = 23] = []; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..94209b3b63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [arrow = () => {}] = []; iterCount < 1; ) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..b46b359b97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []; iterCount < 1; ) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..d65aab5bd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [cover = (function () {}), xCover = (0, function() {})] = []; iterCount < 1; ) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..69cdf63467
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [fn = function () {}, xFn = function x() {}] = []; iterCount < 1; ) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..4e070e3c7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// 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-let.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [gen = function* () {}, xGen = function* x() {}] = []; iterCount < 1; ) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..f13bdb02ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Destructuring initializer with a "hole" (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [x = 23] = [,]; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+ // another statement
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..03debf5045
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']; iterCount < 1; ) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..641a491813
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Destructuring initializer returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ for (let [x = (function() { throw new Test262Error(); })()] = [undefined]; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..832c202585
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Destructuring initializer with an undefined value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [x = 23] = [undefined]; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..d15504afe8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (let [ x = unresolvableReference ] = []; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..4bce1d556a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding when value iteration completes (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [x] = []; iterCount < 1; ) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..8205a32305
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [_, x] = []; iterCount < 1; ) {
+ assert.sameValue(x, undefined);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..9eba7c8eaf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (let [x] = g; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..008f32cf8d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var iterCount = 0;
+
+for (let [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..62d54f3f50
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (let [x] = g; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..cea92a6f26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..02f6a50032
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [{ x, y, z } = { x: 44, y: 55, z: 66 }] = []; iterCount < 1; ) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..6ce4298e86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]; iterCount < 1; ) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..ddb13b3454
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..82aa90dc5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..14454e0d69
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Nested object destructuring with a null value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let [{ x }] = [null]; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..503cf609ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Nested object destructuring with a value of `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let [{ x }] = []; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..1f500678fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Elision accepts exhausted iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [,] = iter; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..b7925772cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding/iter-close/for-let.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (let [,] = iter; ; ) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..6b8e6d793d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision-step-err.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (let [,] = iter; ; ) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-elision.js
new file mode 100644
index 0000000000..ee609a1dfd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Elision advances iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [,] = g(); iterCount < 1; ) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-empty.js
new file mode 100644
index 0000000000..113b950db5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [] = iter; iterCount < 1; ) {
+ assert.sameValue(iterations, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..b4de8e4e9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Rest element containing an array BindingElementList pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [...[x, y, z]] = [3, 4, 5]; iterCount < 1; ) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..df1a046293
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Rest element containing an elision (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [...[,]] = g(); iterCount < 1; ) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..1527a0298f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Rest element containing an "empty" array pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [...[]] = iter; iterCount < 1; ) {
+ assert.sameValue(iterations, 1);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..2538b698a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Rest element containing a rest element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [...[...x]] = values; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..fb4bf0d235
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Lone rest element (direct binding) (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var iterCount = 0;
+
+for (let [...x] = [1]; iterCount < 1; ) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..a4e11ba5fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Rest element following elision elements (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ for (let [, ...x] = iter; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..51e1dcf888
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Rest element following elision elements (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [ , , ...x] = values; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..cc520886d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: RestElement applied to an exhausted iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [, , ...x] = [1, 2]; iterCount < 1; ) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..6eeeced81b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding/iter-close/for-let.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (let [...x] = iter; ; ) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..42349f9537
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (let [...x] = iter; ; ) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..4438a09945
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (let [...x] = iter; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..43336a1d31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Lone rest element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [...x] = values; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..38325cc35e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...[ x ] = []] = []; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..7807b11e6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Rest element (identifier) does not support initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...x = []] = []; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..dbec97b0d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...{ x } = []] = []; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..f6429d3d3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...[x], y] = [1, 2, 3]; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..43e6e4c30c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Rest element (identifier) may not be followed by any element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...x, y] = [1, 2, 3]; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..eb725cba74
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (let [...{ x }, y] = [1, 2, 3]; iterCount < 1; ) {
+
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..334c180952
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Rest element containing an object binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let [...{ length }] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(length, 3);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..475e677ed7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Rest element containing an object binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+
+for (let [...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]; iterCount < 1; ) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-init-null.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-init-null.js
new file mode 100644
index 0000000000..1248850347
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-init-null.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let {} = null; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-init-undefined.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-init-undefined.js
new file mode 100644
index 0000000000..18f71d6b61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-init-undefined.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ for (let {} = undefined; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-empty.js
new file mode 100644
index 0000000000..d2135e7d4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let {} = obj; iterCount < 1; ) {
+ assert.sameValue(accessCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..4505dcd718
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (let { poisoned } = poisonedProperty; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..454e3b9376
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { arrow = () => {} } = {}; iterCount < 1; ) {
+ assert.sameValue(arrow.name, 'arrow');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..a70b17f042
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}; iterCount < 1; ) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..252de0a8a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { cover = (function () {}), xCover = (0, function() {}) } = {}; iterCount < 1; ) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..aa0f6e57f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { fn = function () {}, xFn = function x() {} } = {}; iterCount < 1; ) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..ed3020e4d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,64 @@
+// 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-let.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { gen = function* () {}, xGen = function* x() {} } = {}; iterCount < 1; ) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..591115ef56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }; iterCount < 1; ) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..01a86e5636
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Error thrown when evaluating the initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (let { x = thrower() } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..06ece3e50a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (let { x = unresolvableReference } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..c547644141
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var iterCount = 0;
+
+for (let { x, } = { x: 23 }; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..4683057f6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-list-err.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (let { a, b = thrower(), c = ++initCount } = {}; ; ) {
+ return;
+ }
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..bc6f8e301d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { w: [x, y, z] = [4, 5, 6] } = {}; iterCount < 1; ) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..61f0b2b0d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var iterCount = 0;
+
+for (let { x: [y], } = { x: [45] }; iterCount < 1; ) {
+ assert.sameValue(y,45);
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..ce9f1306e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (let { w: [x, y, z] = [4, 5, 6] } = { w: null }; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..9b25e5eee4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }; iterCount < 1; ) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..62215ef8fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Evaluation of property name returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (let { [thrower()]: x } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..908a2439d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (let { poisoned: x = ++initEvalCount } = poisonedProperty; ; ) {
+ return;
+ }
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..5225a15d39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..3c16194865
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Error thrown when evaluating the initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (let { x: y = thrower() } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..188d9619ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (let { x: y = unresolvableReference } = {}; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..dd7e1eeede
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+for (let { x: y = 33 } = { }; iterCount < 1; ) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..4acce0897b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var iterCount = 0;
+
+for (let { x: y, } = { x: 23 }; iterCount < 1; ) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..91b06b0970
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Binding as specified via property name and identifier (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+for (let { x: y } = { x: 23 }; iterCount < 1; ) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..69d56260eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }; iterCount < 1; ) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..c37923195d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..5c576e9690
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/for-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (let { w: { x, y, z } = undefined } = { }; ; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..1b5c431d45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-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-let.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+for (let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }; iterCount < 1; ) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..9fc329218a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-getter.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/for-let.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+var count = 0;
+
+var iterCount = 0;
+
+for (let {...x} = { get v() { count++; return 2; } }; iterCount < 1; ) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..a96b4e8c1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/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-let.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var iterCount = 0;
+
+for (let {...rest} = o; iterCount < 1; ) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for/dstr/let-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..e951bc1079
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/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-let.template
+/*---
+description: Rest object contains just unextracted data (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ [...]
+ 7. Let forDcl be the result of evaluating LexicalDeclaration.
+ [...]
+
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+
+ BindingList : BindingList , LexicalBinding
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating LexicalBinding.
+
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context’s LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+
+var iterCount = 0;
+
+for (let {a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}; iterCount < 1; ) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/shell.js b/js/src/tests/test262/language/statements/for/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-close.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-close.js
new file mode 100644
index 0000000000..129718d89c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-close.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [x] = iter; iterCount < 1; ) {
+ assert.sameValue(doneCallCount, 1);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..9f73854ed4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Abrupt completion returned by GetIterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ for (var [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..e85b650ba3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-get-err.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Abrupt completion returned by GetIterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ for (var [x] = iter; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..e732e7cb2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-init-iter-no-close.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [x] = iter; iterCount < 1; ) {
+ assert.sameValue(doneCallCount, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-name-iter-val.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-name-iter-val.js
new file mode 100644
index 0000000000..2ed173c001
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-name-iter-val.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: SingleNameBinding with normal value iteration (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..0c1dca7ab5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [[x, y, z] = [4, 5, 6]] = []; iterCount < 1; ) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..63683edd92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]; iterCount < 1; ) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..aabe9affb1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [[,] = g()] = []; iterCount < 1; ) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..2b1d75eaed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [[,] = g()] = [[]]; iterCount < 1; ) {
+ assert.sameValue(callCount, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..ccf471099b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [[] = function() { initCount += 1; return iter; }()] = []; iterCount < 1; ) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..4a13b8f650
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [[] = function() { initCount += 1; }()] = [[23]]; iterCount < 1; ) {
+ assert.sameValue(initCount, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..fdc4dd526f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [[...x] = values] = []; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..bf23b35010
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [[...x] = function() { initCount += 1; }()] = [values]; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..b43a20b073
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Nested array destructuring with a null value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var [[x]] = [null]; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..d68bc7555f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Destructuring initializer with an exhausted iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [x = 23] = []; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..50f5ad59e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,56 @@
+// 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-var.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [arrow = () => {}] = []; iterCount < 1; ) {
+ assert.sameValue(arrow.name, 'arrow');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..5417255ee2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,58 @@
+// 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-var.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []; iterCount < 1; ) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..a6a29e3811
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,57 @@
+// 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-var.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [cover = (function () {}), xCover = (0, function() {})] = []; iterCount < 1; ) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..28282c1ce4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,57 @@
+// 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-var.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [fn = function () {}, xFn = function x() {}] = []; iterCount < 1; ) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..d4f6ed5d07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,58 @@
+// 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-var.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [gen = function* () {}, xGen = function* x() {}] = []; iterCount < 1; ) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..02e831cb1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Destructuring initializer with a "hole" (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [x = 23] = [,]; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+ // another statement
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..e722b63540
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']; iterCount < 1; ) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..954647a2c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Destructuring initializer returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ for (var [x = (function() { throw new Test262Error(); })()] = [undefined]; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..0735d20017
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Destructuring initializer with an undefined value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [x = 23] = [undefined]; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..e4d31ce81e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (var [ x = unresolvableReference ] = []; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..8295a4f98a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: SingleNameBinding when value iteration completes (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [x] = []; iterCount < 1; ) {
+ assert.sameValue(x, undefined);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..1ce24f3e06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [_, x] = []; iterCount < 1; ) {
+ assert.sameValue(x, undefined);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..a44a5fabc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var [x] = g; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..2ac8c9c875
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var iterCount = 0;
+
+for (var [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..094dd242f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var [x] = g; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..e0a769ee4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [x, y, z] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..dc2ab3aee9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [{ x, y, z } = { x: 44, y: 55, z: 66 }] = []; iterCount < 1; ) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..0c8e34f38f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]; iterCount < 1; ) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..8c8e23edf5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,66 @@
+// 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-var.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..5a4b153ba5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..216a04f957
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Nested object destructuring with a null value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var [{ x }] = [null]; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..2f9539ef9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Nested object destructuring with a value of `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var [{ x }] = []; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..0a2f99fa8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Elision accepts exhausted iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [,] = iter; iterCount < 1; ) {
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-iter-close.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-iter-close.js
new file mode 100644
index 0000000000..99ebd655bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-iter-close.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-iter-close.case
+// - src/dstr-binding/iter-close/for-var.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (var [,] = iter; ; ) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..34f3d448a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision-step-err.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (var [,] = iter; iterCount < 1; ) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision.js
new file mode 100644
index 0000000000..2a811a9707
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-elision.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Elision advances iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [,] = g(); iterCount < 1; ) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-empty.js
new file mode 100644
index 0000000000..444d963a19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-empty.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [] = iter; iterCount < 1; ) {
+ assert.sameValue(iterations, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..6d614de849
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element containing an array BindingElementList pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [...[x, y, z]] = [3, 4, 5]; iterCount < 1; ) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..881d70548b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,83 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element containing an elision (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [...[,]] = g(); iterCount < 1; ) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..ca48e43467
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element containing an "empty" array pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [...[]] = iter; iterCount < 1; ) {
+ assert.sameValue(iterations, 1);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..c8c9fdeb91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element containing a rest element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [...[...x]] = values; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..942a0ed9ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Lone rest element (direct binding) (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var iterCount = 0;
+
+for (var [...x] = [1]; iterCount < 1; ) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..c3fa1a7240
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Rest element following elision elements (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ for (var [, ...x] = iter; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..7bedba63d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element following elision elements (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [ , , ...x] = values; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..8581df1c5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: RestElement applied to an exhausted iterator (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [, , ...x] = [1, 2]; iterCount < 1; ) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-close.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-close.js
new file mode 100644
index 0000000000..58e80c4044
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-close.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-close.case
+// - src/dstr-binding/iter-close/for-var.template
+/*---
+description: The iterator is properly consumed by the destructuring pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+---*/
+const iter = (function* () {
+ yield;
+ yield;
+})();
+
+
+function fn() {
+ for (var [...x] = iter; ; ) {
+ return;
+ }
+}
+
+fn();
+
+assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..be83886322
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ for (var [...x] = iter; iterCount < 1; ) {
+ return;
+ }
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..602a318e7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ for (var [...x] = iter; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..eeb55e48b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-id.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Lone rest element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [...x] = values; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..6926feb507
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,51 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...[ x ] = []] = []; iterCount < 1; ) {
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..1ad10c2b12
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-id.js
@@ -0,0 +1,51 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element (identifier) does not support initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...x = []] = []; iterCount < 1; ) {
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..dcf432fd60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,51 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...{ x } = []] = []; iterCount < 1; ) {
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..5f394ad50c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,51 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...[x], y] = [1, 2, 3]; iterCount < 1; ) {
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..86435acbf7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,51 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element (identifier) may not be followed by any element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...x, y] = [1, 2, 3]; iterCount < 1; ) {
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..618185a34a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,51 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var iterCount = 0;
+
+for (var [...{ x }, y] = [1, 2, 3]; iterCount < 1; ) {
+
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..8045fb2d8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element containing an object binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var [...{ length }] = [1, 2, 3]; iterCount < 1; ) {
+ assert.sameValue(length, 3);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..f73b4052f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest element containing an object binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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.
+ [...]
+---*/
+let length = "outer";
+
+var iterCount = 0;
+
+for (var [...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]; iterCount < 1; ) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-init-null.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-init-null.js
new file mode 100644
index 0000000000..0525eb1192
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-init-null.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var {} = null; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-init-undefined.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-init-undefined.js
new file mode 100644
index 0000000000..6bdd7b18d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-init-undefined.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ for (var {} = undefined; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-empty.js
new file mode 100644
index 0000000000..de5dd79e18
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-empty.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var {} = obj; iterCount < 1; ) {
+ assert.sameValue(accessCount, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..3db67066c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (var { poisoned } = poisonedProperty; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..8d63ad21ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,55 @@
+// 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-var.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { arrow = () => {} } = {}; iterCount < 1; ) {
+ assert.sameValue(arrow.name, 'arrow');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..75598dad43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,57 @@
+// 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-var.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}; iterCount < 1; ) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..eb56cfa0d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,56 @@
+// 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-var.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { cover = (function () {}), xCover = (0, function() {}) } = {}; iterCount < 1; ) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..40f1d9ce0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,56 @@
+// 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-var.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { fn = function () {}, xFn = function x() {} } = {}; iterCount < 1; ) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..68de800a76
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,57 @@
+// 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-var.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { gen = function* () {}, xGen = function* x() {} } = {}; iterCount < 1; ) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..d03ad26240
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }; iterCount < 1; ) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..660bfe92d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-throws.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Error thrown when evaluating the initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (var { x = thrower() } = {}; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..e3527c794d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (var { x = unresolvableReference } = {}; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..d3cb7fa306
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var iterCount = 0;
+
+for (var { x, } = { x: 23 }; iterCount < 1; ) {
+ assert.sameValue(x, 23);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..09dc7e4dfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-list-err.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (var { a, b = thrower(), c = ++initCount } = {}; iterCount < 1; ) {
+ return;
+ }
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..ad154a1618
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { w: [x, y, z] = [4, 5, 6] } = {}; iterCount < 1; ) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..525a68a8a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var iterCount = 0;
+
+for (var { x: [y], } = { x: [45] }; iterCount < 1; ) {
+ assert.sameValue(y,45);
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..fbff3585f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (var { w: [x, y, z] = [4, 5, 6] } = { w: null }; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..3c4262b248
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-ary.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }; iterCount < 1; ) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..12c7faab71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Evaluation of property name returns an abrupt completion (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (var { [thrower()]: x } = {}; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..c6e9060bac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ for (var { poisoned: x = ++initEvalCount } = poisonedProperty; iterCount < 1; ) {
+ return;
+ }
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..596f91b9ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }; iterCount < 1; ) {
+ 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;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..54c7598640
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Error thrown when evaluating the initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ for (var { x: y = thrower() } = {}; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..ef159092f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Destructuring initializer is an unresolvable reference (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ for (var { x: y = unresolvableReference } = {}; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..d385a4da51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-init.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+for (var { x: y = 33 } = { }; iterCount < 1; ) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..ec712d14ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var iterCount = 0;
+
+for (var { x: y, } = { x: 23 }; iterCount < 1; ) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..54e457a1d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-id.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Binding as specified via property name and identifier (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var iterCount = 0;
+
+for (var { x: y } = { x: 23 }; iterCount < 1; ) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..ecd9bcfe9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }; iterCount < 1; ) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..35b6b5a780
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..e7c991650d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/for-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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.
+---*/
+
+assert.throws(TypeError, function() {
+ for (var { w: { x, y, z } = undefined } = { }; iterCount < 1; ) {
+ return;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..d08728ab0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-prop-obj.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined 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;
+
+for (var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }; iterCount < 1; ) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..7deeeb3097
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-getter.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+---*/
+var count = 0;
+
+var iterCount = 0;
+
+for (var {...x} = { get v() { count++; return 2; } }; iterCount < 1; ) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..b20ee225cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var iterCount = 0;
+
+for (var {...rest} = o; iterCount < 1; ) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..ff4410b29a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/dstr/var-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/for-var.template
+/*---
+description: Rest object contains just unextracted data (for statement)
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ IterationStatement :
+ for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
+
+ 1. Let varDcl be the result of evaluating VariableDeclarationList.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclarationList : VariableDeclarationList , VariableDeclaration
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return the result of evaluating VariableDeclaration.
+
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for BindingPattern
+ passing rval and undefined as arguments.
+---*/
+
+var iterCount = 0;
+
+for (var {a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}; iterCount < 1; ) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1, 'Iteration occurred as expected');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-const-bound-names-in-stmt.js b/js/src/tests/test262/language/statements/for/head-const-bound-names-in-stmt.js
new file mode 100644
index 0000000000..46206a83aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-const-bound-names-in-stmt.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The body may not re-declare variables declared in the head
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ It is a Syntax Error if any element of the BoundNames of LexicalDeclaration
+ also occurs in the VarDeclaredNames of Statement.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-for-statement
+es6id: 13.7.4
+---*/
+
+$DONOTEVALUATE();
+
+for (const x = 0; false; ) {
+ var x;
+}
diff --git a/js/src/tests/test262/language/statements/for/head-const-fresh-binding-per-iteration.js b/js/src/tests/test262/language/statements/for/head-const-fresh-binding-per-iteration.js
new file mode 100644
index 0000000000..9d19cb4276
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-const-fresh-binding-per-iteration.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ const ForDeclaration: creates a fresh binding per iteration
+---*/
+
+let z = 1;
+let s = 0;
+for (const x = 1; z < 2; z++) {
+ s += x + z;
+}
+assert.sameValue(s, 2, "The value of `s` is `2`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-init-async-of.js b/js/src/tests/test262/language/statements/for/head-init-async-of.js
new file mode 100644
index 0000000000..4464d20396
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-init-async-of.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2021 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: for statement beginning with `async of`
+info: |
+ `for (async of =>` is the begining of a regular for loop, rather than a for-of
+esid: sec-for-statement
+---*/
+
+var i = 0;
+var counter = 0;
+for (async of => {}; i < 10; ++i) {
+ ++counter;
+}
+assert.sameValue(counter, 10);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-init-expr-check-empty-inc-empty-completion.js b/js/src/tests/test262/language/statements/for/head-init-expr-check-empty-inc-empty-completion.js
new file mode 100644
index 0000000000..88cc217c12
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-init-expr-check-empty-inc-empty-completion.js
@@ -0,0 +1,19 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The result of evaluating "for( ExpNoIn;Exp;Exp)" loop is returning
+ (normal, evalValue, empty)
+es5id: 12.6.3_A9.1
+description: Using eval
+---*/
+
+var supreme, count;
+supreme=5;
+
+var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }");
+
+assert.sameValue(__evaluated, void 0, '#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-init-expr-check-empty-inc-empty-syntax.js b/js/src/tests/test262/language/statements/for/head-init-expr-check-empty-inc-empty-syntax.js
new file mode 100644
index 0000000000..6297aaab7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-init-expr-check-empty-inc-empty-syntax.js
@@ -0,0 +1,15 @@
+// Copyright 2019 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: For head may omit optional expressions
+es5id: 12.6.3_A9.1
+---*/
+
+
+var supreme = 5
+var count;
+
+for(count=0;;) {if (count===supreme)break;else count++; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-init-var-check-empty-inc-empty-completion.js b/js/src/tests/test262/language/statements/for/head-init-var-check-empty-inc-empty-completion.js
new file mode 100644
index 0000000000..113b250cb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-init-var-check-empty-inc-empty-completion.js
@@ -0,0 +1,18 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The result of evaluating "for(var ExpNoIn;Exp;Exp)" loop is returning
+ (normal, evalValue, empty)
+es5id: 12.6.3_A9
+description: Using eval
+---*/
+
+var supreme=5;
+
+var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }");
+
+assert.sameValue(__evaluated, void 0, '#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated );
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-init-var-check-empty-inc-empty-syntax.js b/js/src/tests/test262/language/statements/for/head-init-var-check-empty-inc-empty-syntax.js
new file mode 100644
index 0000000000..6206cbe01a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-init-var-check-empty-inc-empty-syntax.js
@@ -0,0 +1,13 @@
+// Copyright 2019 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: For head may omit optional expressions
+es5id: 12.6.3_A9
+---*/
+
+var supreme=5;
+
+for(var count=0;;) {if (count===supreme)break;else count++; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-let-bound-names-in-stmt.js b/js/src/tests/test262/language/statements/for/head-let-bound-names-in-stmt.js
new file mode 100644
index 0000000000..c4a38cf2ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-let-bound-names-in-stmt.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The body may not re-declare variables declared in the head
+info: |
+ IterationStatement :
+ for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
+
+ It is a Syntax Error if any element of the BoundNames of LexicalDeclaration
+ also occurs in the VarDeclaredNames of Statement.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-for-statement
+es6id: 13.7.4
+---*/
+
+$DONOTEVALUATE();
+
+for (let x; false; ) {
+ var x;
+}
diff --git a/js/src/tests/test262/language/statements/for/head-let-destructuring.js b/js/src/tests/test262/language/statements/for/head-let-destructuring.js
new file mode 100644
index 0000000000..8577f67b48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-let-destructuring.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+es6id: 13.7
+description: >
+ The token sequence `let [`is interpreted as the beginning of a destructuring
+ binding pattern
+info: |
+ Syntax
+
+ IterationStatement[Yield, Return]:
+
+ for ( [lookahead ∉ { let [ } ] Expression[~In, ?Yield]opt ;
+ Expression[+In, ?Yield]opt ; Expression[+In, ?Yield]opt )
+ Statement[?Yield, ?Return]
+
+ for ( LexicalDeclaration[~In, ?Yield] Expression[+In, ?Yield]opt ;
+ Expression[+In, ?Yield]opt) Statement[?Yield, ?Return]
+---*/
+
+var value;
+
+for ( let[x] = [23]; ; ) {
+ value = x;
+ break;
+}
+
+assert.sameValue(typeof x, 'undefined', 'binding is block-scoped');
+assert.sameValue(value, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-let-fresh-binding-per-iteration.js b/js/src/tests/test262/language/statements/for/head-let-fresh-binding-per-iteration.js
new file mode 100644
index 0000000000..a054b20759
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-let-fresh-binding-per-iteration.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.13
+description: >
+ let ForDeclaration: creates a fresh binding per iteration
+---*/
+
+let z = 1;
+let s = 0;
+for (let x = 1; z < 2; z++) {
+ s += x + z;
+}
+assert.sameValue(s, 2, "The value of `s` is `2`");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-lhs-let.js b/js/src/tests/test262/language/statements/for/head-lhs-let.js
new file mode 100644
index 0000000000..0a094d2954
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-lhs-let.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-iteration-statements
+es6id: 13.7
+description: >
+ The `let` token is interpreted as an Identifier when it is not followed by a
+ `[` token
+info: |
+ Syntax
+
+ IterationStatement[Yield, Return]:
+
+ for ( [lookahead ∉ { let [ } ] Expression[~In, ?Yield]opt ;
+ Expression[+In, ?Yield]opt ; Expression[+In, ?Yield]opt )
+ Statement[?Yield, ?Return]
+
+ for ( LexicalDeclaration[~In, ?Yield] Expression[+In, ?Yield]opt ;
+ Expression[+In, ?Yield]opt) Statement[?Yield, ?Return]
+flags: [noStrict]
+---*/
+
+var let;
+
+let = 1;
+for ( let; ; )
+ break;
+
+assert.sameValue(let, 1, 'IdentifierReference');
+
+let = 2;
+for ( let = 3; ; )
+ break;
+
+assert.sameValue(let, 3, 'AssignmentExpression');
+
+let = 4;
+for ( [let][0]; ; )
+ break;
+
+assert.sameValue(let, 4, 'MemberExpression');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/head-var-bound-names-in-stmt.js b/js/src/tests/test262/language/statements/for/head-var-bound-names-in-stmt.js
new file mode 100644
index 0000000000..0e0d248104
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/head-var-bound-names-in-stmt.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The body may re-declare variables declared in the head
+esid: sec-for-statement
+es6id: 13.7.4
+---*/
+
+var iterCount = 0;
+var first = true;
+
+for (var x; first; first = false) {
+ var x;
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/labelled-fn-stmt-const.js b/js/src/tests/test262/language/statements/for/labelled-fn-stmt-const.js
new file mode 100644
index 0000000000..a15f95fcce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/labelled-fn-stmt-const.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (const x = 0; false; ) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for/labelled-fn-stmt-expr.js b/js/src/tests/test262/language/statements/for/labelled-fn-stmt-expr.js
new file mode 100644
index 0000000000..68e75328d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/labelled-fn-stmt-expr.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for ( ; false; ) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for/labelled-fn-stmt-let.js b/js/src/tests/test262/language/statements/for/labelled-fn-stmt-let.js
new file mode 100644
index 0000000000..377fd4c419
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/labelled-fn-stmt-let.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (let x; false; ) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for/labelled-fn-stmt-var.js b/js/src/tests/test262/language/statements/for/labelled-fn-stmt-var.js
new file mode 100644
index 0000000000..84735d443f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/labelled-fn-stmt-var.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+for (var x; false; ) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/for/let-array-with-newline.js b/js/src/tests/test262/language/statements/for/let-array-with-newline.js
new file mode 100644
index 0000000000..f9834339a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/let-array-with-newline.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+for (; false; ) let
+[a] = 0;
diff --git a/js/src/tests/test262/language/statements/for/let-block-with-newline.js b/js/src/tests/test262/language/statements/for/let-block-with-newline.js
new file mode 100644
index 0000000000..9749a6a5bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/let-block-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let {`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+for (; false; ) let // ASI
+{}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/let-identifier-with-newline.js b/js/src/tests/test262/language/statements/for/let-identifier-with-newline.js
new file mode 100644
index 0000000000..1b6f5ecb88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/let-identifier-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-for-statement
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+for (; false; ) let // ASI
+x = 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/scope-body-lex-boundary.js b/js/src/tests/test262/language/statements/for/scope-body-lex-boundary.js
new file mode 100644
index 0000000000..6b777f1838
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/scope-body-lex-boundary.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+description: >
+ Creation of new lexical environment for each evaluation of the statement
+ body
+info: |
+ [...]
+ 11. Let bodyResult be ForBodyEvaluation(the first Expression, the second
+ Expression, Statement, perIterationLets, labelSet).
+ [...]
+
+ 13.7.4.8 Runtime Semantics: ForBodyEvaluation
+
+ [...]
+ 3. Repeat
+ [...]
+ b. Let result be the result of evaluating stmt.
+ [...]
+ e. Perform ? CreatePerIterationEnvironment(perIterationBindings).
+ [...]
+
+ 13.7.4.9 Runtime Semantics: CreatePerIterationEnvironment
+
+ 1. If perIterationBindings has any elements, then
+ [...]
+ e. Let thisIterationEnv be NewDeclarativeEnvironment(outer).
+ f. Let thisIterationEnvRec be thisIterationEnv's EnvironmentRecord.
+features: [let]
+---*/
+
+var probeFirst;
+var probeSecond = null;
+
+for (let x = 'first'; probeSecond === null; x = 'second')
+ if (!probeFirst)
+ probeFirst = function() { return x; };
+ else
+ probeSecond = function() { return x; };
+
+assert.sameValue(probeFirst(), 'first');
+assert.sameValue(probeSecond(), 'second');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/scope-body-lex-open.js b/js/src/tests/test262/language/statements/for/scope-body-lex-open.js
new file mode 100644
index 0000000000..6a06fa30de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/scope-body-lex-open.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+description: >
+ Creation of new lexical environment for the initial evaluation of the
+ statement body
+info: |
+ [...]
+ 11. Let bodyResult be ForBodyEvaluation(the first Expression, the second
+ Expression, Statement, perIterationLets, labelSet).
+ [...]
+
+ 13.7.4.8 Runtime Semantics: ForBodyEvaluation
+
+ [...]
+ 2. Perform ? CreatePerIterationEnvironment(perIterationBindings).
+ 3. Repeat
+ [...]
+ b. Let result be the result of evaluating stmt.
+ [...]
+ [...]
+
+ 13.7.4.9 Runtime Semantics: CreatePerIterationEnvironment
+
+ 1. If perIterationBindings has any elements, then
+ [...]
+ e. Let thisIterationEnv be NewDeclarativeEnvironment(outer).
+ f. Let thisIterationEnvRec be thisIterationEnv's EnvironmentRecord.
+features: [let]
+---*/
+
+var probeBefore, probeTest, probeIncr, probeBody;
+var run = true;
+
+for (
+ let x = 'outside', _ = probeBefore = function() { return x; };
+ run && (x = 'inside', probeTest = function() { return x; });
+ probeIncr = function() { return x; }
+ )
+ probeBody = function() { return x; }, run = false;
+
+assert.sameValue(probeBefore(), 'outside');
+assert.sameValue(probeTest(), 'inside', 'reference from "test" position');
+assert.sameValue(probeBody(), 'inside', 'reference from statement body');
+assert.sameValue(probeIncr(), 'inside', 'reference from "increment" position');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/scope-body-var-none.js b/js/src/tests/test262/language/statements/for/scope-body-var-none.js
new file mode 100644
index 0000000000..c4074db7da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/scope-body-var-none.js
@@ -0,0 +1,113 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+description: >
+ No variable environment is created for each evaluation of the statement
+ body
+info: |
+ [...]
+ 11. Let bodyResult be ForBodyEvaluation(the first Expression, the second
+ Expression, Statement, perIterationLets, labelSet).
+ [...]
+
+ 13.7.4.8 Runtime Semantics: ForBodyEvaluation
+
+ [...]
+ 2. Perform ? CreatePerIterationEnvironment(perIterationBindings).
+ 3. Repeat
+ [...]
+ b. Let result be the result of evaluating stmt.
+ [...]
+ e. Perform ? CreatePerIterationEnvironment(perIterationBindings).
+ [...]
+
+ 13.7.4.9 Runtime Semantics: CreatePerIterationEnvironment
+
+ 1. If perIterationBindings has any elements, then
+ [...]
+ e. Let thisIterationEnv be NewDeclarativeEnvironment(outer).
+ f. Let thisIterationEnvRec be thisIterationEnv's EnvironmentRecord.
+flags: [noStrict]
+---*/
+
+var probeBefore = function() { return [x, y, z]; };
+var probeTest, probeIncr, probeBody;
+var run = true;
+
+for (
+ ;
+ run && (eval('var x = 1;'), probeTest = function() { return [x, y, z]; });
+ eval('var y = 1;'), probeIncr = function() { return [x, y, z]; }
+ )
+ var z = 1, _ = (probeBody = function() { return [x, y, z]; }), run = false;
+
+var x = 2;
+var y = 2;
+var z = 2;
+
+assert.sameValue(
+ probeBefore()[0],
+ 2,
+ 'reference preceding statement (redeclared in "test" position)'
+);
+assert.sameValue(
+ probeBefore()[1],
+ 2,
+ 'reference preceding statement (redeclared in statement body)'
+);
+assert.sameValue(
+ probeBefore()[2],
+ 2,
+ 'reference preceding statement (redeclared in "increment" position)'
+);
+
+assert.sameValue(
+ probeTest()[0],
+ 2,
+ 'reference from "test" position (redeclared in "test" position)'
+);
+assert.sameValue(
+ probeTest()[1],
+ 2,
+ 'reference from "test" position (redeclared in statement body)'
+);
+assert.sameValue(
+ probeTest()[2],
+ 2,
+ 'reference from "test" position (redeclared in "increment" position)'
+);
+
+assert.sameValue(
+ probeBody()[0],
+ 2,
+ 'reference from statement body (redeclared in "test" position)'
+);
+assert.sameValue(
+ probeBody()[1],
+ 2,
+ 'reference from statement body (redeclared in statement body)'
+);
+assert.sameValue(
+ probeBody()[2],
+ 2,
+ 'reference from statement body (redeclared in "increment" position)'
+);
+
+assert.sameValue(
+ probeIncr()[0],
+ 2,
+ 'reference from "increment" position (redeclared in "test" position)'
+);
+assert.sameValue(
+ probeIncr()[1],
+ 2,
+ 'reference from "increment" position (redeclared in statement body)'
+);
+assert.sameValue(
+ probeIncr()[2],
+ 2,
+ 'reference from "increment" position (redeclared in "increment" position)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/scope-head-lex-close.js b/js/src/tests/test262/language/statements/for/scope-head-lex-close.js
new file mode 100644
index 0000000000..a8f35a18e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/scope-head-lex-close.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+description: Removal of lexical environment for the statement "head"
+info: |
+ [...]
+ 2. Let loopEnv be NewDeclarativeEnvironment(oldEnv).
+ 3. Let loopEnvRec be loopEnv's EnvironmentRecord.
+ 4. Let isConst be the result of performing IsConstantDeclaration of
+ LexicalDeclaration.
+ 5. Let boundNames be the BoundNames of LexicalDeclaration.
+ 6. For each element dn of boundNames do
+ a. If isConst is true, then
+ i. Perform ! loopEnvRec.CreateImmutableBinding(dn, true).
+ b. Else,
+ i. Perform ! loopEnvRec.CreateMutableBinding(dn, false).
+ 7. Set the running execution context's LexicalEnvironment to loopEnv.
+ [...]
+ 12. Set the running execution context's LexicalEnvironment to oldEnv.
+ 13. Return Completion(bodyResult).
+features: [let]
+---*/
+
+let x = 'outside';
+var run = true;
+var probeTest, probeIncr, probeBody;
+
+for (
+ let x = 'inside';
+ (probeTest = function() { return x; }) && run;
+ probeIncr = function() { return x; }
+ )
+ probeBody = function() { return x; }, run = false;
+
+assert.sameValue(probeBody(), 'inside', 'reference from statement body');
+assert.sameValue(probeIncr(), 'inside', 'reference from "increment" position');
+assert.sameValue(probeTest(), 'inside', 'reference from "test" position');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/scope-head-lex-open.js b/js/src/tests/test262/language/statements/for/scope-head-lex-open.js
new file mode 100644
index 0000000000..5d60618fa3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/scope-head-lex-open.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+description: Creation of new lexical environment for the statement "head"
+info: |
+ [...]
+ 2. Let loopEnv be NewDeclarativeEnvironment(oldEnv).
+ 3. Let loopEnvRec be loopEnv's EnvironmentRecord.
+ 4. Let isConst be the result of performing IsConstantDeclaration of
+ LexicalDeclaration.
+ 5. Let boundNames be the BoundNames of LexicalDeclaration.
+ 6. For each element dn of boundNames do
+ a. If isConst is true, then
+ i. Perform ! loopEnvRec.CreateImmutableBinding(dn, true).
+ b. Else,
+ i. Perform ! loopEnvRec.CreateMutableBinding(dn, false).
+ 7. Set the running execution context's LexicalEnvironment to loopEnv.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeBefore = function() { return x; };
+var probeDecl, probeTest, probeIncr, probeBody;
+var run = true;
+
+for (
+ let x = 'inside', _ = probeDecl = function() { return x; };
+ run && (probeTest = function() { return x; });
+ probeIncr = function() { return x; }
+ )
+ probeBody = function() { return x; }, run = false;
+
+assert.sameValue(probeBefore(), 'outside');
+assert.sameValue(probeDecl(), 'inside', 'reference from LexicalDeclaration');
+assert.sameValue(probeTest(), 'inside', 'reference from "test" position');
+assert.sameValue(probeBody(), 'inside', 'reference from statement body');
+assert.sameValue(probeIncr(), 'inside', 'reference from "increment" position');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/scope-head-var-none.js b/js/src/tests/test262/language/statements/for/scope-head-var-none.js
new file mode 100644
index 0000000000..4f1dd70e21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/scope-head-var-none.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-for-statement-runtime-semantics-labelledevaluation
+description: No variable environment is created for the statement "head"
+info: |
+ [...]
+ 2. Let loopEnv be NewDeclarativeEnvironment(oldEnv).
+ 3. Let loopEnvRec be loopEnv's EnvironmentRecord.
+ 4. Let isConst be the result of performing IsConstantDeclaration of
+ LexicalDeclaration.
+ 5. Let boundNames be the BoundNames of LexicalDeclaration.
+ 6. For each element dn of boundNames do
+ a. If isConst is true, then
+ i. Perform ! loopEnvRec.CreateImmutableBinding(dn, true).
+ b. Else,
+ i. Perform ! loopEnvRec.CreateMutableBinding(dn, false).
+ 7. Set the running execution context's LexicalEnvironment to loopEnv.
+ [...]
+ 12. Set the running execution context's LexicalEnvironment to oldEnv.
+ 13. Return Completion(bodyResult).
+flags: [noStrict]
+---*/
+
+var probeBefore = function() { return x; };
+var probeTest, probeIncr, probeBody;
+var run = true;
+
+for (
+ var _ = eval('var x = 1;');
+ run && (probeTest = function() { return x; });
+ probeIncr = function() { return x; }
+ )
+ probeBody = function() { return x; }, run = false;
+
+var x = 2;
+
+assert.sameValue(probeBefore(), 2, 'reference preceding statement');
+assert.sameValue(probeTest(), 2, 'reference from "test" position');
+assert.sameValue(probeBody(), 2, 'reference from statement body');
+assert.sameValue(probeIncr(), 2, 'reference from "increment" position');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/shell.js b/js/src/tests/test262/language/statements/for/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/for/tco-const-body-strict.js b/js/src/tests/test262/language/statements/for/tco-const-body-strict.js
new file mode 100644
index 0000000000..4600b98293
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/tco-const-body-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ for (const x = 0; ;) {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/tco-let-body-strict.js b/js/src/tests/test262/language/statements/for/tco-let-body-strict.js
new file mode 100644
index 0000000000..5db4fa9c7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/tco-let-body-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ for (let x = 0; ;) {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/tco-lhs-body-strict.js b/js/src/tests/test262/language/statements/for/tco-lhs-body-strict.js
new file mode 100644
index 0000000000..5254f7a3de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/tco-lhs-body-strict.js
@@ -0,0 +1,26 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ var x;
+ for (x = 0; x < 1; ++x) {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/for/tco-var-body-strict.js b/js/src/tests/test262/language/statements/for/tco-var-body-strict.js
new file mode 100644
index 0000000000..8ef5ef4679
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for/tco-var-body-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ for (var x = 0; ;) {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0-12-s-strict.js b/js/src/tests/test262/language/statements/function/13.0-12-s-strict.js
new file mode 100644
index 0000000000..689b521ee8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0-12-s-strict.js
@@ -0,0 +1,20 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-12-s
+description: >
+ Strict Mode - SourceElements is not evaluated as strict mode code
+ when a Function constructor is contained in strict mode code and
+ the function constructor body is not strict
+flags: [onlyStrict]
+---*/
+
+ var _13_0_12_fun = new Function(" ","eval = 42;");
+ _13_0_12_fun();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0-13-s.js b/js/src/tests/test262/language/statements/function/13.0-13-s.js
new file mode 100644
index 0000000000..373cc10b3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0-13-s.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-13-s
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ the function body of a Function constructor begins with a Strict
+ Directive
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("var _13_0_13_fun = new Function(\" \", \"'use strict'; eval = 42;\"); _13_0_13_fun();");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0-14-s.js b/js/src/tests/test262/language/statements/function/13.0-14-s.js
new file mode 100644
index 0000000000..f9451634a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0-14-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-14-s
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ the function body of a Function constructor contains a Strict
+ Directive
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ var _13_0_14_fun = new Function(" ", "'use strict'; eval = 42; ");
+ _13_0_14_fun();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0-15-s.js b/js/src/tests/test262/language/statements/function/13.0-15-s.js
new file mode 100644
index 0000000000..d05e197a71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0-15-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-15-s
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ a FunctionDeclaration is contained in strict mode code within eval
+ code
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; function _13_0_15_fun() {eval = 42;};");
+ _13_0_15_fun();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0-16-s.js b/js/src/tests/test262/language/statements/function/13.0-16-s.js
new file mode 100644
index 0000000000..3d6c287da4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0-16-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-16-s
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ a FunctionExpression is contained in strict mode code within eval
+ code
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; var _13_0_16_fun = function () {eval = 42;};");
+ _13_0_16_fun();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0-17-s.js b/js/src/tests/test262/language/statements/function/13.0-17-s.js
new file mode 100644
index 0000000000..8049390a5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0-17-s.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-17-s
+description: >
+ Strict Mode - SourceElements is not evaluated as strict mode code
+ when a Function constructor is contained in strict mode code
+ within eval code
+flags: [noStrict]
+---*/
+
+ eval("'use strict'; var _13_0_17_fun = new Function('eval = 42;'); _13_0_17_fun();");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0-7-s.js b/js/src/tests/test262/language/statements/function/13.0-7-s.js
new file mode 100644
index 0000000000..88175ea2a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0-7-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-7-s
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ the code of this FunctionDeclaration is contained in non-strict
+ mode but the call to eval is a direct call in strict mode code
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; function _13_0_7_fun() {eval = 42;};");
+ _13_0_7_fun();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0-8-s-strict.js b/js/src/tests/test262/language/statements/function/13.0-8-s-strict.js
new file mode 100644
index 0000000000..1fad80b14d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0-8-s-strict.js
@@ -0,0 +1,22 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-8-s
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ the code of this FunctionExpression is contained in non-strict
+ mode but the call to eval is a direct call in strict mode code
+flags: [onlyStrict]
+---*/
+
+assert.throws(SyntaxError, function() {
+ eval("var _13_0_8_fun = function () {eval = 42;};");
+ _13_0_8_fun();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0_4-17gs-strict.js b/js/src/tests/test262/language/statements/function/13.0_4-17gs-strict.js
new file mode 100644
index 0000000000..903001cf8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0_4-17gs-strict.js
@@ -0,0 +1,15 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.0_4-17gs
+description: >
+ Strict Mode - SourceElements is not evaluated as strict mode code
+ when a Function constructor is contained in strict mode code
+flags: [onlyStrict]
+---*/
+
+var _13_0_4_17_fun = new Function('eval = 42;');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.0_4-5gs-strict.js b/js/src/tests/test262/language/statements/function/13.0_4-5gs-strict.js
new file mode 100644
index 0000000000..c0017683fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.0_4-5gs-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.0_4-5gs
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ a FunctionDeclaration is contained in strict mode code
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_0_4_5_fun() { eval = 42; };
diff --git a/js/src/tests/test262/language/statements/function/13.1-13gs-strict.js b/js/src/tests/test262/language/statements/function/13.1-13gs-strict.js
new file mode 100644
index 0000000000..be377cfcfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-13gs-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-13gs
+description: >
+ StrictMode - SyntaxError is thrown if 'arguments' occurs as the
+ Identifier of a FunctionDeclaration
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function arguments() { };
diff --git a/js/src/tests/test262/language/statements/function/13.1-19-s.js b/js/src/tests/test262/language/statements/function/13.1-19-s.js
new file mode 100644
index 0000000000..bdac2fef4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-19-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-19-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'arguments'
+ appears within a FormalParameterList of a strict mode
+ FunctionDeclaration in strict eval code
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict';function _13_1_19_fun(arguments) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-1gs-strict.js b/js/src/tests/test262/language/statements/function/13.1-1gs-strict.js
new file mode 100644
index 0000000000..f376748867
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-1gs-strict.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-1gs
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'eval'
+ appears within a FormalParameterList of a strict mode
+ FunctionDeclaration
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_1_fun(eval) { }
diff --git a/js/src/tests/test262/language/statements/function/13.1-2-s-strict.js b/js/src/tests/test262/language/statements/function/13.1-2-s-strict.js
new file mode 100644
index 0000000000..d7869bec7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-2-s-strict.js
@@ -0,0 +1,23 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-2-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'eval'
+ appears within a FormalParameterList of a strict mode
+ FunctionExpression
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("var _13_1_2_fun = function (eval) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-21-s.js b/js/src/tests/test262/language/statements/function/13.1-21-s.js
new file mode 100644
index 0000000000..2c28c9b494
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-21-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-21-s
+description: >
+ StrictMode - SyntaxError is thrown if the identifier 'arguments'
+ appears within a FormalParameterList of a strict mode
+ FunctionExpression in strict eval code
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; var _13_1_21_fun = function (arguments) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-22-s.js b/js/src/tests/test262/language/statements/function/13.1-22-s.js
new file mode 100644
index 0000000000..33798b6bac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-22-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-22-s
+description: >
+ StrictMode - SyntaxError is thrown if the identifier 'arguments'
+ appears within a FormalParameterList of a strict mode
+ FunctionExpression when FuctionBody is strict code
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("var _13_1_22_fun = function (arguments) { 'use strict'; }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-23-s.js b/js/src/tests/test262/language/statements/function/13.1-23-s.js
new file mode 100644
index 0000000000..9cb04206cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-23-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-23-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created using
+ a FunctionDeclaration that is contained in eval strict code and
+ the function has two identical parameters
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; function _13_1_23_fun(param, param) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-25-s.js b/js/src/tests/test262/language/statements/function/13.1-25-s.js
new file mode 100644
index 0000000000..a3cb436482
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-25-s.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-25-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created using
+ a FunctionDeclaration that is contained in eval strict code and
+ the function has two identical parameters which are separated by a
+ unique parameter name
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; function _13_1_25_fun(param1, param2, param1) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-27-s.js b/js/src/tests/test262/language/statements/function/13.1-27-s.js
new file mode 100644
index 0000000000..9662c3f550
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-27-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-27-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created using
+ a FunctionDeclaration that is contained in eval strict code and
+ the function has three identical parameters
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; function _13_1_27_fun(param, param, param) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-29-s.js b/js/src/tests/test262/language/statements/function/13.1-29-s.js
new file mode 100644
index 0000000000..809c463902
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-29-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-29-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created using
+ a FunctionExpression that is contained in eval strict code and the
+ function has two identical parameters
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; var _13_1_29_fun = function (param, param) { };");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-31-s.js b/js/src/tests/test262/language/statements/function/13.1-31-s.js
new file mode 100644
index 0000000000..8fdecb495a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-31-s.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-31-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created using
+ a FunctionExpression that is contained in eval strict code and the
+ function has two identical parameters, which are separated by a
+ unique parameter name
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; var _13_1_31_fun = function (param1, param2, param1) { };");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-33-s.js b/js/src/tests/test262/language/statements/function/13.1-33-s.js
new file mode 100644
index 0000000000..a99e51d68c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-33-s.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-33-s
+description: >
+ Strict Mode - SyntaxError is thrown if function is created using a
+ FunctionExpression that is contained in eval strict code and the
+ function has three identical parameters
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; var _13_1_33_fun = function (param, param, param) { };")
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-39-s.js b/js/src/tests/test262/language/statements/function/13.1-39-s.js
new file mode 100644
index 0000000000..066a4b8695
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-39-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-39-s
+description: >
+ StrictMode - SyntaxError is thrown if 'arguments' occurs as the
+ function name of a FunctionDeclaration in strict eval code
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; function arguments() { };")
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-4-s-strict.js b/js/src/tests/test262/language/statements/function/13.1-4-s-strict.js
new file mode 100644
index 0000000000..df8c40f7bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-4-s-strict.js
@@ -0,0 +1,23 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-4-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'arguments'
+ appears within a FormalParameterList of a strict mode
+ FunctionExpression
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("var _13_1_4_fun = function (arguments) { };");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-41-s.js b/js/src/tests/test262/language/statements/function/13.1-41-s.js
new file mode 100644
index 0000000000..9e0d146af7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-41-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-41-s
+description: >
+ StrictMode - SyntaxError is thrown if 'arguments' occurs as the
+ Identifier of a FunctionExpression in strict eval code
+flags: [noStrict]
+---*/
+
+ var _13_1_41_s = {};
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; _13_1_41_s.x = function arguments() {};");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.1-4gs-strict.js b/js/src/tests/test262/language/statements/function/13.1-4gs-strict.js
new file mode 100644
index 0000000000..d797a5b9cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-4gs-strict.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-4gs
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'arguments'
+ appears within a FormalParameterList of a strict mode
+ FunctionExpression
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+var _13_1_4_fun = function (arguments) { };
diff --git a/js/src/tests/test262/language/statements/function/13.1-5gs-strict.js b/js/src/tests/test262/language/statements/function/13.1-5gs-strict.js
new file mode 100644
index 0000000000..afe138f50c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-5gs-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-5gs
+description: >
+ Strict Mode - SyntaxError is thrown if a FunctionDeclaration has
+ two identical parameters
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_5_fun(param, param) { }
diff --git a/js/src/tests/test262/language/statements/function/13.1-8gs-strict.js b/js/src/tests/test262/language/statements/function/13.1-8gs-strict.js
new file mode 100644
index 0000000000..c378ad1c2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.1-8gs-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-8gs
+description: >
+ Strict Mode - SyntaxError is thrown if a FunctionExpression has
+ two identical parameters
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+var _13_1_8_fun = function (param, param) { };
diff --git a/js/src/tests/test262/language/statements/function/13.2-1-s.js b/js/src/tests/test262/language/statements/function/13.2-1-s.js
new file mode 100644
index 0000000000..47729a26ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-1-s.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-1-s
+description: >
+ StrictMode - Writing or reading from a property named 'caller' of
+ function objects is allowed under both strict and normal modes.
+---*/
+
+ var foo = function () {
+ this.caller = 12;
+ }
+ var obj = new foo();
+
+assert.sameValue(obj.caller, 12, 'obj.caller');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-10-s.js b/js/src/tests/test262/language/statements/function/13.2-10-s.js
new file mode 100644
index 0000000000..51ebae59bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-10-s.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-10-s
+description: >
+ StrictMode - writing a property named 'caller' of function objects
+ is not allowed outside the function
+---*/
+
+ var foo = Function("'use strict';");
+assert.throws(TypeError, function() {
+ foo.caller = 41;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-11-s.js b/js/src/tests/test262/language/statements/function/13.2-11-s.js
new file mode 100644
index 0000000000..c3c30fa6c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-11-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-11-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'caller' fails outside of the function
+---*/
+
+ var foo = Function("'use strict';");
+
+ for (var tempIndex in foo) {
+ assert.notSameValue(tempIndex, "caller", 'tempIndex');
+ }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-12-s.js b/js/src/tests/test262/language/statements/function/13.2-12-s.js
new file mode 100644
index 0000000000..c31b97e710
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-12-s.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-12-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'caller' fails inside the function
+---*/
+
+ var foo = Function("'use strict'; for (var tempIndex in this) {assert.notSameValue(tempIndex, 'caller', 'tempIndex');}");
+ foo.call(foo);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-13-s.js b/js/src/tests/test262/language/statements/function/13.2-13-s.js
new file mode 100644
index 0000000000..b809fa2939
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-13-s.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-13-s
+description: >
+ StrictMode - reading a property named 'arguments' of function
+ objects is not allowed outside the function
+---*/
+
+ var foo = new Function("'use strict';");
+assert.throws(TypeError, function() {
+ var temp = foo.arguments;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-14-s.js b/js/src/tests/test262/language/statements/function/13.2-14-s.js
new file mode 100644
index 0000000000..401e8f5b88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-14-s.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-14-s
+description: >
+ StrictMode - writing a property named 'arguments' of function
+ objects is not allowed outside the function
+---*/
+
+ var foo = new Function("'use strict';");
+assert.throws(TypeError, function() {
+ foo.arguments = 41;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-15-1.js b/js/src/tests/test262/language/statements/function/13.2-15-1.js
new file mode 100644
index 0000000000..b70d843dd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-15-1.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-15-1
+description: >
+ Function Object has length as its own property and does not invoke
+ the setter defined on Function.prototype.length (Step 15)
+includes: [propertyHelper.js]
+---*/
+
+var fun = function (x, y) { };
+
+assert(fun.hasOwnProperty("length"));
+assert.sameValue(fun.length, 2);
+
+verifyNotEnumerable(fun, "length");
+verifyNotWritable(fun, "length");
+verifyConfigurable(fun, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-15-s.js b/js/src/tests/test262/language/statements/function/13.2-15-s.js
new file mode 100644
index 0000000000..d4242f0104
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-15-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-15-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'arguments' fails outside of the function
+---*/
+
+ var foo = new Function("'use strict';");
+
+ for (var tempIndex in foo) {
+ assert.notSameValue(tempIndex, "arguments", 'tempIndex');
+ }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-16-s.js b/js/src/tests/test262/language/statements/function/13.2-16-s.js
new file mode 100644
index 0000000000..befc8af88f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-16-s.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-16-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'arguments' fails inside the function
+---*/
+
+ var foo = new Function("'use strict'; for (var tempIndex in this) {assert.notSameValue(tempIndex, 'arguments', 'tempIndex');}");
+ foo.call(foo);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-17-1.js b/js/src/tests/test262/language/statements/function/13.2-17-1.js
new file mode 100644
index 0000000000..bed00f4e65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-17-1.js
@@ -0,0 +1,55 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-17-1
+description: >
+ Function Object has 'constructor' as its own property, it is not
+ enumerable and does not invoke the setter defined on
+ Function.prototype.constructor (Step 17)
+---*/
+
+ var desc = Object.getOwnPropertyDescriptor(Object.prototype, "constructor");
+
+ var getFunc = function () {
+ return 100;
+ };
+
+ var data = "data";
+ var setFunc = function (value) {
+ data = value;
+ };
+
+ Object.defineProperty(Object.prototype, "constructor", {
+ get: getFunc,
+ set: setFunc,
+ configurable: true
+ });
+
+ var fun = function () {};
+
+ var verifyValue = false;
+ verifyValue = typeof fun.prototype.constructor === "function";
+
+ var verifyEnumerable = false;
+ for (var p in fun.prototype) {
+ if (p === "constructor" && fun.prototype.hasOwnProperty("constructor")) {
+ verifyEnumerable = true;
+ }
+ }
+
+ var verifyWritable = false;
+ fun.prototype.constructor = 12;
+ verifyWritable = (fun.prototype.constructor === 12);
+
+ var verifyConfigurable = false;
+ delete fun.prototype.constructor;
+ verifyConfigurable = fun.hasOwnProperty("constructor");
+
+assert(verifyValue, 'verifyValue !== true');
+assert(verifyWritable, 'verifyWritable !== true');
+assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
+assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
+assert.sameValue(data, "data", 'data');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-17-s.js b/js/src/tests/test262/language/statements/function/13.2-17-s.js
new file mode 100644
index 0000000000..085f40f6dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-17-s.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-17-s
+description: >
+ StrictMode - reading a property named 'arguments' of function
+ objects is not allowed outside the function
+---*/
+
+ var foo = Function("'use strict';");
+assert.throws(TypeError, function() {
+ var temp = foo.arguments;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-18-1.js b/js/src/tests/test262/language/statements/function/13.2-18-1.js
new file mode 100644
index 0000000000..f03cc05137
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-18-1.js
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-18-1
+description: >
+ Function Object has 'prototype' as its own property, it is not
+ enumerable and does not invoke the setter defined on
+ Function.prototype (Step 18)
+includes: [propertyHelper.js]
+---*/
+
+try {
+ var getFunc = function () {
+ return 100;
+ };
+
+ var data = "data";
+ var setFunc = function (value) {
+ data = value;
+ };
+ Object.defineProperty(Function.prototype, "prototype", {
+ get: getFunc,
+ set: setFunc,
+ configurable: true
+ });
+
+ var fun = function () { };
+
+ assert.notSameValue(fun.prototype, 100);
+ assert.sameValue(fun.prototype.toString(), "[object Object]");
+
+ verifyNotEnumerable(fun, "prototype");
+ verifyWritable(fun, "prototype");
+ verifyNotConfigurable(fun, "prototype");
+
+ assert.sameValue(data, "data");
+} finally {
+ delete Function.prototype.prototype;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-18-s.js b/js/src/tests/test262/language/statements/function/13.2-18-s.js
new file mode 100644
index 0000000000..2c7c625874
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-18-s.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-18-s
+description: >
+ StrictMode - writing a property named 'arguments' of function
+ objects is not allowed outside the function
+---*/
+
+ var foo = Function("'use strict';");
+assert.throws(TypeError, function() {
+ foo.arguments = 41;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-19-b-3gs-strict.js b/js/src/tests/test262/language/statements/function/13.2-19-b-3gs-strict.js
new file mode 100644
index 0000000000..5890e2be96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-19-b-3gs-strict.js
@@ -0,0 +1,19 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-19-b-3gs
+description: >
+ StrictMode - error is thrown when assign a value to the 'caller'
+ property of a function object
+flags: [onlyStrict]
+---*/
+
+function _13_2_19_b_3_gs() {}
+
+assert.throws(TypeError, function() {
+ _13_2_19_b_3_gs.caller = 1;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-19-s.js b/js/src/tests/test262/language/statements/function/13.2-19-s.js
new file mode 100644
index 0000000000..8ba75c3f1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-19-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-19-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'arguments' fails outside of the function
+---*/
+
+ var foo = Function("'use strict';");
+
+ for (var tempIndex in foo) {
+ assert.notSameValue(tempIndex, "arguments", 'tempIndex');
+ }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-2-s-strict.js b/js/src/tests/test262/language/statements/function/13.2-2-s-strict.js
new file mode 100644
index 0000000000..d88c22ad07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-2-s-strict.js
@@ -0,0 +1,20 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-2-s
+description: >
+ StrictMode - A TypeError is thrown when a strict mode code writes
+ to properties named 'caller' of function instances.
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(TypeError, function() {
+ var foo = function () {
+ }
+ foo.caller = 20;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-20-s.js b/js/src/tests/test262/language/statements/function/13.2-20-s.js
new file mode 100644
index 0000000000..1bc7826598
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-20-s.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-20-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'arguments' fails inside the function
+flags: [noStrict]
+---*/
+
+ var foo = Function("'use strict'; for (var tempIndex in this) {assert.notSameValue(tempIndex, 'arguments', 'tempIndex');}");
+ foo.call(foo);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-21-s.js b/js/src/tests/test262/language/statements/function/13.2-21-s.js
new file mode 100644
index 0000000000..847fc8cbd9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-21-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-21-s
+description: >
+ StrictMode - reading a property named 'caller' of function objects
+ is not allowed outside the function
+flags: [noStrict]
+---*/
+
+ function foo () {"use strict";}
+assert.throws(TypeError, function() {
+ var temp = foo.caller;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-22-s.js b/js/src/tests/test262/language/statements/function/13.2-22-s.js
new file mode 100644
index 0000000000..179ccd960c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-22-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-22-s
+description: >
+ StrictMode - writing a property named 'caller' of function objects
+ is not allowed outside the function
+flags: [noStrict]
+---*/
+
+ function foo () {"use strict";}
+assert.throws(TypeError, function() {
+ foo.caller = 41;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-23-s.js b/js/src/tests/test262/language/statements/function/13.2-23-s.js
new file mode 100644
index 0000000000..3ae25bb462
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-23-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-23-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'caller' fails outside of the function
+flags: [noStrict]
+---*/
+
+ function foo () {"use strict";}
+ for (var tempIndex in foo) {
+ assert.notSameValue(tempIndex, "caller", 'tempIndex');
+ }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-24-s.js b/js/src/tests/test262/language/statements/function/13.2-24-s.js
new file mode 100644
index 0000000000..c5f4695b08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-24-s.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-24-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'caller' fails inside the function
+flags: [noStrict]
+---*/
+
+ function foo () {
+ "use strict";
+ for (var tempIndex in this) {
+ assert.notSameValue(tempIndex, "caller", 'tempIndex');
+ }
+ }
+
+foo.call(foo);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-25-s.js b/js/src/tests/test262/language/statements/function/13.2-25-s.js
new file mode 100644
index 0000000000..44a7343aa6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-25-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-25-s
+description: >
+ StrictMode - reading a property named 'arguments' of function
+ objects is not allowed outside the function
+flags: [noStrict]
+---*/
+
+ function foo () {"use strict";}
+assert.throws(TypeError, function() {
+ var temp = foo.arguments;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-26-s.js b/js/src/tests/test262/language/statements/function/13.2-26-s.js
new file mode 100644
index 0000000000..e6ea555aa7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-26-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-26-s
+description: >
+ StrictMode - writing a property named 'arguments' of function
+ objects is not allowed outside the function
+flags: [noStrict]
+---*/
+
+ function foo () {"use strict";}
+assert.throws(TypeError, function() {
+ foo.arguments = 41;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-27-s.js b/js/src/tests/test262/language/statements/function/13.2-27-s.js
new file mode 100644
index 0000000000..df1be54766
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-27-s.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-27-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'arguments' fails outside of the function
+flags: [noStrict]
+---*/
+
+ function foo () {"use strict";}
+
+ for (var tempIndex in foo) {
+ assert.notSameValue(tempIndex, "arguments", 'tempIndex');
+ }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-28-s.js b/js/src/tests/test262/language/statements/function/13.2-28-s.js
new file mode 100644
index 0000000000..ea9f57b27e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-28-s.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-28-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'arguments' fails inside the function
+flags: [noStrict]
+---*/
+
+ function foo() {
+ "use strict";
+ for (var tempIndex in this) {
+ assert.notSameValue(tempIndex, "arguments", 'tempIndex');
+ }
+ }
+ foo.call(foo);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-3-s.js b/js/src/tests/test262/language/statements/function/13.2-3-s.js
new file mode 100644
index 0000000000..e078018a03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-3-s.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-3-s
+description: >
+ StrictMode - Writing or reading from a property named 'arguments'
+ of function objects is allowed under both strict and normal modes.
+---*/
+
+ var foo = function () {
+ this.arguments = 12;
+ }
+ var obj = new foo();
+
+assert.sameValue(obj.arguments, 12, 'obj.arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-30-s.js b/js/src/tests/test262/language/statements/function/13.2-30-s.js
new file mode 100644
index 0000000000..029581a04e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-30-s.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ Functions created using Function.prototype.bind() do not have own
+ properties "caller" or "arguments", but inherit them from
+ %FunctionPrototype%.
+---*/
+
+function target() {}
+var self = {};
+var bound = target.bind(self);
+
+assert.sameValue(bound.hasOwnProperty('caller'), false, 'Functions created using Function.prototype.bind() do not have own property "caller"');
+assert.sameValue(bound.hasOwnProperty('arguments'), false, 'Functions created using Function.prototype.bind() do not have own property "arguments"');
+
+assert.throws(TypeError, function() {
+ return bound.caller;
+});
+
+assert.throws(TypeError, function() {
+ bound.caller = {};
+});
+
+assert.throws(TypeError, function() {
+ return bound.arguments;
+});
+
+assert.throws(TypeError, function() {
+ bound.arguments = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-4-s-strict.js b/js/src/tests/test262/language/statements/function/13.2-4-s-strict.js
new file mode 100644
index 0000000000..94b7f191a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-4-s-strict.js
@@ -0,0 +1,20 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-4-s
+description: >
+ StrictMode - A TypeError is thrown when a code in strict mode
+ tries to write to 'arguments' of function instances.
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(TypeError, function() {
+ var foo = function () {
+ }
+ foo.arguments = 20;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-5-s.js b/js/src/tests/test262/language/statements/function/13.2-5-s.js
new file mode 100644
index 0000000000..48733cc5b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-5-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-5-s
+description: >
+ StrictMode - reading a property named 'caller' of function objects
+ is not allowed outside the function
+flags: [noStrict]
+---*/
+
+ var foo = new Function("'use strict';");
+assert.throws(TypeError, function() {
+ var temp = foo.caller;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-6-s.js b/js/src/tests/test262/language/statements/function/13.2-6-s.js
new file mode 100644
index 0000000000..c688a5f2d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-6-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-6-s
+description: >
+ StrictMode - writing a property named 'caller' of function objects
+ is not allowed outside the function
+flags: [noStrict]
+---*/
+
+ var foo = new Function("'use strict';");
+assert.throws(TypeError, function() {
+ foo.caller = 41;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-7-s.js b/js/src/tests/test262/language/statements/function/13.2-7-s.js
new file mode 100644
index 0000000000..59f3aecae3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-7-s.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-7-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'caller' fails outside of the function
+flags: [noStrict]
+---*/
+
+ var foo = new Function("'use strict';");
+
+ for (var tempIndex in foo) {
+ assert.notSameValue(tempIndex, "caller", 'tempIndex');
+ }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-8-s.js b/js/src/tests/test262/language/statements/function/13.2-8-s.js
new file mode 100644
index 0000000000..d8a8f800a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-8-s.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-8-s
+description: >
+ StrictMode - enumerating over a function object looking for
+ 'caller' fails inside the function
+flags: [noStrict]
+---*/
+
+ var foo = new Function("'use strict'; for (var tempIndex in this) {assert.notSameValue(tempIndex, 'caller', 'tempIndex');}");
+ foo.call(foo);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/13.2-9-s.js b/js/src/tests/test262/language/statements/function/13.2-9-s.js
new file mode 100644
index 0000000000..3aabaaa1a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/13.2-9-s.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2-9-s
+description: >
+ StrictMode - reading a property named 'caller' of function objects
+ is not allowed outside the function
+flags: [noStrict]
+---*/
+
+ var foo = Function("'use strict';");
+assert.throws(TypeError, function() {
+ var temp = foo.caller;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S10.1.1_A1_T1.js b/js/src/tests/test262/language/statements/function/S10.1.1_A1_T1.js
new file mode 100644
index 0000000000..9b3e996f20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S10.1.1_A1_T1.js
@@ -0,0 +1,19 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Program functions are defined in source text by a FunctionDeclaration or created dynamically either
+ by using a FunctionExpression or by using the built-in Function object as a constructor
+es5id: 10.1.1_A1_T1
+description: Defining function by a FunctionDeclaration
+---*/
+
+//CHECK#1
+function f1(){
+ return 1;
+}
+if(typeof(f1)!=="function")
+ throw new Test262Error('#1: typeof(f1)!=="function"');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A1_T1.js b/js/src/tests/test262/language/statements/function/S13.2.1_A1_T1.js
new file mode 100644
index 0000000000..7a938678cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A1_T1.js
@@ -0,0 +1,74 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The depth of nested function calls reaches 32
+es5id: 13.2.1_A1_T1
+description: Creating function calls 32 elements depth
+---*/
+
+(function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){
+ (function(){})()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+ })()
+})()
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A4_T1.js b/js/src/tests/test262/language/statements/function/S13.2.1_A4_T1.js
new file mode 100644
index 0000000000..ad94529dc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A4_T1.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Objects as arguments are passed by reference
+es5id: 13.2.1_A4_T1
+description: >
+ Adding new number property to a function argument within the
+ function body, where explicit argument is an object defined with
+ "var __obj={}"
+---*/
+
+function __func(__arg){
+ __arg.foo=7;
+}
+
+var __obj={};
+
+__func(__obj);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__obj.foo !== 7) {
+ throw new Test262Error('#1: __obj.foo === 7. Actual: __obj.foo ==='+__obj.foo);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A4_T2.js b/js/src/tests/test262/language/statements/function/S13.2.1_A4_T2.js
new file mode 100644
index 0000000000..e13abef967
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A4_T2.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Objects as arguments are passed by reference
+es5id: 13.2.1_A4_T2
+description: >
+ Adding new string property to a function argument within the
+ function body, where explicit argument is an object defined with
+ "__obj={}"
+---*/
+
+function __func(__arg){
+ __arg.foo="whiskey gogo";
+}
+
+var __obj={};
+
+ __func(__obj);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__obj.foo !== "whiskey gogo") {
+ throw new Test262Error('#1: __obj.foo === "whiskey gogo". Actual: __obj.foo ==='+__obj.foo);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A4_T3.js b/js/src/tests/test262/language/statements/function/S13.2.1_A4_T3.js
new file mode 100644
index 0000000000..706bfcee79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A4_T3.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Objects as arguments are passed by reference
+es5id: 13.2.1_A4_T3
+description: >
+ Adding new number property to a function argument within the
+ function body, where array element "arguments[0]" is an object
+ defined with "__obj={}"
+---*/
+
+function __func(){
+ arguments[0]["PI"]=3.14;
+}
+
+var __obj={};
+
+__func(__obj);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__obj.PI !== 3.14) {
+ throw new Test262Error('#1: __obj.PI === 3.14. Actual: __obj.PI ==='+__obj.PI);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A4_T4.js b/js/src/tests/test262/language/statements/function/S13.2.1_A4_T4.js
new file mode 100644
index 0000000000..c54588b235
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A4_T4.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Objects as arguments are passed by reference
+es5id: 13.2.1_A4_T4
+description: >
+ Adding new number property to a function argument within the
+ function body, where array element "arguments[0]" is an object
+ defined with "var __obj={}"
+---*/
+
+function __func(){
+ arguments[0]["E"]=2.74;
+}
+
+var __obj={};
+
+__func(__obj);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__obj.E !== 2.74) {
+ throw new Test262Error('#1: __obj.E === 2.74. Actual: __obj.E ==='+__obj.E);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A5_T1.js b/js/src/tests/test262/language/statements/function/S13.2.1_A5_T1.js
new file mode 100644
index 0000000000..ab95e11349
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A5_T1.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Closures are admitted
+es5id: 13.2.1_A5_T1
+description: Sorting with closure
+---*/
+
+var __arr = [4,3,2,1,4,3,2,1,4,3,2,1];
+//Sort uses closure
+//
+__arr.sort(
+ function(x,y) {
+ if (x>y){return -1;}
+ if (x<y){return 1;}
+ if (x==y){return 0;}
+ }
+);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__arr.toString() !== [4,4,4,3,3,3,2,2,2,1,1,1].toString()) {
+ throw new Test262Error('#1: __arr.toString() === [4,4,4,3,3,3,2,2,2,1,1,1].toString(). Actual: __arr.toString() ==='+__arr.toString());
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A5_T2.js b/js/src/tests/test262/language/statements/function/S13.2.1_A5_T2.js
new file mode 100644
index 0000000000..68dd3fba7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A5_T2.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Closures are admitted
+es5id: 13.2.1_A5_T2
+description: >
+ Returning a function that approximates the derivative of f using
+ an interval of dx, which should be appropriately small
+---*/
+
+// Return a function that approximates the derivative of f
+// using an interval of dx, which should be appropriately small.
+function derivative(f, dx) {
+ return function(x) {
+ return (f(x + dx) - f(x)) / dx;
+ };
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (Math.abs(derivative(Math.sin, 0.0001)(0) - derivative(Math.sin, 0.0001)(2*Math.PI)) >= 1/65536.0) {
+ throw new Test262Error('#1: Math.abs(derivative(Math.sin, 0.0001)(0) - derivative(Math.sin, 0.0001)(2*Math.PI)) <= 1/65536.0');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A6_T1.js b/js/src/tests/test262/language/statements/function/S13.2.1_A6_T1.js
new file mode 100644
index 0000000000..6dd6f3df27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A6_T1.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Primitive types are passed by value
+es5id: 13.2.1_A6_T1
+description: Declaring a function with "function __func(arg1, arg2)"
+flags: [noStrict]
+---*/
+
+function __func(arg1, arg2){
+ arg1++;
+ arg2+="BA";
+};
+
+var x=1;
+y=2;
+var a="AB"
+b="SAM";
+
+__func(x,a);
+__func(y,b);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x!==1 || y!==2 || a!=="AB" || b!=="SAM") {
+ throw new Test262Error('#1: x === 1 and y === 2 and a === "AB" and b === "SAM". Actual: x ==='+x+' and y ==='+y+' and a ==='+a+' and b ==='+b);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A6_T2.js b/js/src/tests/test262/language/statements/function/S13.2.1_A6_T2.js
new file mode 100644
index 0000000000..274fc50f4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A6_T2.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Primitive types are passed by value
+es5id: 13.2.1_A6_T2
+description: Declaring a function with "__func = function(arg1, arg2)"
+flags: [noStrict]
+---*/
+
+__func = function(arg1, arg2){
+ arg1++;
+ arg2+="BA";
+};
+
+var x=1;
+y=2;
+var a="AB"
+b="SAM";
+
+__func(x,a);
+__func(y,b);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x!==1 || y!==2 || a!=="AB" || b!=="SAM") {
+ throw new Test262Error('#1: x === 1 and y === 2 and a === "AB" and b === "SAM". Actual: x ==='+x+' and y ==='+y+' and a ==='+a+' and b ==='+b);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A6_T3.js b/js/src/tests/test262/language/statements/function/S13.2.1_A6_T3.js
new file mode 100644
index 0000000000..51c41e1d2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A6_T3.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Primitive types are passed by value
+es5id: 13.2.1_A6_T1
+description: Declaring a function with "function __func(arg1, arg2)"
+---*/
+
+var __func, y, b;
+
+function __func(arg1, arg2){
+ arg1++;
+ arg2+="BA";
+};
+
+var x=1;
+y=2;
+var a="AB"
+b="SAM";
+
+__func(x,a);
+__func(y,b);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x!==1 || y!==2 || a!=="AB" || b!=="SAM") {
+ throw new Test262Error('#1: x === 1 and y === 2 and a === "AB" and b === "SAM". Actual: x ==='+x+' and y ==='+y+' and a ==='+a+' and b ==='+b);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A6_T4.js b/js/src/tests/test262/language/statements/function/S13.2.1_A6_T4.js
new file mode 100644
index 0000000000..443df08052
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A6_T4.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Primitive types are passed by value
+es5id: 13.2.1_A6_T2
+description: Declaring a function with "__func = function(arg1, arg2)"
+---*/
+
+var __func, y, b;
+
+__func = function(arg1, arg2){
+ arg1++;
+ arg2+="BA";
+};
+
+var x=1;
+y=2;
+var a="AB"
+b="SAM";
+
+__func(x,a);
+__func(y,b);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x!==1 || y!==2 || a!=="AB" || b!=="SAM") {
+ throw new Test262Error('#1: x === 1 and y === 2 and a === "AB" and b === "SAM". Actual: x ==='+x+' and y ==='+y+' and a ==='+a+' and b ==='+b);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A7_T1.js b/js/src/tests/test262/language/statements/function/S13.2.1_A7_T1.js
new file mode 100644
index 0000000000..f891e5921c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A7_T1.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object F is called, the following steps are taken:
+ 2. Evaluate F's FunctionBody;
+ if Result.type is returned then Result.value is returned too
+es5id: 13.2.1_A7_T1
+description: Returning null. Declaring a function with "function __func()"
+---*/
+
+function __func(){
+ var x = null;
+ return x;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ var x=__func();
+} catch(e){
+ throw new Test262Error('#1: var x=__func() does not lead to throwing exception. Actual: exception is '+e);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A7_T2.js b/js/src/tests/test262/language/statements/function/S13.2.1_A7_T2.js
new file mode 100644
index 0000000000..9aa2ab4864
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A7_T2.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object F is called, the following steps are taken:
+ 2. Evaluate F's FunctionBody;
+ if Result.type is returned then Result.value is returned too
+es5id: 13.2.1_A7_T2
+description: >
+ Returning null. Declaring a function with "var __func = function
+ ()"
+---*/
+
+var __func = function (){
+ var x = null;
+ return x;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ var x=__func();
+} catch(e){
+ throw new Test262Error('#1: var x=__func() does not lead to throwing exception. Actual: exception is '+e);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A7_T3.js b/js/src/tests/test262/language/statements/function/S13.2.1_A7_T3.js
new file mode 100644
index 0000000000..dfa88c33e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A7_T3.js
@@ -0,0 +1,56 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object F is called, the following steps are taken:
+ 2. Evaluate F's FunctionBody;
+ if Result.type is returned then Result.value is returned too
+es5id: 13.2.1_A7_T3
+description: Returning number. Declaring a function with "function __func()"
+flags: [noStrict]
+---*/
+
+function __func(){
+ x = 1;
+ return x;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+try {
+ x=x;
+ throw new Test262Error('#0: "x=x" lead to throwing exception');
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ var __x=__func();
+} catch(e){
+ throw new Test262Error('#1: var __x=__func() does not lead to throwing exception. Actual: exception is '+e);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__x !== 1) {
+ throw new Test262Error('#2: __x === 1. Actual: __x ==='+__x);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (x !== 1) {
+ throw new Test262Error('#3: x === 1. Actual: x ==='+x);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A7_T4.js b/js/src/tests/test262/language/statements/function/S13.2.1_A7_T4.js
new file mode 100644
index 0000000000..c6a3257a0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A7_T4.js
@@ -0,0 +1,58 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object F is called, the following steps are taken:
+ 2. Evaluate F's FunctionBody;
+ if Result.type is returned then Result.value is returned too
+es5id: 13.2.1_A7_T4
+description: Returning boolean. Declaring a function with "function __func()"
+---*/
+
+function __func(){
+ var x = true;
+ return x;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+try {
+ x=x;
+ throw new Test262Error('#0: "x=x" lead to throwing exception');
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ var __x=__func()
+} catch(e){
+ throw new Test262Error('#1: var __x=__func() does not lead to throwing exception. Actual: exception is '+e);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (!(__x)) {
+ throw new Test262Error('#2: __x === true. Actual: __x ==='+__x);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+try {
+ x=x;
+ throw new Test262Error('#3: "x=x" lead to throwing exception');
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A8_T1.js b/js/src/tests/test262/language/statements/function/S13.2.1_A8_T1.js
new file mode 100644
index 0000000000..9ab0050a36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A8_T1.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object F is called, the following steps are taken:
+ 2. Evaluate F's FunctionBody;
+ if Result.type is thrown then Result.value is thrown too
+es5id: 13.2.1_A8_T1
+description: >
+ Throwing an exception within a function body. Declaring function
+ with "function __func()"
+---*/
+
+function __func(){
+ var x = 1;
+ throw ("Catch Me If You Can")
+ return x;
+}
+
+try{
+ var x=__func()
+ throw new Test262Error('#0: var x=__func() lead to throwing exception');
+} catch(e){
+ if (e !== "Catch Me If You Can") {
+ throw new Test262Error('#1: Exception === "Catch Me If You Can". Actual: exception ==='+e);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A8_T2.js b/js/src/tests/test262/language/statements/function/S13.2.1_A8_T2.js
new file mode 100644
index 0000000000..418376aeb8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A8_T2.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object F is called, the following steps are taken:
+ 2. Evaluate F's FunctionBody;
+ if Result.type is thrown then Result.value is thrown too
+es5id: 13.2.1_A8_T2
+description: >
+ Throwing an exception within a function body. Declaring function
+ with "var __func = function (message)"
+---*/
+
+var CATCH_ME_IF_YOU_CAN = true;
+
+var __func = function (message){
+ var x = 1;
+ throw (message)
+ return x;
+}
+
+try{
+ var x=__func(CATCH_ME_IF_YOU_CAN)
+ throw new Test262Error('#0: var x=__func(CATCH_ME_IF_YOU_CAN) lead to throwing exception');
+} catch(e){
+ if (!e) {
+ throw new Test262Error('#1: Exception === true. Actual: exception ==='+e);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A9.1_T1.js b/js/src/tests/test262/language/statements/function/S13.2.1_A9.1_T1.js
new file mode 100644
index 0000000000..ed32b92093
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A9.1_T1.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object is called,
+ the body is evaluated and if evaluation result has type "normal", then "undefined" is returned
+es5id: 13.2.1_A9.1_T1
+description: >
+ Declaring a function with "function __func()" and no "return" in
+ the function body
+---*/
+
+var x;
+
+function __func(){
+ x = true;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func() !== undefined) {
+ throw new Test262Error('#1: __func() === undefined. Actual: __func() ==='+__func());
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (!x) {
+ throw new Test262Error('#2: x === true. Actual: x === '+x);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A9.1_T2.js b/js/src/tests/test262/language/statements/function/S13.2.1_A9.1_T2.js
new file mode 100644
index 0000000000..a1c12ce74a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A9.1_T2.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object is called,
+ the body is evaluated and if evaluation result has type "normal", then "undefined" is returned
+es5id: 13.2.1_A9.1_T2
+description: >
+ Declaring a function with "var __func = function()" and no
+ "return" in the function body
+---*/
+
+var x;
+
+var __func = function(){
+ x = true;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func() !== undefined) {
+ throw new Test262Error('#1: __func() === undefined. Actual: __func() ==='+__func());
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (!x) {
+ throw new Test262Error('#2: x === true. Actual: x === '+x);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A9_T1.js b/js/src/tests/test262/language/statements/function/S13.2.1_A9_T1.js
new file mode 100644
index 0000000000..c5e84d2641
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A9_T1.js
@@ -0,0 +1,37 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object is called,
+ the body is evaluated and if evaluation result has type "return" its value is not defined, then "undefined" is returned
+es5id: 13.2.1_A9_T1
+description: >
+ Using "return" with no expression. Declaring a function with
+ "function __func()"
+---*/
+
+var x;
+
+function __func(){
+ x = 1;
+ return;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func() !== undefined) {
+ throw new Test262Error('#1: __func() === undefined. Actual: __func() ==='+__func());
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (x!==1) {
+ throw new Test262Error('#2: x === 1. Actual: x === '+x);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.1_A9_T2.js b/js/src/tests/test262/language/statements/function/S13.2.1_A9_T2.js
new file mode 100644
index 0000000000..cd7c9b50b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.1_A9_T2.js
@@ -0,0 +1,37 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Call]] property for a Function object is called,
+ the body is evaluated and if evaluation result has type "return" its value is not defined, then "undefined" is returned
+es5id: 13.2.1_A9_T2
+description: >
+ Using "return" with no expression. Declaring a function with "var
+ __func = function()"
+---*/
+
+var x;
+
+var __func = function(){
+ x = 1;
+ return;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func() !== undefined) {
+ throw new Test262Error('#1: __func() === undefined. Actual: __func() ==='+__func());
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (x!==1) {
+ throw new Test262Error('#2: x === 1. Actual: x === '+x);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A10.js b/js/src/tests/test262/language/statements/function/S13.2.2_A10.js
new file mode 100644
index 0000000000..68bac38cc8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A10.js
@@ -0,0 +1,40 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Calling a function as a constructor is possible as long as
+ this.any_Function is declared
+es5id: 13.2.2_A10
+description: Calling a function as a constructor after it has been declared
+---*/
+
+function FACTORY(){
+ this.id = 0;
+
+ this.func = function (){
+ return 5;
+ }
+
+ this.id = this.func();
+
+}
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ var obj = new FACTORY();
+} catch (e) {
+ throw new Test262Error('#1: var obj = new FACTORY() does not lead to throwing exception. Actual: Exception is '+e);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (obj.id !== 5) {
+ throw new Test262Error('#2: obj.id === 5. Actual: obj.id ==='+obj.id);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A11.js b/js/src/tests/test262/language/statements/function/S13.2.2_A11.js
new file mode 100644
index 0000000000..2ac9c4345f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A11.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Calling a function as a constructor is possible as long as
+ this.any_Function is declared and called
+es5id: 13.2.2_A11
+description: >
+ Calling a function as a constructor after it has been declared
+ with "function func()"
+---*/
+
+function FACTORY(){
+ this.id = 0;
+
+ this.id = this.func();
+
+ function func(){
+ return "id_string";
+ }
+
+}
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ var obj = new FACTORY();
+ throw new Test262Error('#1: var obj = new FACTORY() lead to throwing exception');
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A12.js b/js/src/tests/test262/language/statements/function/S13.2.2_A12.js
new file mode 100644
index 0000000000..02f6d6e8c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A12.js
@@ -0,0 +1,42 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Calling a function as a constructor is possible as long as
+ this.any_Function is declared and called
+es5id: 13.2.2_A12
+description: >
+ Calling a function as a constructor after it has been declared
+ with "function func()"
+---*/
+
+function FACTORY(){
+ this.id = 0;
+
+ this.id = func();
+
+ function func(){
+ return "id_string";
+ }
+
+}
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ var obj = new FACTORY();
+} catch (e) {
+ throw new Test262Error('#1: var obj = new FACTORY() does not lead to throwing exception. Actual: Exception is '+e);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (obj.id !== "id_string") {
+ throw new Test262Error('#2: obj.id === "id_string". Actual: obj.id ==='+obj.id);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A13.js b/js/src/tests/test262/language/statements/function/S13.2.2_A13.js
new file mode 100644
index 0000000000..7077426b4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A13.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Calling a function as a constructor is inadmissible as long as
+ this.any_Function is declared by eval and called
+es5id: 13.2.2_A13
+description: >
+ Calling a function as a constructor after it has been declared by
+ eval
+---*/
+
+function FACTORY(){
+ this.id = 0;
+
+ this.id = func();
+
+ eval("function func(){return \"id_string\";}");
+
+}
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ var obj = new FACTORY();
+ throw new Test262Error('#1: var obj = new FACTORY() lead to throwing exception');
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A14.js b/js/src/tests/test262/language/statements/function/S13.2.2_A14.js
new file mode 100644
index 0000000000..49b017f724
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A14.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Calling a function as a constructor is inadmissible as long as
+ this.any_Function is declared by eval and called
+es5id: 13.2.2_A14
+description: >
+ Calling a function as a constructor after it has been declared by
+ eval
+flags: [noStrict]
+---*/
+
+function FACTORY(){
+ this.id = 0;
+
+ eval("function func(){return \"id_string\";}");
+
+ this.id = func();
+
+}
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ var obj = new FACTORY();
+} catch (e) {
+ throw new Test262Error('#1: var obj = new FACTORY() does not lead to throwing exception');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A15_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A15_T1.js
new file mode 100644
index 0000000000..c73e673ead
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A15_T1.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called,
+ and the object created in the function is returned, the object (declared with "this" within a function) will be strong and healthy
+es5id: 13.2.2_A15_T1
+description: >
+ Function declared at the end of the program and "obj" property is
+ declared with "var obj = {}"
+---*/
+
+var __obj = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof obj !== "undefined") {
+ throw new Test262Error('#1: typeof obj === "undefined". Actual: typeof obj ==='+typeof obj);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.prop !== "A") {
+ throw new Test262Error('#2: __obj.prop === "A". Actual: __obj.prop ==='+__obj.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__obj.slot.prop !==1) {
+ throw new Test262Error('#3: __obj.slot.prop ===1. Actual: __obj.slot.prop ==='+__obj.slot.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __FACTORY(){
+ this.prop = 1;
+ var obj = {};
+ obj.prop = "A";
+ obj.slot = this;
+ return obj;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A15_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A15_T2.js
new file mode 100644
index 0000000000..cbf5c775f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A15_T2.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called,
+ and the object created in the function is returned, the object (declared with "this" within a function) will be strong and healthy
+es5id: 13.2.2_A15_T2
+description: >
+ Function declared at the end of the program and "obj" property is
+ declared with "obj = {}"
+---*/
+
+var obj;
+
+var __obj = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (obj.prop !== "A") {
+ throw new Test262Error('#1: obj.prop === "A". Actual: obj.prop ==='+obj.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.prop !== "A") {
+ throw new Test262Error('#2: __obj.prop === "A". Actual: __obj.prop ==='+__obj.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__obj.slot.prop !==1) {
+ throw new Test262Error('#3: __obj.slot.prop === 1. Actual: __obj.slot.prop ==='+__obj.slot.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __FACTORY(){
+ this.prop = 1;
+ obj = {};
+ obj.prop = "A";
+ obj.slot = this;
+ return obj;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A15_T3.js b/js/src/tests/test262/language/statements/function/S13.2.2_A15_T3.js
new file mode 100644
index 0000000000..a58c0a57d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A15_T3.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called,
+ and the object created in the function is returned, the object (declared with "this" within a function) will be strong and healthy
+es5id: 13.2.2_A15_T3
+description: >
+ Function declared at the end of the program and "obj" property is
+ declared with "var obj = {}"
+---*/
+
+var __FACTORY, __obj;
+
+__FACTORY = function (){
+ this.prop = 1;
+ var obj = {};
+ obj.prop = "A";
+ obj.slot = this;
+ return obj;
+}
+
+__obj = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof obj !== "undefined") {
+ throw new Test262Error('#1: typeof obj === "undefined". Actual: typeof obj ==='+typeof obj);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.prop !== "A") {
+ throw new Test262Error('#2: __obj.prop === "A". Actual: __obj.prop ==='+__obj.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__obj.slot.prop !==1) {
+ throw new Test262Error('#3: __obj.slot.prop ===1. Actual: __obj.slot.prop ==='+__obj.slot.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A15_T4.js b/js/src/tests/test262/language/statements/function/S13.2.2_A15_T4.js
new file mode 100644
index 0000000000..014ced8751
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A15_T4.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called,
+ and the object created in the function is returned, the object (declared with "this" within a function) will be strong and healthy
+es5id: 13.2.2_A15_T4
+description: >
+ Function declared at the end of the program and "obj" property is
+ declared with "obj = {}"
+---*/
+
+var __FACTORY, __obj, obj;
+
+__FACTORY = function(){
+ this.prop = 1;
+ obj = {};
+ obj.prop = "A";
+ obj.slot = this;
+ return obj;
+}
+
+__obj = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (obj.prop !== "A") {
+ throw new Test262Error('#1: obj.prop === "A". Actual: obj.prop ==='+obj.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.prop !== "A") {
+ throw new Test262Error('#2: __obj.prop === "A". Actual: __obj.prop ==='+obj.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__obj.slot.prop !==1) {
+ throw new Test262Error('#3: __obj.slot.prop ===1. Actual: __obj.slot.prop ==='+obj.slot.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A16_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A16_T1.js
new file mode 100644
index 0000000000..4ffd0fb889
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A16_T1.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression within a new statement is admitted
+es5id: 13.2.2_A16_T1
+description: >
+ Using "is __obj = new function __func(){this.prop=1;}" as
+ FunctionExpression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func !== "undefined") {
+ throw new Test262Error('#1: typeof __func === "undefined". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __obj = new function __func(){this.prop=1;};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.prop !== 1) {
+ throw new Test262Error('#2: __obj.prop === 1. Actual: __obj.prop ==='+__obj.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if (typeof __func !== "undefined") {
+ throw new Test262Error('#5: typeof __func === "undefined". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A16_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A16_T2.js
new file mode 100644
index 0000000000..9473e06431
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A16_T2.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression within a new statement is admitted
+es5id: 13.2.2_A16_T2
+description: >
+ Using "var __obj = new function __func(arg){this.prop=arg;}(5)" as
+ FunctionExpression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func !== "undefined") {
+ throw new Test262Error('#1: typeof __func === "undefined". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __obj = new function __func(arg){this.prop=arg;}(5);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.prop !== 5) {
+ throw new Test262Error('#2: __obj.prop === 5. Actual: __obj.prop ==='+__obj.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (typeof __func !== "undefined") {
+ throw new Test262Error('#3: typeof __func === "undefined". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A16_T3.js b/js/src/tests/test262/language/statements/function/S13.2.2_A16_T3.js
new file mode 100644
index 0000000000..34db63b436
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A16_T3.js
@@ -0,0 +1,46 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression within a new statement is admitted
+es5id: 13.2.2_A16_T3
+description: >
+ Using "is __obj = new function __func(arg){this.prop=arg; return
+ {feat: ++arg}}(5)" as FunctionExpression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func !== "undefined") {
+ throw new Test262Error('#1: typeof __func === "undefined"');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __obj = new function __func(arg){this.prop=arg; return {feat: ++arg}}(5);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.prop !== undefined) {
+ throw new Test262Error('#2: __obj.prop === undefined. Actual: __obj.prop ==='+__obj.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__obj.feat !== 6) {
+ throw new Test262Error('#3: __obj.feat === 6. Actual: __obj.feat ==='+__obj.feat);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (typeof __func !== "undefined") {
+ throw new Test262Error('#4: typeof __func === "undefined". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A17_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A17_T2.js
new file mode 100644
index 0000000000..e5d0d2e5d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A17_T2.js
@@ -0,0 +1,72 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression containing "with" statement is admitted
+es5id: 13.2.2_A17_T2
+description: Throwing an exception within "with" statement
+flags: [noStrict]
+---*/
+
+this.p1="alert";
+
+__obj={p1:1,getRight:function(){return "right";}};
+
+getRight=function(){return "napravo";};
+
+try {
+ (function(){
+ with(__obj){
+ p1="w1";
+ getRight=function(){return false;}
+ throw p1;
+ }
+ })();
+} catch (e) {
+ resukt = p1;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (p1!=="alert") {
+ throw new Test262Error('#1: p1 === "alert". Actual: p1==='+p1);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (getRight()!=="napravo") {
+ throw new Test262Error('#2: getRight() === "napravo". Actual: getRight() === '+getRight());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__obj.p1!=="w1") {
+ throw new Test262Error('#3: __obj.p1 === "w1". Actual: __obj.p1 ==='+__obj.p1);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (__obj.getRight()!==false) {
+ throw new Test262Error('#4: __obj.getRight() === false. Actual: __obj.getRight() === '+__obj.getRight());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if (resukt !== "alert") {
+ throw new Test262Error('#5: resukt === "alert". Actual: resukt ==='+resukt);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var resukt;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A17_T3.js b/js/src/tests/test262/language/statements/function/S13.2.2_A17_T3.js
new file mode 100644
index 0000000000..451355fe6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A17_T3.js
@@ -0,0 +1,71 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression containing "with" statement is admitted
+es5id: 13.2.2_A17_T3
+description: >
+ In the check 4 we populate field getRight in __obj object since
+ var getRight declaration adds variable to function scope but
+ getRight in statement resolves within with(__obj) scope and
+ searchs getRight in __obj first
+flags: [noStrict]
+---*/
+
+p1="alert";
+
+this.__obj={p1:1,getRight:function(){return "right";}};
+
+var getRight=function(){return "napravo";};
+
+resukt=(function(){
+ with(__obj){
+ p1="w1";
+ var getRight=function(){return false;};
+ return p1;
+ }
+})();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (p1!=="alert") {
+ throw new Test262Error('#1: p1 === "alert". Actual: p1==='+p1);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (getRight()!=="napravo") {
+ throw new Test262Error('#2: getRight() === "napravo". Actual: getRight()==='+getRight());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__obj.p1!=="w1") {
+ throw new Test262Error('#3: __obj.p1 === "w1". Actual: __obj.p1 ==='+__obj.p1);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (__obj.getRight()!==false) {
+ throw new Test262Error('#4: __obj.getRight() === false. Actual: __obj.getRight()==='+__obj.getRight());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if (resukt !== "w1") {
+ throw new Test262Error('#5: resukt === "w1". Actual: resukt ==='+resukt);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var resukt;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A18_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A18_T1.js
new file mode 100644
index 0000000000..5983be4bf7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A18_T1.js
@@ -0,0 +1,57 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using arguments object within a "with" Expression that is nested in a
+ function is admitted
+es5id: 13.2.2_A18_T1
+description: "Object is declared with \"var __obj={callee:\"a\"}\""
+flags: [noStrict]
+---*/
+
+var callee=0, b;
+
+var __obj={callee:"a"};
+
+result=(function(){
+ with (arguments){
+ callee=1;
+ b=true;
+ }
+ return arguments;
+})(__obj);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (callee !== 0) {
+ throw new Test262Error('#1: callee === 0. Actual: callee ==='+callee);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.callee !== "a") {
+ throw new Test262Error('#2: __obj.callee === "a". Actual: __obj.callee==='+__obj.callee);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (result.callee !== 1) {
+ throw new Test262Error('#3: result.callee === 1. Actual: result.callee ==='+result.callee);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (!(this.b)) {
+ throw new Test262Error('#4: this.b === true. Actual: this.b ==='+this.b);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A18_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A18_T2.js
new file mode 100644
index 0000000000..443e0195a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A18_T2.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using arguments object within a "with" Expression that is nested in a
+ function is admitted
+es5id: 13.2.2_A18_T2
+description: "Object is declared with \"__obj={callee:\"a\"}\""
+flags: [noStrict]
+---*/
+
+this.callee = 0;
+var b;
+
+__obj={callee:"a"};
+
+function f(){
+ with (arguments){
+ callee=1;
+ b=true;
+ return arguments;
+ }
+};
+
+result=f(__obj);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (callee !== 0) {
+ throw new Test262Error('#1: callee === 0. Actual: callee ==='+callee);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.callee !== "a") {
+ throw new Test262Error('#2: __obj.callee === "a". Actual: __obj.callee ==='+__obj.callee);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (result.callee !== 1) {
+ throw new Test262Error('#3: result.callee === 1. Actual: result.callee ==='+result.callee);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (!(this.b)) {
+ throw new Test262Error('#4: this.b === true. Actual: this.b ==='+this.b);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A19_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T1.js
new file mode 100644
index 0000000000..8d9fda0448
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T1.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function's scope chain is started when it is declared
+es5id: 13.2.2_A19_T1
+description: Function is declared in the global scope
+flags: [noStrict]
+---*/
+
+var a = 1;
+
+var __func= function(){return a;};
+
+var __obj = {a:2};
+
+with (__obj)
+{
+ result = __func();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (result !== 1) {
+ throw new Test262Error('#1: result === 1. Actual: result ==='+result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A19_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T2.js
new file mode 100644
index 0000000000..fc4ac71d42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T2.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function's scope chain is started when it is declared
+es5id: 13.2.2_A19_T2
+description: Function is declared in the object scope. Using "with" statement
+flags: [noStrict]
+---*/
+
+var a = 1;
+
+var __obj = {a:2};
+
+with (__obj)
+{
+ result = (function(){return a;})();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (result !== 2) {
+ throw new Test262Error('#1: result === 2. Actual: result ==='+result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A19_T3.js b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T3.js
new file mode 100644
index 0000000000..8467e7da14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T3.js
@@ -0,0 +1,37 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function's scope chain is started when it is declared
+es5id: 13.2.2_A19_T3
+description: >
+ Function is declared in the object scope and then an exception is
+ thrown
+flags: [noStrict]
+---*/
+
+var a = 1;
+
+var __obj = {a:2};
+
+try {
+ with (__obj)
+ {
+ var __func = function (){return a;};
+ throw 3;
+ }
+} catch (e) {
+ ;
+}
+
+result = __func();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (result !== 2) {
+ throw new Test262Error('#1: result === 2. Actual: result ==='+result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A19_T4.js b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T4.js
new file mode 100644
index 0000000000..fa3ca8b7eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T4.js
@@ -0,0 +1,39 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function's scope chain is started when it is declared
+es5id: 13.2.2_A19_T4
+description: >
+ Function is declared in the hierarchical object scope and then an
+ exception is thrown
+flags: [noStrict]
+---*/
+
+var a = 1;
+
+var __obj = {a:2,__obj:{a:3}};
+
+try {
+ with (__obj)
+ {
+ with(__obj){
+ var __func = function(){return a;};
+ throw 5;
+ }
+ }
+} catch (e) {
+ ;
+}
+
+result = __func();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (result !== 3) {
+ throw new Test262Error('#1: result === 3. Actual: result ==='+result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A19_T5.js b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T5.js
new file mode 100644
index 0000000000..09695df97a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T5.js
@@ -0,0 +1,43 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function's scope chain is started when it is declared
+es5id: 13.2.2_A19_T5
+description: >
+ Function is declared in the object scope, then an exception is
+ thrown and the object is deleted
+flags: [noStrict]
+---*/
+
+var a = 1;
+
+var __obj = {a:2};
+
+with (__obj)
+{
+ try {
+
+ var __func = function()
+ {
+ return a;
+ }
+ throw 3;
+ } catch (e) {
+ ;
+ }
+}
+
+delete __obj;
+
+result = __func();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (result !== 2) {
+ throw new Test262Error('#1: result === 2. Actual: result ==='+result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A19_T6.js b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T6.js
new file mode 100644
index 0000000000..b13daa112f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T6.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function's scope chain is started when it is declared
+es5id: 13.2.2_A19_T6
+description: >
+ Function is declared in the "object->do-while" scope, then the
+ object is deleted and another object with the same name is declared
+flags: [noStrict]
+---*/
+
+var a = 1;
+
+var __obj = {a:2};
+
+with (__obj)
+{
+ do {
+ var __func = function()
+ {
+ return a;
+ }
+ } while(0);
+}
+
+delete __obj;
+
+var __obj = {a:3};
+
+with (__obj)
+{
+ result = __func();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (result !== 2) {
+ throw new Test262Error('#1: result === 2. Actual: result ==='+result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A19_T7.js b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T7.js
new file mode 100644
index 0000000000..1982732b66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T7.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function's scope chain is started when it is declared
+es5id: 13.2.2_A19_T7
+description: Function is declared in the object scope as a variable
+flags: [noStrict]
+---*/
+
+var a = 1;
+
+var __obj = {a:2};
+
+with (__obj)
+{
+ var __func = function()
+ {
+ return a;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__obj.hasOwnProperty('__func')) {
+ throw new Test262Error('#1: __obj.hasOwnProperty(\'__func\') === false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////// /////////////////////////////////////////
+//CHECK#2
+if (!(this.hasOwnProperty('__func'))) {
+ throw new Test262Error('#2: this.hasOwnProperty(\'__func\') === true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__func in __obj) {
+ throw new Test262Error('#3: (__func in __obj) === false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (this.__func === undefined) {
+ throw new Test262Error('#4: this.__func !== undefined');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A19_T8.js b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T8.js
new file mode 100644
index 0000000000..577fba297f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A19_T8.js
@@ -0,0 +1,75 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function's scope chain is started when it is declared
+es5id: 13.2.2_A19_T8
+description: Function is declared multiply times
+flags: [noStrict]
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#0
+if (typeof __func !== "undefined") {
+ throw new Test262Error('#0: typeof __func === "undefined". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var a = 1, b = "a";
+
+var __obj = {a:2};
+
+with (__obj)
+{
+ while(1){
+ var __func = function()
+ {
+ return a;
+ };
+ break;
+ }
+}
+
+delete __obj;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func() !== 2) {
+ throw new Test262Error('#1: __func() === 2. Actual: __func() ==='+__func());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __obj = {a:3,b:"b"};
+
+with (__obj)
+{
+ var __func = function()
+ {
+ return b;
+ }
+}
+
+delete __obj;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func()!=="b") {
+ throw new Test262Error('#2: __func()==="b". Actual: __func()==='+__func());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+with ({a:99,b:"c"})
+{
+ //////////////////////////////////////////////////////////////////////////////
+ //CHECK#3
+ if (__func() !== "b") {
+ throw new Test262Error('#3: __func()==="b". Actual: __func()==='+__func());
+ }
+ //
+ //////////////////////////////////////////////////////////////////////////////
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A1_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A1_T1.js
new file mode 100644
index 0000000000..8ef3731517
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A1_T1.js
@@ -0,0 +1,46 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Since a function is an object, it might be set to [[Prototype]] property
+ of a new created object through [[Construct]] property
+es5id: 13.2.2_A1_T1
+description: Declaring a function with "function __func()"
+---*/
+
+var __MONSTER="monster";
+var __PREDATOR="predator";
+
+function __PROTO(){};
+
+try{
+ __PROTO.type=__MONSTER;
+}
+catch(e){
+ throw new Test262Error('#0: __PROTO.type=__MONSTER does not lead to throwing exception')
+}
+
+function __FACTORY(){};
+
+__FACTORY.prototype=__PROTO;
+
+var __monster = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__PROTO.isPrototypeOf(__monster))) {
+ throw new Test262Error('#1: __PROTO.isPrototypeOf(__monster) must be true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__monster.type !==__MONSTER) {
+ throw new Test262Error('#2: __monster.type ===__MONSTER. Actual: __monster.type ==='+__monster.type);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A1_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A1_T2.js
new file mode 100644
index 0000000000..00296c20ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A1_T2.js
@@ -0,0 +1,46 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Since a function is an object, it might be set to [[Prototype]] property
+ of a new created object through [[Construct]] property
+es5id: 13.2.2_A1_T2
+description: Declaring a function with "var __PROTO = function()"
+---*/
+
+var __MONSTER="monster";
+var __PREDATOR="predator";
+
+var __PROTO = function(){};
+
+try{
+ __PROTO.type=__MONSTER;
+}
+catch(e){
+ throw new Test262Error('#0: __PROTO.type=__MONSTER does not lead to throwing exception')
+}
+
+var __FACTORY = function(){};
+
+__FACTORY.prototype=__PROTO;
+
+var __monster = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__PROTO.isPrototypeOf(__monster))) {
+ throw new Test262Error('#1: __PROTO.isPrototypeOf(__monster) must be true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__monster.type !==__MONSTER) {
+ throw new Test262Error('#2: __monster.type ===__MONSTER. Actual: __monster.type ==='+__monster.type);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A2.js
new file mode 100644
index 0000000000..0ca29945fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A2.js
@@ -0,0 +1,43 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Since a function is an object, it might be set to [[Prototype]] property of a new created object through [[Construct]] property,
+ but [[call]] property must fail with TypeError error
+es5id: 13.2.2_A2
+description: Trying to [[call]] this function
+---*/
+
+var __PLANT="flower";
+var __ROSE="rose";
+
+function __PROTO(){};
+
+try{
+ __PROTO.type=__PLANT;
+}
+catch(e){
+ throw new Test262Error('#0: __PROTO.type=__PLANT does not lead to throwing exception')
+}
+
+function __FACTORY(){};
+
+__FACTORY.prototype=__PROTO;
+
+var __rose = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ __rose();
+ throw new Test262Error('#1: __rose() lead to throwing exception');
+} catch(e){
+ if (!(e instanceof TypeError)) {
+ throw new Test262Error('#2: Exception Type is TypeError. Actual: exception ==='+e);
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A3_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A3_T1.js
new file mode 100644
index 0000000000..9708a4a34a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A3_T1.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ It gets the value of the [[Prototype]] property of the F(Denote it PROTO_VAL).
+ If PROTO_VAL is not an object, sets the [[Prototype]] property of native ECMAScript object just created
+ to the original Object prototype object as described in 15.2.3.1
+es5id: 13.2.2_A3_T1
+description: Declaring a function with "function __FACTORY()"
+---*/
+
+function __FACTORY(){};
+__FACTORY.prototype=1;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __FACTORY.prototype !== 'number') {
+ throw new Test262Error('#1: typeof __FACTORY.prototype === \'number\'. Actual: typeof __FACTORY.prototype ==='+(typeof __FACTORY.prototype));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __device = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (!(Object.prototype.isPrototypeOf(__device))) {
+ throw new Test262Error('#2: Object.prototype.isPrototypeOf(__device) === true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A3_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A3_T2.js
new file mode 100644
index 0000000000..922413d1fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A3_T2.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ It gets the value of the [[Prototype]] property of the F(Denote it PROTO_VAL).
+ If PROTO_VAL is not an object, sets the [[Prototype]] property of native ECMAScript object just created
+ to the original Object prototype object as described in 15.2.3.1
+es5id: 13.2.2_A3_T2
+description: Declaring a function with "var __FACTORY = function()"
+---*/
+
+var __FACTORY = function(){};
+__FACTORY.prototype=1;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __FACTORY.prototype !== 'number') {
+ throw new Test262Error('#1: typeof __FACTORY.prototype === \'number\'. Actual: typeof __FACTORY.prototype ==='+(typeof __FACTORY.prototype));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __device = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (!(Object.prototype.isPrototypeOf(__device))) {
+ throw new Test262Error('#2: Object.prototype.isPrototypeOf(__device) === true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A4_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A4_T1.js
new file mode 100644
index 0000000000..a891b83d41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A4_T1.js
@@ -0,0 +1,39 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Gets the value of the [[Prototype]] property of the F(Denote it PROTO_VAL).
+ If PROTO_VAL is an object, sets the [[Prototype]] property of native ECMAScript object just created
+ to the PROTO_VAL
+es5id: 13.2.2_A4_T1
+description: Declaring a function with "function __FACTORY()"
+---*/
+
+var __CUBE="cube";
+
+function __FACTORY(){
+};
+__FACTORY.prototype={ shape:__CUBE, printShape:function(){return this.shape;} };
+
+var __device = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__device.printShape === undefined) {
+ throw new Test262Error('#1: __device.printShape !== undefined. Actual: __device.printShape ==='+__device.printShape);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__device.printShape() !== __CUBE) {
+ throw new Test262Error('#2: __device.printShape() === __CUBE. Actual: __device.printShape() ==='+__device.printShape());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A4_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A4_T2.js
new file mode 100644
index 0000000000..5536c28a43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A4_T2.js
@@ -0,0 +1,41 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Gets the value of the [[Prototype]] property of the F(Denote it PROTO_VAL).
+ If PROTO_VAL is an object, sets the [[Prototype]] property of native ECMAScript object just created
+ to the PROTO_VAL
+es5id: 13.2.2_A4_T2
+description: Declaring a function with "__FACTORY = function()"
+---*/
+
+var __CUBE, __FACTORY, __device;
+
+__CUBE="cube";
+
+__FACTORY = function(){};
+
+__FACTORY.prototype={ shape:__CUBE, printShape:function(){return this.shape;} };
+
+__device = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__device.printShape === undefined) {
+ throw new Test262Error('#1: __device.printShape !== undefined. Actual: __device.printShape ==='+__device.printShape);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__device.printShape() !== __CUBE) {
+ throw new Test262Error('#2: __device.printShape() === __CUBE. Actual: __device.printShape() ==='+__device.printShape());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A5_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A5_T1.js
new file mode 100644
index 0000000000..3a50043b88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A5_T1.js
@@ -0,0 +1,83 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Invoke the [[Call]] property of F, providing native ECMAScript object just created as the this value and
+ providing the argument list passed into [[Construct]] as the argument values
+es5id: 13.2.2_A5_T1
+description: Declaring a function with "function __FACTORY(arg1, arg2)"
+---*/
+
+var __VOLUME, __RED, __ID, __BOTTOM, __TOP, __LEFT, color, bottom, left, __device;
+
+__VOLUME=8;
+__RED="red";
+__ID=12342;
+__BOTTOM=1.1;
+__TOP=0.1;
+__LEFT=0.5;
+
+
+function __FACTORY(arg1, arg2){
+ this.volume=__VOLUME;
+ color=__RED;
+ this.id=arg1;
+ bottom=arg2;
+ this.top=arguments[2];
+ left=arguments[3];
+};
+
+__device = new __FACTORY(__ID, __BOTTOM, __TOP, __LEFT);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__device.color !== undefined) {
+ throw new Test262Error('#1: __device.color === undefined. Actual: __device.color ==='+__device.color);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__device.volume !== __VOLUME) {
+ throw new Test262Error('#2: __device.volume === __VOLUME. Actual: __device.volume ==='+__device.volume);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__device.bottom !== undefined) {
+ throw new Test262Error('#3: __device.bottom === undefined. Actual: __device.bottom ==='+__device.bottom);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (__device.id !== __ID) {
+ throw new Test262Error('#4: __device.id === __ID. Actual: __device.id ==='+__device.id);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if (__device.left !== undefined) {
+ throw new Test262Error('#5: __device.left === undefined. Actual: __device.left ==='+__device.left);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#6
+if (__device.top !== __TOP) {
+ throw new Test262Error('#6: __device.top === __TOP. Actual: __device.top ==='+__device.top);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A5_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A5_T2.js
new file mode 100644
index 0000000000..9b2e46107d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A5_T2.js
@@ -0,0 +1,83 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Invoke the [[Call]] property of F, providing native ECMAScript object just created as the this value and
+ providing the argument list passed into [[Construct]] as the argument values
+es5id: 13.2.2_A5_T2
+description: Declaring a function with "__FACTORY = function(arg1, arg2)"
+---*/
+
+var __VOLUME, __RED, __ID, __BOTTOM, __TOP, __LEFT, __FACTORY, color, bottom, left, __device;
+
+__VOLUME=8;
+__RED="red";
+__ID=12342;
+__BOTTOM=1.1;
+__TOP=0.1;
+__LEFT=0.5;
+
+
+__FACTORY = function(arg1, arg2){
+ this.volume=__VOLUME;
+ color=__RED;
+ this.id=arg1;
+ bottom=arg2;
+ this.top=arguments[2];
+ left=arguments[3];
+};
+
+__device = new __FACTORY(__ID, __BOTTOM, __TOP, __LEFT);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__device.color !== undefined) {
+ throw new Test262Error('#1: __device.color === undefined. Actual: __device.color ==='+__device.color);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__device.volume !== __VOLUME) {
+ throw new Test262Error('#2: __device.volume === __VOLUME. Actual: __device.volume ==='+__device.volume);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__device.bottom !== undefined) {
+ throw new Test262Error('#3: __device.bottom === undefined. Actual: __device.bottom ==='+__device.bottom);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (__device.id !== __ID) {
+ throw new Test262Error('#4: __device.id === __ID. Actual: __device.id ==='+__device.id);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if (__device.left !== undefined) {
+ throw new Test262Error('#5: __device.left === undefined. Actual: __device.left ==='+__device.left);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#6
+if (__device.top !== __TOP) {
+ throw new Test262Error('#6: __device.top === __TOP. Actual: __device.top ==='+__device.top);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A6_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A6_T1.js
new file mode 100644
index 0000000000..f5b29daaeb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A6_T1.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument
+ list passed into [[Construct]] as the argument values.
+ If Type( [[Call]] returned) is not Object then return passed as this into [[Call]] object
+es5id: 13.2.2_A6_T1
+description: Declaring a function with "__func = function(arg)"
+---*/
+
+var __FOO, __BAR, __func, __obj;
+
+__FOO="fooValue";
+__BAR="barValue";
+
+__func = function(arg){
+ this.foo=arg;
+ return 0;
+ this.bar=arguments[1];
+};
+
+__obj = new __func(__FOO, __BAR);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__obj.foo!==__FOO) {
+ throw new Test262Error('#1: __obj.foo === __FOO. Actual: __obj.foo==='+__obj.foo);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.bar!==undefined) {
+ throw new Test262Error('#2: __obj.bar === undefined. Actual: __obj.bar==='+__obj.bar);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A6_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A6_T2.js
new file mode 100644
index 0000000000..4ebe5d7c8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A6_T2.js
@@ -0,0 +1,42 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument
+ list passed into [[Construct]] as the argument values.
+ If Type( [[Call]] returned) is not Object then return passed as this into [[Call]] object
+es5id: 13.2.2_A6_T2
+description: Declaring a function with "function __func (arg)"
+---*/
+
+var __FOO="fooValue";
+var __BAR="barValue";
+
+function __func (arg){
+ this.foo=arg;
+ return true;
+ this.bar=arguments[1];
+};
+
+var __obj = new __func(__FOO, __BAR);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__obj.foo!==__FOO) {
+ throw new Test262Error('#1: __obj.foo === __FOO. Actual: __obj.foo==='+__obj.foo);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj.bar!==undefined) {
+ throw new Test262Error('#2: __obj.bar === undefined. Actual: __obj.bar==='+__obj.bar);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A7_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A7_T1.js
new file mode 100644
index 0000000000..8133b46288
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A7_T1.js
@@ -0,0 +1,43 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument
+ list passed into [[Construct]] as the argument values.
+ If Type( [[Call]] returned) is an Object then return this just as obtained object
+es5id: 13.2.2_A7_T1
+description: Declaring a function with "as __func = function(arg)"
+---*/
+
+var __FRST="one";
+var __SCND="two";
+
+function __func (arg1, arg2){
+ this.first=arg1;
+ var __obj={second:arg2};
+ return __obj;
+
+};
+
+var __obj__ = new __func(__FRST, __SCND);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__obj__.first !== undefined) {
+ throw new Test262Error('#1: __obj__.first === undefined. Actual: __obj__.first==='+__obj__.first);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj__.second !== __SCND) {
+ throw new Test262Error('#2: __obj__.second === __SCND. Actual: __obj__.second ==='+__obj__.second);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A7_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A7_T2.js
new file mode 100644
index 0000000000..5c5a629675
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A7_T2.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument
+ list passed into [[Construct]] as the argument values.
+ If Type( [[Call]] returned) is an Object then return this just as obtained object
+es5id: 13.2.2_A7_T2
+description: Declaring a "function as function __func (arg)"
+---*/
+
+var __FRST, __SCND, __func, __obj__;
+
+__FRST="one";
+__SCND="two";
+
+__func = function(arg1, arg2){
+ this.first=arg1;
+ var __obj={second:arg2};
+ return __obj;
+
+};
+
+__obj__ = new __func(__FRST, __SCND);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__obj__.first !== undefined) {
+ throw new Test262Error('#1: __obj__.first === undefined. Actual: __obj__.first==='+__obj__.first);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__obj__.second !== __SCND) {
+ throw new Test262Error('#2: __obj__.second === __SCND. Actual: __obj__.second ==='+__obj__.second);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A8_T1.js b/js/src/tests/test262/language/statements/function/S13.2.2_A8_T1.js
new file mode 100644
index 0000000000..25fe3e8615
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A8_T1.js
@@ -0,0 +1,56 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument
+ list passed into [[Construct]] as the argument values.
+ If Type( [[Call]] returned) is an Function then return this just as obtained function
+es5id: 13.2.2_A8_T1
+description: >
+ Creating a function whose prototype contains "return" followed by
+ declaration of another function
+---*/
+
+var __FRST="one";
+var __SCND="two";
+
+var __func = function(arg1, arg2){
+ this.first=arg1;
+
+ __gunc.prop=arg2;
+ return __gunc;
+ // function declaration
+ function __gunc(arg){return ++arg};
+
+};
+
+var __instance = new __func(__FRST, __SCND);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.first !== undefined) {
+ throw new Test262Error('#1: __instance.first === undefined. Actual: __instance.first ==='+__instance.first);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__instance.prop!==__SCND) {
+ throw new Test262Error('#2: __instance.prop === __SCND. Actual: __instance.prop ==='+__instance.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__instance(1)!== 2) {
+ throw new Test262Error('#2: __instance(1)=== 2. Actual: __instance(1) ==='+__instance(1));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A8_T2.js b/js/src/tests/test262/language/statements/function/S13.2.2_A8_T2.js
new file mode 100644
index 0000000000..fe7c7069b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A8_T2.js
@@ -0,0 +1,54 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument
+ list passed into [[Construct]] as the argument values.
+ If Type( [[Call]] returned) is an Function then return this just as obtained function
+es5id: 13.2.2_A8_T2
+description: >
+ Creating a function whose prototype contains declaration of
+ another function declared as a variable
+---*/
+
+var __FRST="one";
+var __SCND="two";
+
+var __func = function(arg1, arg2){
+ this.first=arg1;
+ var __gunc = function(arg){return arg+="BA"};
+ __gunc.prop=arg2;
+ return __gunc;
+
+};
+
+var __instance = new __func(__FRST, __SCND);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.first !== undefined) {
+ throw new Test262Error('#1: __instance.first === undefined. Actual: __instance.first ==='+__instance.first);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__instance.prop!==__SCND) {
+ throw new Test262Error('#2: __instance.prop === __SCND. Actual: __instance.prop ==='+__instance.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__instance("SAM")!== "SAMBA") {
+ throw new Test262Error('#2: __instance("SAM") === "SAMBA". Actual: __instance("SAM") ==='+__instance("SAM"));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A8_T3.js b/js/src/tests/test262/language/statements/function/S13.2.2_A8_T3.js
new file mode 100644
index 0000000000..dbe654fa37
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A8_T3.js
@@ -0,0 +1,54 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the [[Construct]] property for a Function object F is called:
+ A new native ECMAScript object is created.
+ Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument
+ list passed into [[Construct]] as the argument values.
+ If Type( [[Call]] returned) is an Function then return this just as obtained function
+es5id: 13.2.2_A8_T3
+description: >
+ Creating a function whose prototype contains declaration of
+ another function defined by using Function.call method
+---*/
+
+var __FRST="one";
+var __SCND="two";
+
+var __func = function(arg1, arg2){
+ this.first=arg1;
+ var __gunc = Function.call(this,"arg","return ++arg;");
+ __gunc.prop=arg2;
+ return __gunc;
+
+};
+
+var __instance = new __func(__FRST, __SCND);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.first !== undefined) {
+ throw new Test262Error('#1: __instance.first === undefined. Actual: __instance.first ==='+__instance.first);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__instance.prop!==__SCND) {
+ throw new Test262Error('#2: __instance.prop === __SCND. Actual: __instance.prop ==='+__instance.prop);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__instance(1)!== 2) {
+ throw new Test262Error('#2: __instance(1)=== 2. Actual: __instance(1) ==='+__instance(1));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2.2_A9.js b/js/src/tests/test262/language/statements/function/S13.2.2_A9.js
new file mode 100644
index 0000000000..ac0c051aa3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2.2_A9.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Calling a function as a constructor is inadmissible as long as
+ this.any_Function is called before it is declared
+es5id: 13.2.2_A9
+description: Calling a function as a constructor
+---*/
+
+function FACTORY(){
+ this.id = 0;
+
+ this.id = this.func();
+
+ this.func = function (){
+ return 5;
+ }
+
+}
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ var obj = new FACTORY();
+ throw new Test262Error('#1: var obj = new FACTORY() lead to throwing exception');
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A1_T1.js b/js/src/tests/test262/language/statements/function/S13.2_A1_T1.js
new file mode 100644
index 0000000000..45ff8a4857
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A1_T1.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: A "prototype" property is automatically created for every function
+es5id: 13.2_A1_T1
+description: Using "function __func(){}" as a FunctionDeclaration
+---*/
+
+function __func(){};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func.prototype === undefined) {
+ throw new Test262Error('#1: __func.prototype !== undefined');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A1_T2.js b/js/src/tests/test262/language/statements/function/S13.2_A1_T2.js
new file mode 100644
index 0000000000..e180e4c15e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A1_T2.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: A "prototype" property is automatically created for every function
+es5id: 13.2_A1_T2
+description: Using "var __func = function(){}" as a FunctionDeclaration
+---*/
+
+var __func = function(){};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func.prototype === undefined) {
+ throw new Test262Error('#1: __func.prototype !== undefined');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A2_T1.js b/js/src/tests/test262/language/statements/function/S13.2_A2_T1.js
new file mode 100644
index 0000000000..1a9c6b46ea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A2_T1.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Nested function are admitted
+es5id: 13.2_A2_T1
+description: Nesting level is two
+---*/
+
+var __JEDI="jedi";
+
+function __FUNC(){
+ function __GUNC(){
+ return arguments[0];
+ };
+
+ return __GUNC;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__FUNC()(__JEDI) !== __JEDI) {
+ throw new Test262Error('#1: __FUNC()(__JEDI) === __JEDI. Actual: __FUNC()(__JEDI) ==='+__FUNC()(__JEDI));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A2_T2.js b/js/src/tests/test262/language/statements/function/S13.2_A2_T2.js
new file mode 100644
index 0000000000..f985522156
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A2_T2.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Nested function are admitted
+es5id: 13.2_A2_T2
+description: Nesting level is three
+---*/
+
+var __ROBOT="C3PO";
+
+function __FUNC(){
+ function __GUNC(){
+ return arguments[0];
+ };
+ function __HUNC(){
+ return __GUNC;
+ };
+ return __HUNC;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__FUNC()()(__ROBOT) !== __ROBOT) {
+ throw new Test262Error('#1: __FUNC()()(__ROBOT) === __ROBOT. Actual: __FUNC()()(__ROBOT) ==='+__FUNC()()(__ROBOT));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A3.js b/js/src/tests/test262/language/statements/function/S13.2_A3.js
new file mode 100644
index 0000000000..28b526ca4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A3.js
@@ -0,0 +1,34 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When Function object(F) is constructed the length property of F is set to
+ the number of formal properties specified in FormalParameterList
+es5id: 13.2_A3
+description: >
+ Creating functions with various FormalParameterList and checking
+ their lengths
+---*/
+
+function __func(){};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func.length !== 0) {
+ throw new Test262Error('#1: __func.length === 0. Actual: __func.length ==='+__func.length);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __gunc(a,b,c){};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__gunc.length !== 3) {
+ throw new Test262Error('#2: __gunc.length === 3. Actual: __gunc.length ==='+__gunc.length);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A4_T1.js b/js/src/tests/test262/language/statements/function/S13.2_A4_T1.js
new file mode 100644
index 0000000000..81ecd23d1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A4_T1.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When Function object(F) is constructed the following steps from 9 to 11 take place
+ 9.Create a new object as would be constructed by the expression new Object().
+ 10. Set the constructor property of Result(9) to F. This property is given attributes { DontEnum }.
+ 11. Set the "prototype" property of F to Result(9).
+es5id: 13.2_A4_T1
+description: >
+ Checking prototype, prototype.constructor properties and
+ {DontEnum} property of a constructor. Using "function __func(){}"
+ as a FunctionDeclaration
+---*/
+
+function __func(){};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func.prototype !== 'object') {
+ throw new Test262Error('#1: typeof __func.prototype === \'object\'. Actual: typeof __gunc.prototype ==='+typeof __gunc.prototype);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func.prototype.constructor !== __func) {
+ throw new Test262Error('#2: __func.prototype.constructor === __func. Actual: __gunc.prototype.constructor ==='+__gunc.prototype.constructor);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __constructor_was__enumed;
+
+for (__prop in __func.prototype){
+ if (__prop === 'constructor')
+ __constructor_was__enumed = true;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__constructor_was__enumed) {
+ throw new Test262Error('#3: __constructor_was__enumed === false. Actual: __constructor_was__enumed ==='+__constructor_was__enumed);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A4_T2.js b/js/src/tests/test262/language/statements/function/S13.2_A4_T2.js
new file mode 100644
index 0000000000..7e7d5d68c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A4_T2.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When Function object(F) is constructed the following steps from 9 to 11 take place
+ 9.Create a new object as would be constructed by the expression new Object().
+ 10. Set the constructor property of Result(9) to F. This property is given attributes { DontEnum }.
+ 11. Set the "prototype" property of F to Result(9).
+es5id: 13.2_A4_T2
+description: >
+ Checking prototype, prototype.constructor properties and
+ {DontEnum} property of a constructor. Using "var __gunc =
+ function(){}" as a FunctionDeclaration
+---*/
+
+var __gunc = function(){};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __gunc.prototype !== 'object') {
+ throw new Test262Error('#1: typeof __gunc.prototype === \'object\'. Actual: typeof __gunc.prototype ==='+typeof __gunc.prototype);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__gunc.prototype.constructor !== __gunc) {
+ throw new Test262Error('#2: __gunc.prototype.constructor === __gunc. Actual: __gunc.prototype.constructor ==='+__gunc.prototype.constructor);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __constructor_was__enumed;
+
+for (__prop in __gunc.prototype){
+ if (__prop === 'constructor')
+ __constructor_was__enumed = true;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__constructor_was__enumed) {
+ throw new Test262Error('#3: __constructor_was__enumed === false. Actual: __constructor_was__enumed ==='+__constructor_was__enumed);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A5.js b/js/src/tests/test262/language/statements/function/S13.2_A5.js
new file mode 100644
index 0000000000..d2b096119a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A5.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When Function object(F) is constructed
+ the [[Prototype]] property of F is set to the original Function prototype object as specified in 15.3.3.1
+es5id: 13.2_A5
+description: Function.prototype.isPrototypeOf() is used
+---*/
+
+function __func(){};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(Function.prototype.isPrototypeOf(__func))) {
+ throw new Test262Error('#1: Function.prototype.isPrototypeOf(__func)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+var __gunc = function(){};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (!(Function.prototype.isPrototypeOf(__gunc))) {
+ throw new Test262Error('#1: Function.prototype.isPrototypeOf(__gunc)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A6_T1-strict.js b/js/src/tests/test262/language/statements/function/S13.2_A6_T1-strict.js
new file mode 100644
index 0000000000..d065c8ed05
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A6_T1-strict.js
@@ -0,0 +1,13 @@
+'use strict';
+// Copyright 2011 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2_A6_T1
+description: check if "caller" poisoning poisons getOwnPropertyDescriptor too
+flags: [onlyStrict]
+---*/
+
+Object.getOwnPropertyDescriptor(function(){}, 'caller');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A6_T2-strict.js b/js/src/tests/test262/language/statements/function/S13.2_A6_T2-strict.js
new file mode 100644
index 0000000000..b4fa421bf7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A6_T2-strict.js
@@ -0,0 +1,15 @@
+'use strict';
+// Copyright 2011 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2_A6_T2
+description: >
+ check if "arguments" poisoning poisons getOwnPropertyDescriptor
+ too
+flags: [onlyStrict]
+---*/
+
+Object.getOwnPropertyDescriptor(function(){}, 'arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A7_T1-strict.js b/js/src/tests/test262/language/statements/function/S13.2_A7_T1-strict.js
new file mode 100644
index 0000000000..049044d2b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A7_T1-strict.js
@@ -0,0 +1,13 @@
+'use strict';
+// Copyright 2011 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2_A7_T1
+description: check if "caller" poisoning poisons hasOwnProperty too
+flags: [onlyStrict]
+---*/
+
+(function(){}).hasOwnProperty('caller');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A7_T2-strict.js b/js/src/tests/test262/language/statements/function/S13.2_A7_T2-strict.js
new file mode 100644
index 0000000000..3e8f46bfb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A7_T2-strict.js
@@ -0,0 +1,13 @@
+'use strict';
+// Copyright 2011 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2_A7_T2
+description: check if "arguments" poisoning poisons hasOwnProperty too
+flags: [onlyStrict]
+---*/
+
+(function(){}).hasOwnProperty('arguments');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A8_T1-strict.js b/js/src/tests/test262/language/statements/function/S13.2_A8_T1-strict.js
new file mode 100644
index 0000000000..5e3647ff91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A8_T1-strict.js
@@ -0,0 +1,13 @@
+'use strict';
+// Copyright 2011 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2_A8_T1
+description: check if "caller" poisoning poisons "in" too
+flags: [onlyStrict]
+---*/
+
+'caller' in function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13.2_A8_T2-strict.js b/js/src/tests/test262/language/statements/function/S13.2_A8_T2-strict.js
new file mode 100644
index 0000000000..ec8bde2745
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13.2_A8_T2-strict.js
@@ -0,0 +1,13 @@
+'use strict';
+// Copyright 2011 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.2_A8_T2
+description: check if "arguments" poisoning poisons "in" too
+flags: [onlyStrict]
+---*/
+
+'arguments' in function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A1.js b/js/src/tests/test262/language/statements/function/S13_A1.js
new file mode 100644
index 0000000000..647a1e47fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A1.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "x=function y(){}" statement does not store a reference to the new
+ function in the varaible y(Identifier)
+es5id: 13_A1
+description: Checking the type of y
+---*/
+
+var __func = function __exp__func(){return 0;};
+
+////////////////////////////////////////////////
+// //////////////////////////////
+//CHECK#1
+if (typeof __func !== "function") {
+ throw new Test262Error('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __exp__func !== "undefined"){
+ throw new Test262Error('#2: typeof __exp__func === "undefined". Actual: typeof __exp__func ==='+typeof __exp__func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A10.js b/js/src/tests/test262/language/statements/function/S13_A10.js
new file mode 100644
index 0000000000..29a737ded2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A10.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function is a data
+es5id: 13_A10
+description: Using function as a property of an object
+---*/
+
+function __ziggy__func(){return "ziggy stardust"}
+
+var __music_box={};
+
+__music_box.ziggy = __ziggy__func;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+if (typeof __music_box.ziggy !== "function") {
+ throw new Test262Error('#1: typeof __music_box.ziggy === "function". Actual: typeof __music_box.ziggy ==='+typeof __music_box.ziggy);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__music_box.ziggy() !== "ziggy stardust") {
+ throw new Test262Error('#2: __music_box.ziggy() === "ziggy stardust". Actual: __music_box.ziggy() ==='+__music_box.ziggy());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A11_T1.js b/js/src/tests/test262/language/statements/function/S13_A11_T1.js
new file mode 100644
index 0000000000..89d46919d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A11_T1.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Since arguments property has attribute { DontDelete }, only its elements
+ can be deleted
+es5id: 13_A11_T1
+description: Returning result of "delete arguments"
+flags: [noStrict]
+---*/
+
+function __func(){ return delete arguments;}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func("A","B",1,2)) {
+ throw new Test262Error('#1: arguments property has attribute { DontDelete }');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A11_T2.js b/js/src/tests/test262/language/statements/function/S13_A11_T2.js
new file mode 100644
index 0000000000..37fd1c0241
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A11_T2.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Since arguments property has attribute { DontDelete }, only its elements
+ can be deleted
+es5id: 13_A11_T2
+description: >
+ Checking if deleting the arguments property fails and then
+ returning it
+flags: [noStrict]
+---*/
+
+function __func(){
+ delete arguments;
+ return arguments;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func("A","B",1,2) !== "object") {
+ throw new Test262Error('#1: arguments property has attribute { DontDelete }');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A11_T3.js b/js/src/tests/test262/language/statements/function/S13_A11_T3.js
new file mode 100644
index 0000000000..6612f1e31f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A11_T3.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Since arguments property has attribute { DontDelete }, only its elements
+ can be deleted
+es5id: 13_A11_T3
+description: Deleting arguments[i] and returning result of the operation
+---*/
+
+function __func(){
+ var was_del=false;
+ for (var i=0; i < arguments.length; i++)
+ was_del= was_del || delete arguments[i];
+ return was_del;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!__func("A","B",1,2)) {
+ throw new Test262Error('#1: Since arguments property has attribute { DontDelete } elements of arguments can be deleted');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A11_T4.js b/js/src/tests/test262/language/statements/function/S13_A11_T4.js
new file mode 100644
index 0000000000..3533b634f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A11_T4.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Since arguments property has attribute { DontDelete }, only its elements
+ can be deleted
+es5id: 13_A11_T4
+description: Deleting arguments[i] and checking the type of arguments[i]
+---*/
+
+function __func(){
+ var is_undef=true;
+ for (var i=0; i < arguments.length; i++)
+ {
+ delete arguments[i];
+ is_undef= is_undef && (typeof arguments[i] === "undefined");
+ };
+ return is_undef;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!__func("A","B",1,2)) {
+ throw new Test262Error('#1: Since arguments property has attribute { DontDelete }, but elements of arguments can be deleted');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A12_T1.js b/js/src/tests/test262/language/statements/function/S13_A12_T1.js
new file mode 100644
index 0000000000..05ae3e7504
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A12_T1.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function declarations in global or function scope are {DontDelete}
+es5id: 13_A12_T1
+description: >
+ Checking if deleting a function that is declared in global scope
+ fails
+flags: [noStrict]
+---*/
+
+ALIVE="Letov is alive"
+
+function __func(){
+ return ALIVE;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (delete __func) {
+ throw new Test262Error('#1: delete __func returning false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func() !== ALIVE) {
+ throw new Test262Error('#2: __func() === ALIVE. Actual: __func() ==='+__func());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A12_T2.js b/js/src/tests/test262/language/statements/function/S13_A12_T2.js
new file mode 100644
index 0000000000..4bda588cab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A12_T2.js
@@ -0,0 +1,40 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function declarations in global or function scope are {DontDelete}
+es5id: 13_A12_T2
+description: >
+ Checking if deleting a function that is declared in function scope
+ fails
+flags: [noStrict]
+---*/
+
+ALIVE="Letov is alive"
+
+function __cont(){
+
+ function __func(){
+ return ALIVE;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+ //CHECK#1
+ if (delete __func) {
+ throw new Test262Error('#1: delete __func returning false');
+ }
+ //
+ //////////////////////////////////////////////////////////////////////////////
+
+ //////////////////////////////////////////////////////////////////////////////
+ //CHECK#2
+ if (__func() !== ALIVE) {
+ throw new Test262Error('#2: __func() === ALIVE. Actual: __func() ==='+__func());
+ }
+ //
+ //////////////////////////////////////////////////////////////////////////////
+};
+
+__cont();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A13_T1.js b/js/src/tests/test262/language/statements/function/S13_A13_T1.js
new file mode 100644
index 0000000000..7065a7324a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A13_T1.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Deleting arguments[i] leads to breaking the connection to local reference
+es5id: 13_A13_T1
+description: Deleting arguments[i]
+---*/
+
+function __func(__arg){
+ delete arguments[0];
+ if (arguments[0] !== undefined) {
+ throw new Test262Error('#1.1: arguments[0] === undefined');
+ }
+ return __arg;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func(1) !== 1) {
+ throw new Test262Error('#1.2: __func(1) === 1. Actual: __func(1) ==='+__func(1));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A13_T2.js b/js/src/tests/test262/language/statements/function/S13_A13_T2.js
new file mode 100644
index 0000000000..08cc30cbf1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A13_T2.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Deleting arguments[i] leads to breaking the connection to local reference
+es5id: 13_A13_T2
+description: Changing arguments value and then deleting the argument
+---*/
+
+function __func(__arg){
+ __arg = 2;
+ delete arguments[0];
+ if (arguments[0] !== undefined) {
+ throw new Test262Error('#1.1: arguments[0] === undefined');
+ }
+ return __arg;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func(1) !== 2) {
+ throw new Test262Error('#1.2: __func(1) === 2. Actual: __func(1) ==='+__func(1));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A13_T3.js b/js/src/tests/test262/language/statements/function/S13_A13_T3.js
new file mode 100644
index 0000000000..47f0e2a515
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A13_T3.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Deleting arguments[i] leads to breaking the connection to local reference
+es5id: 13_A13_T3
+description: >
+ Changing argument value, deleting the argument and then defining a
+ new value for arguments[i]
+---*/
+
+function __func(__arg){
+ __arg = 2;
+ delete arguments[0];
+ if (arguments[0] !== undefined) {
+ throw new Test262Error('#1.1: arguments[0] === undefined');
+ }
+ arguments[0] = "A";
+ if (arguments[0] !== "A") {
+ throw new Test262Error('#1.2: arguments[0] === "A"');
+ }
+ return __arg;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func(1) !== 2) {
+ throw new Test262Error('#1.3: __func(1) === 2. Actual: __func(1) ==='+__func(1));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A14_T1.js b/js/src/tests/test262/language/statements/function/S13_A14_T1.js
new file mode 100644
index 0000000000..e64bbcc44a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A14_T1.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Unicode symbols in function name are allowed
+es5id: 13_A14
+description: Defining function name with unicode symbols
+flags: [noStrict]
+---*/
+
+eval("function __func\u0041(__arg){return __arg;};");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __funcA !== "function") {
+ throw new Test262Error('#1: unicode symbols in function name are allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A15_T1.js b/js/src/tests/test262/language/statements/function/S13_A15_T1.js
new file mode 100644
index 0000000000..c3ae2781c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A15_T1.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "''arguments'' variable overrides ActivationObject.arguments"
+es5id: 13_A15_T1
+description: Declaring a function with "__func(arguments)"
+flags: [noStrict]
+---*/
+
+function __func(arguments){
+ return arguments;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func(42) !== 42) {
+ throw new Test262Error('#1: "arguments" variable overrides ActivationObject.arguments');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A15_T2.js b/js/src/tests/test262/language/statements/function/S13_A15_T2.js
new file mode 100644
index 0000000000..8d17396bc3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A15_T2.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "''arguments'' variable overrides ActivationObject.arguments"
+es5id: 13_A15_T2
+description: Overriding arguments within functions body
+flags: [noStrict]
+---*/
+
+THE_ANSWER="Answer to Life, the Universe, and Everything";
+
+function __func(){
+ var arguments = THE_ANSWER;
+ return arguments;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func(42,42,42) !== THE_ANSWER) {
+ throw new Test262Error('#1: "arguments" variable overrides ActivationObject.arguments');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A15_T3.js b/js/src/tests/test262/language/statements/function/S13_A15_T3.js
new file mode 100644
index 0000000000..902302ae2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A15_T3.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "''arguments'' variable overrides ActivationObject.arguments"
+es5id: 13_A15_T3
+description: Declaring a variable named with "arguments" without a function
+flags: [noStrict]
+---*/
+
+THE_ANSWER="Answer to Life, the Universe, and Everything";
+
+var arguments = THE_ANSWER;
+
+function __func(arguments){
+ return arguments;
+
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func() !== "undefined") {
+ throw new Test262Error('#1: typeof __func() === "undefined". Actual: typeof __func() ==='+typeof __func());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func("The Ultimate Question") !== "The Ultimate Question") {
+ throw new Test262Error('#2: __func("The Ultimate Question") === "The Ultimate Question". Actual: __func("The Ultimate Question")==='+__func("The Ultimate Question"));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A15_T4.js b/js/src/tests/test262/language/statements/function/S13_A15_T4.js
new file mode 100644
index 0000000000..c58bddc29d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A15_T4.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "''arguments'' variable overrides ActivationObject.arguments"
+es5id: 13_A15_T4
+description: >
+ Declaring a variable named with "arguments" and following a
+ "return" statement within a function body
+flags: [noStrict]
+---*/
+
+THE_ANSWER="Answer to Life, the Universe, and Everything";
+
+function __func(){
+ return typeof arguments;
+ var arguments = THE_ANSWER;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func(42,42,42) !== "object") {
+ throw new Test262Error('#1: __func(42,42,42) === "object". Actual: __func(42,42,42)==='+__func(42,42,42));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A15_T5.js b/js/src/tests/test262/language/statements/function/S13_A15_T5.js
new file mode 100644
index 0000000000..ad2e15b54e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A15_T5.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "''arguments'' variable overrides ActivationObject.arguments"
+es5id: 13_A15_T5
+description: Creating a variable named with "arguments" without a function
+flags: [noStrict]
+---*/
+
+THE_ANSWER="Answer to Life, the Universe, and Everything";
+
+var arguments = THE_ANSWER;
+
+function __func(){
+ return arguments;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ( __func() === THE_ANSWER) {
+ throw new Test262Error('#1: __func() !== THE_ANSWER');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func("The Ultimate Question") === "The Ultimate Question") {
+ throw new Test262Error('#2: __func("The Ultimate Question") !== "The Ultimate Question"');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A17_T1.js b/js/src/tests/test262/language/statements/function/S13_A17_T1.js
new file mode 100644
index 0000000000..2729bcfcdf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A17_T1.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Function call cannot appear in the program before the FunctionExpression
+ appears
+es5id: 13_A17_T1
+description: Trying to call a function before the FunctionExpression appears
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ var __result = __func();
+ throw new Test262Error("#1.1: var __result = __func() lead to throwing exception");
+} catch(e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1.2: func should throw a TypeError Actual: ' + (e));
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __func = function (){return "ONE";};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+var __result = __func();
+if (__result !== "ONE") {
+ throw new Test262Error('#2: __result === "ONE". Actual: __result ==='+__result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__func = function (){return "TWO";};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+var __result = __func();
+if (__result !== "TWO") {
+ throw new Test262Error('#3: __result === "TWO". Actual: __result ==='+__result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A17_T2.js b/js/src/tests/test262/language/statements/function/S13_A17_T2.js
new file mode 100644
index 0000000000..8706dd0d3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A17_T2.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Function call cannot appear in the program before the FunctionExpression
+ appears
+es5id: 13_A17_T2
+description: >
+ Trying to call a function before the FunctionExpression appears
+ and then using the FunctionExpression one more time
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ var __result = __func();
+ throw new Test262Error("#1: var __result = __func() lead to throwing exception");
+} catch(e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1.2: func should throw a TypeError Actual: ' + (e));
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+// now we reach the __func overwriting by new expression
+var __func = function __func(){return "ONE";};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+var __result = __func();
+if (__result !== "ONE") {
+ throw new Test262Error('#2: __result === "ONE". Actual: __result ==='+__result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+__func = function __func(){return "TWO";};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+var __result = __func();
+if (__result !== "TWO") {
+ throw new Test262Error('#3: __result === "TWO". Actual: __result ==='+__result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A18.js b/js/src/tests/test262/language/statements/function/S13_A18.js
new file mode 100644
index 0000000000..1ed224697b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A18.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Closures are admitted
+es5id: 13_A18
+description: Using a function declaration as a function parameter
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof sinx !== 'undefined') {
+ throw new Test262Error('#1: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __val = function derivative(f, dx) {
+ return function(x) {
+ return (f(x + dx) - f(x)) / dx;
+ };
+}(function sinx(x){return Math.sin(x);},.0001)(0.5);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof sinx !== 'undefined') {
+ throw new Test262Error('#2: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A19_T1.js b/js/src/tests/test262/language/statements/function/S13_A19_T1.js
new file mode 100644
index 0000000000..e165b0c9f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A19_T1.js
@@ -0,0 +1,34 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"var\" does not override function declaration"
+es5id: 13_A19_T1
+description: >
+ Creating a function and a variable with identical Identifiers in
+ global scope
+---*/
+
+// since "var" does not override function declaration __decl is set to function
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __decl !== "function") {
+ throw new Test262Error('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __decl = 1;
+
+//since statement was evaluted __decl turns to 1 from function
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__decl !== 1) {
+ throw new Test262Error('#2: __decl === 1. Actual: __decl ==='+__decl);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __decl(){return 1;}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A19_T2.js b/js/src/tests/test262/language/statements/function/S13_A19_T2.js
new file mode 100644
index 0000000000..a96e8a3e7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A19_T2.js
@@ -0,0 +1,37 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"var\" does not override function declaration"
+es5id: 13_A19_T2
+description: >
+ Creating a function and a variable with identical Identifiers
+ within function scope
+---*/
+
+(function (){
+
+ // since "var" does not override function declaration __decl is set to function
+ //////////////////////////////////////////////////////////////////////////////
+ //CHECK#1
+ if (typeof __decl !== "function") {
+ throw new Test262Error('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl);
+ }
+ //
+ //////////////////////////////////////////////////////////////////////////////
+
+ var __decl = 1;
+
+ //since statement was evaluted __decl turns to 1 from function
+ //////////////////////////////////////////////////////////////////////////////
+ //CHECK#2
+ if (__decl !== 1) {
+ throw new Test262Error('#2: __decl === 1. Actual: __decl ==='+__decl);
+ }
+ //
+ //////////////////////////////////////////////////////////////////////////////
+
+ function __decl(){return 1;}
+})();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A2_T1.js b/js/src/tests/test262/language/statements/function/S13_A2_T1.js
new file mode 100644
index 0000000000..aa9dae5851
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A2_T1.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: function must be evaluated inside the expression
+es5id: 13_A2_T1
+description: Defining function body with "return arg"
+---*/
+
+var x = (function __func(arg){return arg})(1);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x !== 1) {
+ throw new Test262Error('#1: x === 1. Actual: x ==='+x);
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __func !== 'undefined') {
+ throw new Test262Error('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A2_T2.js b/js/src/tests/test262/language/statements/function/S13_A2_T2.js
new file mode 100644
index 0000000000..35ca568fcb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A2_T2.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: function must be evaluated inside the expression
+es5id: 13_A2_T2
+description: Defining function body with "return arg + arguments[1]"
+---*/
+
+var x = (function __func(arg){return arg + arguments[1]})(1,"1");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x !== "11") {
+ throw new Test262Error('#1: x === "11". Actual: x ==='+x);
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __func !== 'undefined') {
+ throw new Test262Error('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A2_T3.js b/js/src/tests/test262/language/statements/function/S13_A2_T3.js
new file mode 100644
index 0000000000..bdb6b69659
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A2_T3.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: function must be evaluated inside the expression
+es5id: 13_A2_T3
+description: >
+ Defining function body with "return arguments[0] +"-"+
+ arguments[1]"
+---*/
+
+var x = (function __func(){return arguments[0] +"-"+ arguments[1]})("Obi","Wan");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (x !== "Obi-Wan") {
+ throw new Test262Error('#1: x === "Obi-Wan". Actual: x ==='+x);
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __func !== 'undefined') {
+ throw new Test262Error('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A3_T1.js b/js/src/tests/test262/language/statements/function/S13_A3_T1.js
new file mode 100644
index 0000000000..a742380333
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A3_T1.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The Identifier in a FunctionExpression can be referenced from inside the
+ FunctionExpression's FunctionBody to allow the function calling itself
+ recursively
+es5id: 13_A3_T1
+description: >
+ Creating a recursive function that calculates factorial, as a
+ variable. Function call itself by its name
+---*/
+
+var __func = function __exp__func(arg){
+ if (arg === 1) {
+ return arg;
+ } else {
+ return __exp__func(arg-1)*arg;
+ }
+};
+
+var fact_of_3 = __func(3);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (fact_of_3 !== 6) {
+ throw new Test262Error("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A3_T2.js b/js/src/tests/test262/language/statements/function/S13_A3_T2.js
new file mode 100644
index 0000000000..00915e1e5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A3_T2.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The Identifier in a FunctionExpression can be referenced from inside the
+ FunctionExpression's FunctionBody to allow the function calling itself
+ recursively
+es5id: 13_A3_T2
+description: >
+ Creating a recursive function that calculates factorial, as a
+ variable. Function calls itself by the name of the variable
+---*/
+
+var __func = function (arg){
+ if (arg === 1) {
+ return arg;
+ } else {
+ return __func(arg-1)*arg;
+ }
+};
+
+var fact_of_3 = __func(3);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (fact_of_3 !== 6) {
+ throw new Test262Error("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A3_T3.js b/js/src/tests/test262/language/statements/function/S13_A3_T3.js
new file mode 100644
index 0000000000..085841d86b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A3_T3.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The Identifier in a FunctionExpression can be referenced from inside the
+ FunctionExpression's FunctionBody to allow the function calling itself
+ recursively
+es5id: 13_A3_T3
+description: Creating simple recursive function that calculates factorial
+---*/
+
+function __func(arg){
+ if (arg === 1) {
+ return arg;
+ } else {
+ return __func(arg-1)*arg;
+ }
+};
+
+var fact_of_3 = __func(3);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (fact_of_3 !== 6) {
+ throw new Test262Error("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A4_T1.js b/js/src/tests/test262/language/statements/function/S13_A4_T1.js
new file mode 100644
index 0000000000..de4b130945
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A4_T1.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production FunctionDeclaration: "function Identifier (
+ FormalParameterList_opt ) { FunctionBody }" is processed by function
+ declarations
+es5id: 13_A4_T1
+description: Declaring a function that returns string
+---*/
+
+function __func(){return "zig-zig-sputnik";};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func !== "function") {
+ throw new Test262Error('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func() !== "zig-zig-sputnik") {
+ throw new Test262Error('#2: __func() === "zig-zig-sputnik". Actual: __func() ==='+__func());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A4_T2.js b/js/src/tests/test262/language/statements/function/S13_A4_T2.js
new file mode 100644
index 0000000000..02428a6422
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A4_T2.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production FunctionDeclaration: "function Identifier (
+ FormalParameterList_opt ) { FunctionBody }" is processed by function
+ declarations
+es5id: 13_A4_T2
+description: >
+ Declaring a function that uses prefix increment operator within
+ its "return" Expression
+---*/
+
+function __func(arg){return ++arg;};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func !== "function") {
+ throw new Test262Error('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func(1) !== 2) {
+ throw new Test262Error('#2: __func(1) === 2. Actual: __func(1) ==='+__func(1));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A4_T3.js b/js/src/tests/test262/language/statements/function/S13_A4_T3.js
new file mode 100644
index 0000000000..9b559c8170
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A4_T3.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production FunctionDeclaration: "function Identifier (
+ FormalParameterList_opt ) { FunctionBody }" is processed by function
+ declarations
+es5id: 13_A4_T3
+description: >
+ Declaring a function that uses arithmetical operators within its
+ "return" Expression
+---*/
+
+function __func(arg1, arg2, arg3){return arg1+=(arg2+=arg3);};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func !== "function") {
+ throw new Test262Error('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func(10, 20, 30) !== 60) {
+ throw new Test262Error('#2: __func(10, 20, 30) === 60. Actual: __func(10,20,30) ==='+__func(10,20,30));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A4_T4.js b/js/src/tests/test262/language/statements/function/S13_A4_T4.js
new file mode 100644
index 0000000000..8097d7ba57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A4_T4.js
@@ -0,0 +1,51 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production FunctionDeclaration: "function Identifier (
+ FormalParameterList_opt ) { FunctionBody }" is processed by function
+ declarations
+es5id: 13_A4_T4
+description: >
+ Declaring a function that uses strings concatenaion opeator within
+ its "return" Expression
+---*/
+
+function __func(){return arguments[0].name + " " + arguments[0].surname;};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func !== "function") {
+ throw new Test262Error('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func({name:'fox', surname:'malder'}) !== "fox malder") {
+ throw new Test262Error('#2: __func({name:\'fox\', surname:\'malder\'}) === "fox malder". Actual: __func({name:\'fox\', surname:\'malder\'}) ==='+__func({name:'fox', surname:'malder'}));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function func__(arg){return arg.name + " " + arg.surname;};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (typeof func__ !== "function") {
+ throw new Test262Error('#3: typeof func__ === "function". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (func__({name:'john', surname:'lennon'}) !== "john lennon") {
+ throw new Test262Error('#4: func__({name:\'john\', surname:\'lennon\'}) === "john lennon". Actual: __func({name:\'john\', surname:\'lennon\'}) ==='+__func({name:'john', surname:'lennon'}));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A6_T1.js b/js/src/tests/test262/language/statements/function/S13_A6_T1.js
new file mode 100644
index 0000000000..72ebedfeb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A6_T1.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ FunctionDeclaration can be overrided by other FunctionDeclaration with
+ the same Identifier
+es5id: 13_A6_T1
+description: Duplicating function declaration
+---*/
+
+function __func(){return 1};
+
+var __store__func = __func;
+
+var __1 = __func();
+
+ function __func(){return 'A'};
+
+var __A = __func();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__store__func !== __func) {
+ throw new Test262Error('#1: __store__func === __func. Actual: __store__func ==='+__store__func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__1 !== __A) {
+ throw new Test262Error('#2: __1 === __A. Actual: __1 ==='+__1);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A6_T2.js b/js/src/tests/test262/language/statements/function/S13_A6_T2.js
new file mode 100644
index 0000000000..358becf1f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A6_T2.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ FunctionDeclaration can be overrided by other FunctionDeclaration with
+ the same Identifier
+es5id: 13_A6_T2
+description: Calling a function before it is declared one more time
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ var __result = __func();
+} catch(e) {
+ throw new Test262Error("#1: Function call can appears in the program before the FunctionDeclaration appears");
+}
+if (__result !== "SECOND") {
+ throw new Test262Error('#1.1: __result === "SECOND". Actual: __result ==='+__result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func(){return "FIRST";};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+__result = __func();
+if (__result !== "SECOND") {
+ throw new Test262Error('#2: __result === "SECOND". Actual: __result ==='+__result);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func(){return "SECOND";};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A7_T1.js b/js/src/tests/test262/language/statements/function/S13_A7_T1.js
new file mode 100644
index 0000000000..556fbd5c5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A7_T1.js
@@ -0,0 +1,73 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The FunctionBody must be SourceElements
+es5id: 13_A7_T1
+description: Using only SourceElements within the FunctionBody
+---*/
+
+function __func(){'ground control to major tom'};
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func !== "function") {
+ throw new Test262Error('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func__2(){b};
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __func__2 !== "function") {
+ throw new Test262Error('#2: typeof __func__2 === "function". Actual: typeof __func__2 ==='+typeof __func__2);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func__3(){1};
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (typeof __func__3 !== "function") {
+ throw new Test262Error('#3: typeof __func__3 === "function". Actual: typeof __func__3 ==='+typeof __func__3);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func__4(){1+c};
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (typeof __func__4 !== "function") {
+ throw new Test262Error('#4: typeof __func__4 === "function". Actual: typeof __func__4 ==='+typeof __func__4);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func__5(){inc(d)};
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if (typeof __func__5 !== "function") {
+ throw new Test262Error('#5: typeof __func__5 === "function". Actual: typeof __func__5 ==='+typeof __func__5);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func__6(){var \u0042 = 1;};
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#6
+if (typeof __func__6 !== "function") {
+ throw new Test262Error('#6: typeof __func__6 === "function". Actual: typeof __func__6 ==='+typeof __func__6);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//function __func__7(){var \u003d = 1;};
+////////////////////////////////////////////////////////////////////////////////
+////CHECK#7
+//if (typeof __func__7 !== "function") {
+// throw new Test262Error('#7: The FunctionBody must be SourceElements');
+//}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A7_T3.js b/js/src/tests/test262/language/statements/function/S13_A7_T3.js
new file mode 100644
index 0000000000..ec722be785
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A7_T3.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The FunctionBody must be SourceElements
+es5id: 13_A7_T3
+description: Checking if execution of "function __func(){\A\B\C}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function __func(){\A\B\C};
diff --git a/js/src/tests/test262/language/statements/function/S13_A8_T1.js b/js/src/tests/test262/language/statements/function/S13_A8_T1.js
new file mode 100644
index 0000000000..609f00704e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A8_T1.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Arguments property of activation object contains real params to be passed
+es5id: 13_A8_T1
+description: >
+ Creating a function declared with "function __func(param1, param2,
+ param3)" and using arguments.length property in order to perform
+ the test
+---*/
+
+function __func(param1, param2, param3) {
+ return arguments.length;
+ }
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func('A') !== 1) {
+ throw new Test262Error('#1: __func(\'A\') === 1. Actual: __func(\'A\') ==='+__func('A'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func('A', 'B', 1, 2,__func) !== 5) {
+ throw new Test262Error('#2: __func(\'A\', \'B\', 1, 2,__func) === 5. Actual: __func(\'A\', \'B\', 1, 2,__func) ==='+__func('A', 'B', 1, 2,__func));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A8_T2.js b/js/src/tests/test262/language/statements/function/S13_A8_T2.js
new file mode 100644
index 0000000000..be709296c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A8_T2.js
@@ -0,0 +1,40 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Arguments property of activation object contains real params to be passed
+es5id: 13_A8_T2
+description: >
+ Creating a function with no parameters and using arguments.length
+ property in order to perform the test
+---*/
+
+function __func() {
+ return arguments.length;
+ }
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func('A') !== 1) {
+ throw new Test262Error('#1: __func(\'A\') === 1. Actual: __func(\'A\') ==='+__func('A'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func('A', 'B', 1, 2,__func) !== 5) {
+ throw new Test262Error('#2: __func(\'A\', \'B\', 1, 2,__func) === 5. Actual: __func(\'A\', \'B\', 1, 2,__func) ==='+__func('A', 'B', 1, 2,__func));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__func() !== 0) {
+ throw new Test262Error('#3: __func() === 0. Actual: __func() ==='+__func());
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S13_A9.js b/js/src/tests/test262/language/statements/function/S13_A9.js
new file mode 100644
index 0000000000..d36d86d099
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S13_A9.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function can be passed as argument
+es5id: 13_A9
+description: Using function as argument of another function
+---*/
+
+function __func__INC(arg){return arg + 1;};
+function __func__MULT(incrementator, arg, mult){ return incrementator(arg)*mult; };
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func__MULT(__func__INC, 2, 2) !== 6) {
+ throw new Test262Error('#1: function can be passed as argument');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S14_A2.js b/js/src/tests/test262/language/statements/function/S14_A2.js
new file mode 100644
index 0000000000..d66482a36a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S14_A2.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionDeclaration cannot be localed inside an Expression
+es5id: 14_A2
+description: Declaring a function within an "if" Expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof f !== 'undefined') {
+ throw new Test262Error('#1: typeof f === \'undefined\'. Actual: typeof f ==='+ typeof f );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (function f(arg){
+ if (arg===0)
+ return 1;
+ else
+ return f(arg-1)*arg;
+}(3)!==6) {
+ throw new Test262Error('#2: FunctionDeclaration cannot be localed inside an Expression');
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S14_A3.js b/js/src/tests/test262/language/statements/function/S14_A3.js
new file mode 100644
index 0000000000..09ebe3e2a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S14_A3.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Global FunctionDeclaration cannot be defined within the body of another
+ FunctionDeclaration
+es5id: 14_A3
+description: Declaring a function within the body of another function
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __func !== "function") {
+ throw new Test262Error('#1: typeof __func === "function". Actual: typeof __func ==='+ typeof __func );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __gunc !== "undefined") {
+ throw new Test262Error('#2: typeof __gunc === "undefined". Actual: typeof __gunc ==='+ typeof __gunc );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func(){
+ function __gunc(){return true};
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S14_A5_T1.js b/js/src/tests/test262/language/statements/function/S14_A5_T1.js
new file mode 100644
index 0000000000..ced62566b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S14_A5_T1.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The Identifier within a FunctionDeclaration can be written in both letters
+ and unicode
+es5id: 14_A5_T1
+description: >
+ Declaring a function with "function
+ __\u0066\u0075\u006e\u0063(){return "both"}"
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func() !== "both") {
+ throw new Test262Error('#1: __func() === "both". Actual: __func() ==='+ __func() );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func(){return "ascii"};
+function \u005f\u005f\u0066\u0075\u006e\u0063(){return "unicode"};//__func in unicode
+function __\u0066\u0075\u006e\u0063(){return "both"};//__func in unicode
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/S14_A5_T2.js b/js/src/tests/test262/language/statements/function/S14_A5_T2.js
new file mode 100644
index 0000000000..45a22d4de9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/S14_A5_T2.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The Identifier within a FunctionDeclaration can be written in both letters
+ and unicode
+es5id: 14_A5_T2
+description: >
+ Declaring a function with "function
+ \u005f\u005f\u0066\u0075\u006e\u0063(){return "unicode"}"
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__func() !== "unicode") {
+ throw new Test262Error('#1: __func() === "unicode". Actual: __func() ==='+ __func() );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+function __func(){return "ascii"};
+function \u005f\u005f\u0066\u0075\u006e\u0063(){return "unicode"};//__func in unicode
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/arguments-with-arguments-fn.js b/js/src/tests/test262/language/statements/function/arguments-with-arguments-fn.js
new file mode 100644
index 0000000000..b868647bd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/arguments-with-arguments-fn.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+es6id: 9.2.12
+description: >
+ Arguments object is created even when the body contains a lexically-scoped
+ binding named "arguments"
+info: |
+ [...]
+ 19. Else if "arguments" is an element of parameterNames, then
+ a. Let argumentsObjectNeeded be false.
+ 20. Else if hasParameterExpressions is false, then
+ a. If "arguments" is an element of functionNames or if "arguments" is an
+ element of lexicalNames, then
+ i. Let argumentsObjectNeeded be false.
+ [...]
+flags: [noStrict]
+---*/
+
+var args;
+
+function f(x = args = arguments) {
+ function arguments() {}
+}
+
+f();
+
+assert.sameValue(typeof args, 'object');
+assert.sameValue(args.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/arguments-with-arguments-lex.js b/js/src/tests/test262/language/statements/function/arguments-with-arguments-lex.js
new file mode 100644
index 0000000000..5c983389d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/arguments-with-arguments-lex.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+es6id: 9.2.12
+description: >
+ Arguments object is created even when the body contains a function named
+ "arguments"
+info: |
+ [...]
+ 19. Else if "arguments" is an element of parameterNames, then
+ a. Let argumentsObjectNeeded be false.
+ 20. Else if hasParameterExpressions is false, then
+ a. If "arguments" is an element of functionNames or if "arguments" is an
+ element of lexicalNames, then
+ i. Let argumentsObjectNeeded be false.
+ [...]
+flags: [noStrict]
+---*/
+
+var args;
+
+function f(x = args = arguments) {
+ let arguments;
+}
+
+f();
+
+assert.sameValue(typeof args, 'object');
+assert.sameValue(args.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/function/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..e6b614bcf5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/array-destructuring-param-strict-body.js
@@ -0,0 +1,134 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/func-decl.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+function f([element]) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/function/browser.js b/js/src/tests/test262/language/statements/function/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/browser.js
diff --git a/js/src/tests/test262/language/statements/function/cptn-decl.js b/js/src/tests/test262/language/statements/function/cptn-decl.js
new file mode 100644
index 0000000000..7e0c9a90cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/cptn-decl.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2017 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-function-definitions-runtime-semantics-evaluation
+description: Function declaration completion value is empty.
+info: |
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.sameValue(eval('function f() {}'), undefined);
+assert.sameValue(eval('1; function f() {}'), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/function/dflt-params-abrupt.js
new file mode 100644
index 0000000000..577d4141d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dflt-params-abrupt.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/func-decl.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+var callCount = 0;
+function f(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+}
+assert.throws(Test262Error, function() {
+ f();
+});
+assert.sameValue(callCount, 0, 'function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/function/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..367fdd31ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/func-decl.template
+/*---
+description: Use of initializer when argument value is not `undefined` (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function ref(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+}
+
+ref(false, '', NaN, 0, null, obj);
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/function/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..3aacdd8a81
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dflt-params-arg-val-undefined.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/func-decl.template
+/*---
+description: Use of initializer when argument value is `undefined` (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function ref(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+}
+
+ref(undefined, void 0);
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/function/dflt-params-duplicates.js
new file mode 100644
index 0000000000..2863fb152e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dflt-params-duplicates.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/func-decl.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+function f(x = 0, x) {
+
+}
diff --git a/js/src/tests/test262/language/statements/function/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/function/dflt-params-ref-later.js
new file mode 100644
index 0000000000..6bc1f74cce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dflt-params-ref-later.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/func-decl.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+function f(x = y, y) {
+
+ callCount = callCount + 1;
+}
+assert.throws(ReferenceError, function() {
+ f();
+});
+assert.sameValue(callCount, 0, 'function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/function/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..888cc81114
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dflt-params-ref-prior.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/func-decl.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function ref(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+}
+
+ref(3);
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/function/dflt-params-ref-self.js
new file mode 100644
index 0000000000..552f0c2efb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dflt-params-ref-self.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/func-decl.template
+/*---
+description: Referencing a parameter from within its own initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+function f(x = x) {
+
+ callCount = callCount + 1;
+}
+assert.throws(ReferenceError, function() {
+ f();
+});
+assert.sameValue(callCount, 0, 'function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dflt-params-rest.js b/js/src/tests/test262/language/statements/function/dflt-params-rest.js
new file mode 100644
index 0000000000..4cfb8fa37a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dflt-params-rest.js
@@ -0,0 +1,67 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/func-decl.template
+/*---
+description: RestParameter does not support an initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+function f(...x = []) {
+
+}
diff --git a/js/src/tests/test262/language/statements/function/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/function/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..e0c766be90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dflt-params-trailing-comma.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function ref(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+}
+
+ref(42, undefined, 1);
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-close.js
new file mode 100644
index 0000000000..16252b5168
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-close.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+};
+f(iter);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..11e56935b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Abrupt completion returned by GetIterator (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+function f([x, y, z]) {}
+
+assert.throws(TypeError, function() {
+ f([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-get-err.js
new file mode 100644
index 0000000000..2b854024f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-get-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Abrupt completion returned by GetIterator (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+function f([x]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-no-close.js
new file mode 100644
index 0000000000..b747b8e2e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-init-iter-no-close.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+};
+f(iter);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/statements/function/dstr/ary-name-iter-val.js
new file mode 100644
index 0000000000..bc5c3ba848
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-name-iter-val.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: SingleNameBinding with normal value iteration (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..ef33c24e34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..3b0405e941
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 f([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+};
+f([[7, 8, 9]]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..18da2bd987
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..0dfcd5333e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+};
+f([[]]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..df20a2052e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/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/func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..9adfd86715
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f([[23]]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..bd28052df5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[...x] = 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);
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..e04582bb72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+};
+f([values]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..d553ad96ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Nested array destructuring with a null value (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+function f([[x]]) {}
+
+assert.throws(TypeError, function() {
+ f([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..008f37c4bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Destructuring initializer with an exhausted iterator (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..67b63f246a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,64 @@
+// 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/func-decl.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..ddecbe6b96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,66 @@
+// 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/func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..450bcdbc3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,65 @@
+// 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/func-decl.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..ede01e6f42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,65 @@
+// 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/func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..07c213741a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/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/func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..fdc6489113
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Destructuring initializer with a "hole" (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+};
+f([,]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..580f912c6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f([null, 0, false, '']);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..5d1515520e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Destructuring initializer returns an abrupt completion (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+function f([x = (function() { throw new Test262Error(); })()]) {}
+
+assert.throws(Test262Error, function() {
+ f([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..fad5ab108f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Destructuring initializer with an undefined value (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f([undefined]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..c545fd680d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function f([ x = unresolvableReference ]) {}
+
+assert.throws(ReferenceError, function() {
+ f([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..db500d9a23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: SingleNameBinding when value iteration completes (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..80160c24bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..a61a89af9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+function f([x]) {}
+
+assert.throws(Test262Error, function() {
+ f(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..ed9132b868
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+function f([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..b226203dbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+function f([x]) {}
+
+assert.throws(Test262Error, function() {
+ f(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..235d76f129
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..ee6d5e6e9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..5b6b7c5d46
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-id.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+};
+f([{ x: 11, y: 22, z: 33 }]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..05b0b7b119
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..98bb7c4229
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f([{ u: 777, w: 888, y: 999 }]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..78d41ccd06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Nested object destructuring with a null value (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+function f([{ x }]) {}
+
+assert.throws(TypeError, function() {
+ f([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..ebc74d9197
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Nested object destructuring with a value of `undefined` (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+function f([{ x }]) {}
+
+assert.throws(TypeError, function() {
+ f([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..70b014538d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision-exhausted.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Elision accepts exhausted iterator (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([,]) {
+
+ callCount = callCount + 1;
+};
+f(iter);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..8b3ce84951
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision-step-err.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+function f([,]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision.js
new file mode 100644
index 0000000000..27466cd07e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-elision.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Elision advances iterator (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f(g());
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-empty.js
new file mode 100644
index 0000000000..6bb86e3360
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-empty.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+function f([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+};
+f(iter);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..7fc9c3df53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element containing an array BindingElementList pattern (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+};
+f([3, 4, 5]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..06c692fa68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element containing an elision (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+};
+f(g());
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..6707ef04a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element containing an "empty" array pattern (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+};
+f(iter);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..206cdb6c90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element containing a rest element (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+};
+f(values);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..3a207e8774
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-direct.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Lone rest element (direct binding) (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+function f([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+};
+f([1]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..0f65e18e61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Rest element following elision elements (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+function f([, ...x]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..bc81108aae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-elision.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element following elision elements (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+};
+f(values);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..021b307443
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: RestElement applied to an exhausted iterator (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+};
+f([1, 2]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..930983759b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+function f([...x]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..c8533c0a22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+function f([...x]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..915317ebc7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-id.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Lone rest element (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...x]) {
+ 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);
+ callCount = callCount + 1;
+};
+f(values);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..6769219b28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-ary.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..57a4cae64b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-id.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element (identifier) does not support initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...x = []]) {
+
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..fc213f29da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-init-obj.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...{ x } = []]) {
+
+ callCount = callCount + 1;
+};
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..82809bed78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...[x], y]) {
+
+ callCount = callCount + 1;
+};
+f([1, 2, 3]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..299ccae4c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element (identifier) may not be followed by any element (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...x, y]) {
+
+ callCount = callCount + 1;
+};
+f([1, 2, 3]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..4f27fa7019
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...{ x }, y]) {
+
+ callCount = callCount + 1;
+};
+f([1, 2, 3]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..e5d140ebb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-obj-id.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest element containing an object binding pattern (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/function/dstr/ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..dea5b3d8d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/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/func-decl.template
+/*---
+description: Rest element containing an object binding pattern (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+function f([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+};
+f([7, 8, 9]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/browser.js b/js/src/tests/test262/language/statements/function/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..039b9798ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-close.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..1e0021e44c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+function f([x, y, z] = [1, 2, 3]) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..88ebad721d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-get-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+function f([x] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..24526e9912
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-init-iter-no-close.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..50fcc1e4be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-name-iter-val.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..b182579632
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..135ddd3924
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 f([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..1f6701b728
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..4d438b5513
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..d77e901c6a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-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/func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..b2e73e1ea1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..be32264182
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[...x] = 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);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..f050e0b167
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..537a4ced79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Nested array destructuring with a null value (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+function f([[x]] = [null]) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..a18c222d95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..fb7560ea7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,64 @@
+// 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/func-decl-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..35208ee9e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,66 @@
+// 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/func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..3e02e20c1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,65 @@
+// 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/func-decl-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..457a5316b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,65 @@
+// 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/func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..d11c7f8166
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-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/func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..721ae98e27
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..e2295a9544
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..9991a0a209
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+function f([x = (function() { throw new Test262Error(); })()] = [undefined]) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..be4ea2e15e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..36e4bd7351
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function f([ x = unresolvableReference ] = []) {}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..0caf1bd485
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..398c727a6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..33ad782552
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+function f([x] = g) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..9478c13693
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,82 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+function f([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..febb36ce8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+function f([x] = g) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..dda695d302
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..d617e8d319
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..10e3ed6ce0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..f26d8a00cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..84566fd64f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..90606b282d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Nested object destructuring with a null value (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+function f([{ x }] = [null]) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..e3e5a528ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+function f([{ x }] = []) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..d73336b34a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Elision accepts exhausted iterator (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([,] = iter) {
+
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..5afec0d420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision-step-err.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+function f([,] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..9c396ff442
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-elision.js
@@ -0,0 +1,78 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Elision advances iterator (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..6b2aa6810a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-empty.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+function f([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..24cdea25a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,85 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..6064ae16ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,91 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element containing an elision (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..439abacd1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..9b7f87af9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element containing a rest element (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...[...x]] = 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);
+
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..787abfb1ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Lone rest element (direct binding) (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+function f([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..79d37c6562
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Rest element following elision elements (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+function f([, ...x] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..5f202dfb07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element following elision elements (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([ , , ...x] = 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);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..745537ba41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..c7f07ca0c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+function f([...x] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..07ff4eebf2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+function f([...x] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..f55e8075cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Lone rest element (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...x] = 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);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..55568d3607
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..3b42cf7732
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...x = []] = []) {
+
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..68324d49a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..aa2c49a263
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..e5586adfdd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..987af5c16b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function f([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..1d9e9a564d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest element containing an object binding pattern (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..40b6632b4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-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/func-decl-dflt.template
+/*---
+description: Rest element containing an object binding pattern (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+function f([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-init-null.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-init-null.js
new file mode 100644
index 0000000000..3d1c31c1d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-init-null.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+function f({} = null) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-init-undefined.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..7721c9a624
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-init-undefined.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+function f({} = undefined) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..e33f6dbb9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-empty.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+function f({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..c8b824ba4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+function f({ poisoned } = poisonedProperty) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..f762208a95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..ce7c96c8e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..cbfe8f198a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..4447d04188
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..b63faed164
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-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/func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..c6e73db2f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..6da01e2fef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-throws.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function f({ x = thrower() } = {}) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..7ae174d219
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function f({ x = unresolvableReference } = {}) {}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..9df9b6455b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function f({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..f42fcca11f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-list-err.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+function f({ a, b = thrower(), c = ++initCount } = {}) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..628ff18100
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..edf33341c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function f({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..876bbe8ec0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function f({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..b3de9df33d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..a931cd9ae3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function f({ [thrower()]: x } = {}) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..53f7517c0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+function f({ poisoned: x = ++initEvalCount } = poisonedProperty) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..a506f0e9d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..319d22efb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function f({ x: y = thrower() } = {}) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..6cb94987cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function f({ x: y = unresolvableReference } = {}) {}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..deb3ad15eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+function f({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..b27c7bd0fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function f({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..713545b927
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Binding as specified via property name and identifier (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+function f({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..6b13689b61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..c744de7878
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..59a91bc79b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function f({ w: { x, y, z } = undefined } = { }) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..fcf5954fb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..fc3c63ae84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-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/func-decl-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+function f({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..654d65653f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+function f({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..e7f8f49ef4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/func-decl-dflt.template
+/*---
+description: Rest object contains just unextracted data (function declaration (default parameter))
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+function f({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-init-null.js b/js/src/tests/test262/language/statements/function/dstr/obj-init-null.js
new file mode 100644
index 0000000000..b817199ea0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-init-null.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+function f({}) {}
+
+assert.throws(TypeError, function() {
+ f(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-init-undefined.js b/js/src/tests/test262/language/statements/function/dstr/obj-init-undefined.js
new file mode 100644
index 0000000000..83d41c0e7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-init-undefined.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+function f({}) {}
+
+assert.throws(TypeError, function() {
+ f(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-empty.js
new file mode 100644
index 0000000000..aa44acee8f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-empty.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+function f({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+};
+f(obj);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..5090974f20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-get-value-err.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+function f({ poisoned }) {}
+
+assert.throws(Test262Error, function() {
+ f(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..d3018ea20a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f({});
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..fc3141f965
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f({});
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..0e008931e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f({});
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..4c676d43fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f({});
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..8d230f9944
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/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/func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f({});
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..442871f0a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-skipped.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f({ w: null, x: 0, y: false, z: '' });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..6fb2199826
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-throws.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Error thrown when evaluating the initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function f({ x = thrower() }) {}
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..f430b91bd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function f({ x = unresolvableReference }) {}
+
+assert.throws(ReferenceError, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..06e423f28a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function f({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f({ x: 23 });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-list-err.js
new file mode 100644
index 0000000000..1b8b9b738c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-list-err.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+function f({ a, b = thrower(), c = ++initCount }) {}
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..e1b46c0e04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({});
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..087edd0332
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function f({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+};
+f({ x: [45] });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..f2dfe9c805
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function f({ w: [x, y, z] = [4, 5, 6] }) {}
+
+assert.throws(TypeError, function() {
+ f({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..a9ae0983da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-ary.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({ w: [7, undefined, ] });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..f67a272d53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-eval-err.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Evaluation of property name returns an abrupt completion (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function f({ [thrower()]: x }) {}
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..10a30cdb80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+function f({ poisoned: x = ++initEvalCount }) {}
+
+assert.throws(Test262Error, function() {
+ f(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..08c0924fd2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f({ s: null, u: 0, w: false, y: '' });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..cdcc2c0f92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Error thrown when evaluating the initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function f({ x: y = thrower() }) {}
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..20030ee0b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function f({ x: y = unresolvableReference }) {}
+
+assert.throws(ReferenceError, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..bac8c645c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-init.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+function f({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f({ });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..7343bb53be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function f({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f({ x: 23 });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..9d22fca341
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-id.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Binding as specified via property name and identifier (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+function f({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f({ x: 23 });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..c6fd892b1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({ w: undefined });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..907d817a48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}
+
+assert.throws(TypeError, function() {
+ f({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..32fcb08bec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function f({ w: { x, y, z } = undefined }) {}
+
+assert.throws(TypeError, function() {
+ f({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..6a3dceffab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-prop-obj.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({ w: { x: undefined, z: 7 } });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..202ae80c82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/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/func-decl.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+function f({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f({ get v() { count++; return 2; } });
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..13cc15ec3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+function f({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+};
+f(o);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..3a84a74a5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/obj-ptrn-rest-val-obj.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/func-decl.template
+/*---
+description: Rest object contains just unextracted data (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+function f({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f({x: 1, y: 2, a: 5, b: 3});
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/dstr/shell.js b/js/src/tests/test262/language/statements/function/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/function/early-body-super-call.js b/js/src/tests/test262/language/statements/function/early-body-super-call.js
new file mode 100644
index 0000000000..cd84ccbe9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-body-super-call.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-function-definitions-static-semantics-early-errors
+es6id: 14.1.2
+description: Body may not contain a "super" call
+info: |
+ It is a Syntax Error if FunctionBody Contains SuperCall is true.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ super();
+}
diff --git a/js/src/tests/test262/language/statements/function/early-body-super-prop.js b/js/src/tests/test262/language/statements/function/early-body-super-prop.js
new file mode 100644
index 0000000000..4ad4324620
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-body-super-prop.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-function-definitions-static-semantics-early-errors
+es6id: 14.1.2
+description: Body may not contain a "super" property reference
+info: |
+ It is a Syntax Error if FunctionBody Contains SuperProperty is true.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ super.x;
+}
diff --git a/js/src/tests/test262/language/statements/function/early-errors/browser.js b/js/src/tests/test262/language/statements/function/early-errors/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-errors/browser.js
diff --git a/js/src/tests/test262/language/statements/function/early-errors/invalid-names-call-expression-bad-reference.js b/js/src/tests/test262/language/statements/function/early-errors/invalid-names-call-expression-bad-reference.js
new file mode 100644
index 0000000000..d7e43cbd3c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-errors/invalid-names-call-expression-bad-reference.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/function-decl.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, inside function declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+function fn() { (() => {})().#x }
diff --git a/js/src/tests/test262/language/statements/function/early-errors/invalid-names-call-expression-this.js b/js/src/tests/test262/language/statements/function/early-errors/invalid-names-call-expression-this.js
new file mode 100644
index 0000000000..eb7b2b5f8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-errors/invalid-names-call-expression-this.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/function-decl.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, inside function declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+function fn() { (() => this)().#x }
diff --git a/js/src/tests/test262/language/statements/function/early-errors/invalid-names-member-expression-bad-reference.js b/js/src/tests/test262/language/statements/function/early-errors/invalid-names-member-expression-bad-reference.js
new file mode 100644
index 0000000000..af2df59e63
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-errors/invalid-names-member-expression-bad-reference.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/function-decl.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, inside function declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+function fn() { something.#x }
diff --git a/js/src/tests/test262/language/statements/function/early-errors/invalid-names-member-expression-this.js b/js/src/tests/test262/language/statements/function/early-errors/invalid-names-member-expression-this.js
new file mode 100644
index 0000000000..029da1500e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-errors/invalid-names-member-expression-this.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/function-decl.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, inside function declaration)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+function fn() { this.#x }
diff --git a/js/src/tests/test262/language/statements/function/early-errors/shell.js b/js/src/tests/test262/language/statements/function/early-errors/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-errors/shell.js
diff --git a/js/src/tests/test262/language/statements/function/early-params-super-call.js b/js/src/tests/test262/language/statements/function/early-params-super-call.js
new file mode 100644
index 0000000000..2d107196eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-params-super-call.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-function-definitions-static-semantics-early-errors
+es6id: 14.1.2
+description: Parameters may not contain a "super" call
+info: |
+ It is a Syntax Error if FormalParameters Contains SuperProperty is true.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f(x = super()) {}
diff --git a/js/src/tests/test262/language/statements/function/early-params-super-prop.js b/js/src/tests/test262/language/statements/function/early-params-super-prop.js
new file mode 100644
index 0000000000..2be0153bdf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/early-params-super-prop.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-function-definitions-static-semantics-early-errors
+es6id: 14.1.2
+description: Parameters may not contain a "super" property reference
+info: |
+ It is a Syntax Error if FunctionBody Contains SuperProperty is true.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f(x = super.x) {}
diff --git a/js/src/tests/test262/language/statements/function/enable-strict-via-body.js b/js/src/tests/test262/language/statements/function/enable-strict-via-body.js
new file mode 100644
index 0000000000..7a979deaa8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/enable-strict-via-body.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-10-s
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ the code of this FunctionBody with an inner function contains a
+ Use Strict Directive
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_0_10_fun() {
+ function _13_0_10_inner() {
+ "use strict";
+ eval = 42;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/function/enable-strict-via-outer-body.js b/js/src/tests/test262/language/statements/function/enable-strict-via-outer-body.js
new file mode 100644
index 0000000000..1183ffc0d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/enable-strict-via-outer-body.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-11-s
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ the code of this FunctionBody with an inner function which is in
+ strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_0_11_fun() {
+ "use strict";
+ function _13_0_11_inner() {
+ eval = 42;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/function/enable-strict-via-outer-script-strict.js b/js/src/tests/test262/language/statements/function/enable-strict-via-outer-script-strict.js
new file mode 100644
index 0000000000..050860b245
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/enable-strict-via-outer-script-strict.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13;
+ The production FunctionBody : SourceElementsopt is evaluated as follows:
+es5id: 13.0-9-s
+description: >
+ Strict Mode - SourceElements is evaluated as strict mode code when
+ a FunctionDeclaration that is contained in strict mode code has an
+ inner function
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+var _13_0_9_fun = function () {
+ function _13_0_9_inner() {
+ eval = 42;
+ }
+};
diff --git a/js/src/tests/test262/language/statements/function/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/statements/function/eval-var-scope-syntax-err.js
new file mode 100644
index 0000000000..00e562e634
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/eval-var-scope-syntax-err.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/eval-var-scope-syntax-err.case
+// - src/function-forms/error-no-strict/func-decl.template
+/*---
+description: sloppy direct eval in params introduces var (function declaration in sloppy code)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters]
+flags: [generated, noStrict]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Runtime Semantics: IteratorBindingInitialization
+ FormalParameter : BindingElement
+
+ 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment.
+
+---*/
+
+var callCount = 0;
+function f(a = eval("var a = 42")) {
+
+ callCount = callCount + 1;
+}
+assert.throws(SyntaxError, function() {
+ f();
+});
+assert.sameValue(callCount, 0, 'function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/function/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/function/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..88c54bd38f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template
+/*---
+description: Forbidden extension, f.arguments (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+flags: [generated, noStrict]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+function f() {
+ "use strict";
+ assert.sameValue(f.hasOwnProperty("arguments"), false);
+ callCount++;
+}
+
+f();
+assert.sameValue(callCount, 1, 'function body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/function/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..6a5038a200
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template
+/*---
+description: Forbidden extension, o.caller (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+flags: [generated, noStrict]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+function f() {
+ "use strict";
+ assert.sameValue(f.hasOwnProperty("caller"), false);
+ callCount++;
+}
+
+f();
+assert.sameValue(callCount, 1, 'function body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/function/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..3a981a7dfe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/func-decl.template
+/*---
+description: Forbidden extension, o.caller (function declaration)
+esid: sec-definitions-runtime-semantics-instantiatefunctionobject
+flags: [generated, noStrict]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+function f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+
+ callCount++;
+}
+f();
+assert.sameValue(callCount, 1, 'body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..2e50f86d61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/func-decl.template
+/*---
+description: Forbidden extension, o.caller (function declaration)
+esid: sec-definitions-runtime-semantics-instantiatefunctionobject
+flags: [generated, noStrict]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+function f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+
+ callCount++;
+}
+f();
+assert.sameValue(callCount, 1, 'body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..c00df08a17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/func-decl-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/func-decl.template
+/*---
+description: Forbidden extension, o.caller (function declaration)
+esid: sec-definitions-runtime-semantics-instantiatefunctionobject
+flags: [generated, noStrict]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+function f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+
+ callCount++;
+}
+f();
+assert.sameValue(callCount, 1, 'body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/function/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/function/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/function/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/function/invalid-2-names.js b/js/src/tests/test262/language/statements/function/invalid-2-names.js
new file mode 100644
index 0000000000..06ee6ac865
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/invalid-2-names.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.0-1
+description: >
+ 13.0 - multiple names in one function declaration is not allowed,
+ two function names
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x, y() {}
diff --git a/js/src/tests/test262/language/statements/function/invalid-3-names.js b/js/src/tests/test262/language/statements/function/invalid-3-names.js
new file mode 100644
index 0000000000..24c29baa3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/invalid-3-names.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.0-2
+description: >
+ 13.0 - multiple names in one function declaration is not allowed,
+ three function names
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x,y,z(){}
diff --git a/js/src/tests/test262/language/statements/function/invalid-function-body-1.js b/js/src/tests/test262/language/statements/function/invalid-function-body-1.js
new file mode 100644
index 0000000000..ebc94ad540
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/invalid-function-body-1.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The FunctionBody must be SourceElements
+es5id: 13_A7_T2
+description: >
+ Inserting elements that is different from SourceElements into the
+ FunctionBody
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function __func(){/ ABC}
diff --git a/js/src/tests/test262/language/statements/function/invalid-function-body-2.js b/js/src/tests/test262/language/statements/function/invalid-function-body-2.js
new file mode 100644
index 0000000000..3078d4f403
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/invalid-function-body-2.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The FunctionBody must be SourceElements
+es5id: 13_A7_T2
+description: >
+ Inserting elements that is different from SourceElements into the
+ FunctionBody
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function __func(){&1}
diff --git a/js/src/tests/test262/language/statements/function/invalid-function-body-3.js b/js/src/tests/test262/language/statements/function/invalid-function-body-3.js
new file mode 100644
index 0000000000..785a5b33cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/invalid-function-body-3.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The FunctionBody must be SourceElements
+es5id: 13_A7_T2
+description: >
+ Inserting elements that is different from SourceElements into the
+ FunctionBody
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function __func(){# ABC}
diff --git a/js/src/tests/test262/language/statements/function/invalid-name-dot.js b/js/src/tests/test262/language/statements/function/invalid-name-dot.js
new file mode 100644
index 0000000000..9a12bd3a96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/invalid-name-dot.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.0-3
+description: >
+ 13.0 - property names in function definition is not allowed, add a
+ new property into object
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function obj.tt() {}
diff --git a/js/src/tests/test262/language/statements/function/invalid-name-two-dots.js b/js/src/tests/test262/language/statements/function/invalid-name-two-dots.js
new file mode 100644
index 0000000000..19dadd5fdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/invalid-name-two-dots.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.0-4
+description: >
+ 13.0 - multiple names in one function declaration is not allowed,
+ add a new property into a property which is a object
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function obj.tt.ss() {}
diff --git a/js/src/tests/test262/language/statements/function/length-dflt.js b/js/src/tests/test262/language/statements/function/length-dflt.js
new file mode 100644
index 0000000000..e778ff2b9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/length-dflt.js
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.1.6
+description: >
+ Default parameters' effect on function length
+info: |
+ Function length is counted by the non initialized parameters in the left.
+
+ 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope)
+
+ [...]
+ 2. Let len be the ExpectedArgumentCount of ParameterList.
+ 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]:
+ len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
+ [...]
+
+ FormalsList : FormalParameter
+
+ 1. If HasInitializer of FormalParameter is true return 0
+ 2. Return 1.
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let count be the ExpectedArgumentCount of FormalsList.
+ 2. If HasInitializer of FormalsList is true or HasInitializer of
+ FormalParameter is true, return count.
+ 3. Return count+1.
+features: [default-parameters]
+includes: [propertyHelper.js]
+---*/
+
+
+function f1(x = 42) {}
+
+assert.sameValue(f1.length, 0, 'FormalsList: x = 42');
+verifyNotEnumerable(f1, 'length');
+verifyNotWritable(f1, 'length');
+verifyConfigurable(f1, 'length');
+
+function f2(x = 42, y) {}
+
+assert.sameValue(f2.length, 0, 'FormalsList: x = 42, y');
+verifyNotEnumerable(f2, 'length');
+verifyNotWritable(f2, 'length');
+verifyConfigurable(f2, 'length');
+
+function f3(x, y = 42) {}
+
+assert.sameValue(f3.length, 1, 'FormalsList: x, y = 42');
+verifyNotEnumerable(f3, 'length');
+verifyNotWritable(f3, 'length');
+verifyConfigurable(f3, 'length');
+
+function f4(x, y = 42, z) {}
+
+assert.sameValue(f4.length, 1, 'FormalsList: x, y = 42, z');
+verifyNotEnumerable(f4, 'length');
+verifyNotWritable(f4, 'length');
+verifyConfigurable(f4, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/line-terminator.js b/js/src/tests/test262/language/statements/function/line-terminator.js
new file mode 100644
index 0000000000..f841d2e85e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/line-terminator.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Any separators are admitted between declaration chunks
+es5id: 13_A16
+description: Inserting separators between declaration chunks
+---*/
+
+function
+x
+(
+)
+{
+}
+;
+
+x();
+
+function y ( ) {};
+
+y();
+
+function
+
+z
+
+(
+
+)
+
+{
+
+}
+
+;
+
+z();
+
+// The following function expression is expressed with literal unicode
+// characters so that parsers may benefit from this test. The included code
+// points are as follows:
+//
+// "function\u0009\u2029w(\u000C)\u00A0{\u000D}"
+
+function 
w( ) { }
+
+w();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/name-arguments-non-strict.js b/js/src/tests/test262/language/statements/function/name-arguments-non-strict.js
new file mode 100644
index 0000000000..97deb71691
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/name-arguments-non-strict.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-3-7
+description: >
+ arguments allowed as function identifier in non-strict function
+ declaration
+flags: [noStrict]
+---*/
+
+function arguments (){}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/name-arguments-strict-body.js b/js/src/tests/test262/language/statements/function/name-arguments-strict-body.js
new file mode 100644
index 0000000000..e91e3fe4de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/name-arguments-strict-body.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-40-s
+description: >
+ StrictMode - SyntaxError is thrown if 'arguments' occurs as the
+ Identifier of a FunctionDeclaration whose FunctionBody is
+ contained in strict code
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function arguments() { 'use strict'; }
diff --git a/js/src/tests/test262/language/statements/function/name-arguments-strict-strict.js b/js/src/tests/test262/language/statements/function/name-arguments-strict-strict.js
new file mode 100644
index 0000000000..40465ca380
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/name-arguments-strict-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-13-s
+description: >
+ StrictMode - SyntaxError is thrown if 'arguments' occurs as the
+ function name of a FunctionDeclaration in strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function arguments() { }
diff --git a/js/src/tests/test262/language/statements/function/name-eval-non-strict.js b/js/src/tests/test262/language/statements/function/name-eval-non-strict.js
new file mode 100644
index 0000000000..d1d8f2c358
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/name-eval-non-strict.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-3-1
+description: >
+ eval allowed as function identifier in non-strict function
+ declaration
+flags: [noStrict]
+---*/
+
+function eval(){}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/name-eval-strict-body.js b/js/src/tests/test262/language/statements/function/name-eval-strict-body.js
new file mode 100644
index 0000000000..5a4d885cba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/name-eval-strict-body.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-36-s
+description: >
+ StrictMode - SyntaxError is thrown if 'eval' occurs as the
+ function name of a FunctionDeclaration whose FunctionBody is in
+ strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function eval() { 'use strict'; }
diff --git a/js/src/tests/test262/language/statements/function/name-eval-strict-strict.js b/js/src/tests/test262/language/statements/function/name-eval-strict-strict.js
new file mode 100644
index 0000000000..a76ad3cb4e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/name-eval-strict-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-11-s
+description: >
+ StrictMode - SyntaxError is thrown if 'eval' occurs as the
+ function name of a FunctionDeclaration in strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function eval() { }
diff --git a/js/src/tests/test262/language/statements/function/name-eval-stricteval.js b/js/src/tests/test262/language/statements/function/name-eval-stricteval.js
new file mode 100644
index 0000000000..216b38e314
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/name-eval-stricteval.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-35-s
+description: >
+ StrictMode - SyntaxError is thrown if 'eval' occurs as the
+ function name of a FunctionDeclaration in strict eval code
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict'; function eval() { };")
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/name-unicode.js b/js/src/tests/test262/language/statements/function/name-unicode.js
new file mode 100644
index 0000000000..da927b78b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/name-unicode.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Unicode symbols in function name are allowed
+es5id: 13_A14
+description: Defining function name with unicode symbols
+---*/
+
+var funcA = eval("function __func\u0041(__arg){return __arg;}; __funcA");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof funcA !== "function") {
+ throw new Test262Error('#1: unicode symbols in function name are allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/name.js b/js/src/tests/test262/language/statements/function/name.js
new file mode 100644
index 0000000000..93338dfdd9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/name.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 14.1.19
+description: Assignment of function `name` attribute
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ 1. Let name be StringValue of BindingIdentifier.
+ 2. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody, scope, strict).
+ 3. Perform MakeConstructor(F).
+ 4. Perform SetFunctionName(F, name).
+ 5. Return F.
+includes: [propertyHelper.js]
+---*/
+
+function func() {}
+
+assert.sameValue(func.name, 'func');
+verifyNotEnumerable(func, 'name');
+verifyNotWritable(func, 'name');
+verifyConfigurable(func, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/function/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..149dd218e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/object-destructuring-param-strict-body.js
@@ -0,0 +1,134 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/func-decl.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+function f({property}) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/function/param-arguments-non-strict.js b/js/src/tests/test262/language/statements/function/param-arguments-non-strict.js
new file mode 100644
index 0000000000..a2560e4ddc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-arguments-non-strict.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-2-5
+description: >
+ arguments allowed as formal parameter name of a non-strict
+ function declaration
+flags: [noStrict]
+---*/
+
+function foo(arguments){}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/param-arguments-strict-body.js b/js/src/tests/test262/language/statements/function/param-arguments-strict-body.js
new file mode 100644
index 0000000000..00f6f5eaff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-arguments-strict-body.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-20-s
+description: >
+ StrictMode - SyntaxError is thrown if the identifier 'arguments'
+ appears within a FormalParameterList of a strict mode
+ FunctionDeclaration when FuctionBody is strict code
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_20_fun(arguments) { 'use strict'; }
diff --git a/js/src/tests/test262/language/statements/function/param-arguments-strict-strict.js b/js/src/tests/test262/language/statements/function/param-arguments-strict-strict.js
new file mode 100644
index 0000000000..d44504efe9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-arguments-strict-strict.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-3-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'arguments'
+ appears within a FormalParameterList of a strict mode
+ FunctionDeclaration
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_3_fun(arguments) { }
diff --git a/js/src/tests/test262/language/statements/function/param-dflt-yield-non-strict.js b/js/src/tests/test262/language/statements/function/param-dflt-yield-non-strict.js
new file mode 100644
index 0000000000..88e2dfa599
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-dflt-yield-non-strict.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-function-definitions
+es6id: 14.1
+description: >
+ The `yield` token is interpreted as an IdentifierReference within a generator
+ and outside of strict mode
+info: |
+ FunctionDeclaration[Yield, Default] :
+ function BindingIdentifier[?Yield] ( FormalParameters ) { FunctionBody }
+features: [generators, default-parameters]
+flags: [noStrict]
+---*/
+
+var yield = 23;
+var paramValue;
+
+function *g() {
+ function f(x = yield) {
+ paramValue = x;
+ }
+
+ f();
+}
+
+g().next();
+
+assert.sameValue(paramValue, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/param-dflt-yield-strict-strict.js b/js/src/tests/test262/language/statements/function/param-dflt-yield-strict-strict.js
new file mode 100644
index 0000000000..fbe3a93199
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-dflt-yield-strict-strict.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-function-definitions
+es6id: 14.1
+description: >
+ The `yield` token is interpreted as an IdentifierReference within a generator
+ and outside of strict mode
+info: |
+ FunctionDeclaration[Yield, Default] :
+ function BindingIdentifier[?Yield] ( FormalParameters ) { FunctionBody }
+features: [generators, default-parameters]
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function *g() {
+ function f(x = yield) {
+ paramValue = x;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/function/param-duplicated-non-strict.js b/js/src/tests/test262/language/statements/function/param-duplicated-non-strict.js
new file mode 100644
index 0000000000..af154b8f3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-duplicated-non-strict.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-1-1
+description: >
+ Duplicate identifier allowed in non-strict function declaration
+ parameter list
+flags: [noStrict]
+---*/
+
+function foo(a,a){}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/param-duplicated-strict-1-strict.js b/js/src/tests/test262/language/statements/function/param-duplicated-strict-1-strict.js
new file mode 100644
index 0000000000..f441c2c604
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-duplicated-strict-1-strict.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-5-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is declared in
+ 'strict mode' using a FunctionDeclaration and the function has two
+ identical parameters
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_5_fun(param, param) { }
diff --git a/js/src/tests/test262/language/statements/function/param-duplicated-strict-2-strict.js b/js/src/tests/test262/language/statements/function/param-duplicated-strict-2-strict.js
new file mode 100644
index 0000000000..6aac7f99d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-duplicated-strict-2-strict.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-6-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created in
+ 'strict mode' using a FunctionDeclaration and the function has two
+ identical parameters, which are separated by a unique parameter
+ name
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_6_fun(param1, param2, param1) { }
diff --git a/js/src/tests/test262/language/statements/function/param-duplicated-strict-3-strict.js b/js/src/tests/test262/language/statements/function/param-duplicated-strict-3-strict.js
new file mode 100644
index 0000000000..8fed56b53f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-duplicated-strict-3-strict.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-7-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created in
+ 'strict mode' using a FunctionDeclaration and the function has
+ three identical parameters
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_7_fun(param, param, param) { }
diff --git a/js/src/tests/test262/language/statements/function/param-duplicated-strict-body-1.js b/js/src/tests/test262/language/statements/function/param-duplicated-strict-body-1.js
new file mode 100644
index 0000000000..80a96a8223
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-duplicated-strict-body-1.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-24-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created using
+ a FunctionDeclaration whose FunctionBody is contained in strict
+ code and the function has two identical parameters
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_24_fun(param, param) { 'use strict'; }
diff --git a/js/src/tests/test262/language/statements/function/param-duplicated-strict-body-2.js b/js/src/tests/test262/language/statements/function/param-duplicated-strict-body-2.js
new file mode 100644
index 0000000000..e7aa120deb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-duplicated-strict-body-2.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-26-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created using
+ a FunctionDeclaration whose FunctionBody is contained in strict
+ code and the function has two identical parameters which are
+ separated by a unique parameter name
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_26_fun(param1, param2, param1) { 'use strict'; }
diff --git a/js/src/tests/test262/language/statements/function/param-duplicated-strict-body-3.js b/js/src/tests/test262/language/statements/function/param-duplicated-strict-body-3.js
new file mode 100644
index 0000000000..436895af98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-duplicated-strict-body-3.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode
+ FunctionDeclaration or FunctionExpression.
+es5id: 13.1-28-s
+description: >
+ Strict Mode - SyntaxError is thrown if a function is created using
+ a FunctionDeclaration whose FunctionBody is contained in strict
+ code and the function has three identical parameters
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_28_fun(param, param, param) { 'use strict'; }
diff --git a/js/src/tests/test262/language/statements/function/param-eval-non-strict-is-correct-value.js b/js/src/tests/test262/language/statements/function/param-eval-non-strict-is-correct-value.js
new file mode 100644
index 0000000000..9ff385873a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-eval-non-strict-is-correct-value.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+ eval allowed as formal parameter name of a non-strict function declaration
+flags: [noStrict]
+---*/
+
+let exprCallCount = 0;
+let evalValue = {};
+
+function foo(eval) {
+ assert.sameValue(eval, evalValue);
+ exprCallCount += 1;
+}
+
+foo(evalValue);
+
+assert.sameValue(exprCallCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/param-eval-non-strict.js b/js/src/tests/test262/language/statements/function/param-eval-non-strict.js
new file mode 100644
index 0000000000..71c2e5865b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-eval-non-strict.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 13.1-2-1
+description: >
+ eval allowed as formal parameter name of a non-strict function
+ declaration
+flags: [noStrict]
+---*/
+
+function foo(eval){};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/param-eval-strict-body.js b/js/src/tests/test262/language/statements/function/param-eval-strict-body.js
new file mode 100644
index 0000000000..f98ff29772
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-eval-strict-body.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-16-s
+description: >
+ StrictMode - SyntaxError is thrown if the identifier 'eval'
+ appears within a FormalParameterList of a strict mode
+ FunctionDeclaration when FuctionBody is strict code
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_16_fun(eval) { 'use strict'; }
diff --git a/js/src/tests/test262/language/statements/function/param-eval-strict-strict.js b/js/src/tests/test262/language/statements/function/param-eval-strict-strict.js
new file mode 100644
index 0000000000..870befd911
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-eval-strict-strict.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-1-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'eval'
+ appears within a FormalParameterList of a strict mode
+ FunctionDeclaration
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function _13_1_1_fun(eval) { }
diff --git a/js/src/tests/test262/language/statements/function/param-eval-stricteval.js b/js/src/tests/test262/language/statements/function/param-eval-stricteval.js
new file mode 100644
index 0000000000..5d956fdc2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/param-eval-stricteval.js
@@ -0,0 +1,22 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Refer 13.1;
+ It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList
+ of a strict mode FunctionDeclaration or FunctionExpression.
+es5id: 13.1-15-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'eval'
+ appears within a FormalParameterList of a strict mode
+ FunctionDeclaration in strict eval code
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("'use strict';function _13_1_15_fun(eval) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/params-dflt-args-unmapped.js b/js/src/tests/test262/language/statements/function/params-dflt-args-unmapped.js
new file mode 100644
index 0000000000..83269032e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/params-dflt-args-unmapped.js
@@ -0,0 +1,84 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+es6id: 14.1.19
+features: [default-parameters]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+function f(x, _ = 0) {
+ assert.sameValue(x, undefined, 'parameter binding value (initial)');
+ assert.sameValue(
+ arguments[0], undefined, 'arguments property value (initial)'
+ );
+
+ arguments[0] = 1;
+
+ assert.sameValue(
+ x, undefined, 'parameter binding value (after arguments modification)'
+ );
+ assert.sameValue(
+ arguments[0], 1, 'arguments property value (after arguments modification)'
+ );
+
+ x = 2;
+
+ assert.sameValue(
+ x, 2, 'parameter binding value (after parameter binding modification)'
+ );
+ assert.sameValue(
+ arguments[0],
+ 1,
+ 'arguments property value (after parameter binding modification)'
+ );
+ callCount = callCount + 1;
+}
+
+f();
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/params-dflt-ref-arguments.js b/js/src/tests/test262/language/statements/function/params-dflt-ref-arguments.js
new file mode 100644
index 0000000000..522c276e85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/params-dflt-ref-arguments.js
@@ -0,0 +1,63 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+es6id: 14.1.19
+features: [default-parameters]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+function f(x = arguments[2], y = arguments[3], z) {
+ assert.sameValue(x, 'third', 'first parameter');
+ assert.sameValue(y, 'fourth', 'second parameter');
+ assert.sameValue(z, 'third', 'third parameter');
+ callCount = callCount + 1;
+}
+
+f(undefined, undefined, 'third', 'fourth');
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/function/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..82db4f96c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/params-trailing-comma-multiple.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function ref(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+}
+
+ref(42, 39, 1);
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+assert.sameValue(ref.length, 2, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/function/params-trailing-comma-single.js
new file mode 100644
index 0000000000..cd55376ce2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/params-trailing-comma-single.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+flags: [generated]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function ref(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+}
+
+ref(42, 39);
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/rest-param-strict-body.js b/js/src/tests/test262/language/statements/function/rest-param-strict-body.js
new file mode 100644
index 0000000000..ef15c27e73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/rest-param-strict-body.js
@@ -0,0 +1,134 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/func-decl.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+function f(a,...rest) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/function/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/function/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..0b40bf27cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,59 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/func-decl.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+function f(...a,) {
+
+}
diff --git a/js/src/tests/test262/language/statements/function/scope-body-lex-distinct.js b/js/src/tests/test262/language/statements/function/scope-body-lex-distinct.js
new file mode 100644
index 0000000000..6a7fb51413
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/scope-body-lex-distinct.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new lexical environment (distinct from the variable
+ environment) for the function body outside of strict mode
+info: |
+ [...]
+ 29. If strict is false, then
+ a. Let lexEnv be NewDeclarativeEnvironment(varEnv).
+ b. NOTE: Non-strict functions use a separate lexical Environment Record
+ for top-level lexical declarations so that a direct eval can
+ determine whether any var scoped declarations introduced by the eval
+ code conflict with pre-existing top-level lexically scoped
+ declarations. This is not needed for strict functions because a
+ strict direct eval always places all declarations into a new
+ Environment Record.
+ [...]
+
+ 18.2.1.3 Runtime Semantics: EvalDeclarationInstantiation
+
+ [...]
+ 5. If strict is false, then
+ [...]
+ b. Let thisLex be lexEnv.
+ c. Assert: The following loop will terminate.
+ d. Repeat while thisLex is not the same as varEnv,
+ i. Let thisEnvRec be thisLex's EnvironmentRecord.
+ ii. If thisEnvRec is not an object Environment Record, then
+ 1. NOTE: The environment of with statements cannot contain any
+ lexical declaration so it doesn't need to be checked for
+ var/let hoisting conflicts.
+ 2. For each name in varNames, do
+ a. If thisEnvRec.HasBinding(name) is true, then
+ i. Throw a SyntaxError exception.
+ ii. NOTE: Annex B.3.5 defines alternate semantics for the
+ above step.
+ b. NOTE: A direct eval will not hoist var declaration over a
+ like-named lexical declaration.
+ iii. Let thisLex be thisLex's outer environment reference.
+flags: [noStrict]
+features: [let]
+---*/
+
+function f() {
+ let x;
+ eval('var x;');
+}
+
+assert.throws(SyntaxError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/scope-param-elem-var-close.js b/js/src/tests/test262/language/statements/function/scope-param-elem-var-close.js
new file mode 100644
index 0000000000..4917660fe5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/scope-param-elem-var-close.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ sloppy direct evals in params introduce vars
+info: |
+ [...]
+ 20. Else,
+ a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
+ b. Let calleeEnv be the LexicalEnvironment of calleeContext.
+ c. Let env be NewDeclarativeEnvironment(calleeEnv).
+ d. Let envRec be env's EnvironmentRecord.
+ [...]
+flags: [noStrict]
+---*/
+
+var x = 'outside';
+var probe1, probe2, probeBody;
+
+function f(
+ _ = (eval('var x = "inside";'), probe1 = function() { return x; }),
+ __ = probe2 = function() { return x; }
+ ) {
+ probeBody = function() { return x; };
+}
+f();
+
+assert.sameValue(probe1(), 'inside');
+assert.sameValue(probe2(), 'inside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/scope-param-elem-var-open.js b/js/src/tests/test262/language/statements/function/scope-param-elem-var-open.js
new file mode 100644
index 0000000000..fa797f651b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/scope-param-elem-var-open.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ sloppy direct evals in params introduce vars
+info: |
+ [...]
+ 20. Else,
+ a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
+ b. Let calleeEnv be the LexicalEnvironment of calleeContext.
+ c. Let env be NewDeclarativeEnvironment(calleeEnv).
+ d. Let envRec be env's EnvironmentRecord.
+ [...]
+flags: [noStrict]
+---*/
+
+var x = 'outside';
+var probe1, probe2;
+
+function f(
+ _ = probe1 = function() { return x; },
+ __ = (eval('var x = "inside";'), probe2 = function() { return x; })
+ ) {
+}
+f();
+
+assert.sameValue(probe1(), 'inside');
+assert.sameValue(probe2(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/scope-param-rest-elem-var-close.js b/js/src/tests/test262/language/statements/function/scope-param-rest-elem-var-close.js
new file mode 100644
index 0000000000..60a9300041
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/scope-param-rest-elem-var-close.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ sloppy direct evals in params introduce vars
+info: |
+ [...]
+ 20. Else,
+ a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
+ b. Let calleeEnv be the LexicalEnvironment of calleeContext.
+ c. Let env be NewDeclarativeEnvironment(calleeEnv).
+ d. Let envRec be env's EnvironmentRecord.
+ [...]
+flags: [noStrict]
+---*/
+
+var x = 'outside';
+var probeParam, probeBody;
+
+function f(
+ ...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
+ ) {
+ probeBody = function() { return x; }
+}
+f();
+
+assert.sameValue(probeParam(), 'inside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/scope-param-rest-elem-var-open.js b/js/src/tests/test262/language/statements/function/scope-param-rest-elem-var-open.js
new file mode 100644
index 0000000000..d51883fa90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/scope-param-rest-elem-var-open.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ sloppy direct evals in params introduce vars
+info: |
+ [...]
+ 20. Else,
+ a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
+ b. Let calleeEnv be the LexicalEnvironment of calleeContext.
+ c. Let env be NewDeclarativeEnvironment(calleeEnv).
+ d. Let envRec be env's EnvironmentRecord.
+ [...]
+flags: [noStrict]
+---*/
+
+var x = 'outside';
+var probe1, probe2;
+
+function f(
+ _ = probe1 = function() { return x; },
+ ...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })]
+ ) {
+}
+f();
+
+assert.sameValue(probe1(), 'inside');
+assert.sameValue(probe2(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/scope-paramsbody-var-close.js b/js/src/tests/test262/language/statements/function/scope-paramsbody-var-close.js
new file mode 100644
index 0000000000..bf46717b5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/scope-paramsbody-var-close.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Disposal of variable environment for the function body
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var probe;
+
+// A parameter expression is necessary to trigger the creation of the scope
+// under test.
+function f(_ = null) {
+ var x = 'inside';
+ probe = function() { return x; };
+}
+f();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/scope-paramsbody-var-open.js b/js/src/tests/test262/language/statements/function/scope-paramsbody-var-open.js
new file mode 100644
index 0000000000..84c38b197c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/scope-paramsbody-var-open.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new variable environment for the function body (as distinct from
+ that for the function's parameters)
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+function f(_ = probeParams = function() { return x; }) {
+ var x = 'inside';
+ probeBody = function() { return x; };
+}
+f();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/shell.js b/js/src/tests/test262/language/statements/function/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/shell.js
diff --git a/js/src/tests/test262/language/statements/function/static-init-await-binding-invalid.js b/js/src/tests/test262/language/statements/function/static-init-await-binding-invalid.js
new file mode 100644
index 0000000000..2804c05f85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/static-init-await-binding-invalid.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: BindingIdentifier may not be `await` within class static blocks
+info: |
+ BindingIdentifier : Identifier
+
+ [...]
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ function await() {}
+ }
+}
+
diff --git a/js/src/tests/test262/language/statements/function/static-init-await-binding-valid.js b/js/src/tests/test262/language/statements/function/static-init-await-binding-valid.js
new file mode 100644
index 0000000000..671a7906ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/static-init-await-binding-valid.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The `await` keyword is interpreted as an identifier within arrow function bodies
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ [...]
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+features: [class-static-block]
+---*/
+
+class C {
+ static {
+ (() => { function await() {} });
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/statements/function/unscopables-with-in-nested-fn.js
new file mode 100644
index 0000000000..cce6cfb641
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/unscopables-with-in-nested-fn.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with-in-nested-fn.case
+// - src/function-forms/default/func-decl.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [globalThis, Symbol.unscopables]
+flags: [generated, noStrict]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function ref(x) {
+ (function() {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ }
+ })();
+ (function() {
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ })();
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+}
+
+ref(10);
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/unscopables-with.js b/js/src/tests/test262/language/statements/function/unscopables-with.js
new file mode 100644
index 0000000000..ddbef97778
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/unscopables-with.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with.case
+// - src/function-forms/default/func-decl.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (function declaration)
+esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [globalThis, Symbol.unscopables]
+flags: [generated, noStrict]
+info: |
+ FunctionDeclaration :
+ function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody,
+ scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function ref(x) {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
+ }
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+}
+
+ref(10);
+
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/function/use-strict-with-non-simple-param.js b/js/src/tests/test262/language/statements/function/use-strict-with-non-simple-param.js
new file mode 100644
index 0000000000..676d0a47c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/function/use-strict-with-non-simple-param.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-function-definitions-static-semantics-early-errors
+description: >
+ A SyntaxError is thrown if a function contains a non-simple parameter list and a UseStrict directive.
+info: |
+ Static Semantics: Early Errors
+
+ It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f(a = 0) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/generators/arguments-with-arguments-fn.js b/js/src/tests/test262/language/statements/generators/arguments-with-arguments-fn.js
new file mode 100644
index 0000000000..f97fdd5676
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/arguments-with-arguments-fn.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+es6id: 9.2.12
+description: >
+ Arguments object is created even when the body contains a lexically-scoped
+ binding named "arguments"
+info: |
+ [...]
+ 19. Else if "arguments" is an element of parameterNames, then
+ a. Let argumentsObjectNeeded be false.
+ 20. Else if hasParameterExpressions is false, then
+ a. If "arguments" is an element of functionNames or if "arguments" is an
+ element of lexicalNames, then
+ i. Let argumentsObjectNeeded be false.
+ [...]
+flags: [noStrict]
+features: [generators]
+---*/
+
+var args;
+
+function* g(x = args = arguments) {
+ function arguments() {}
+}
+
+g().next();
+
+assert.sameValue(typeof args, 'object');
+assert.sameValue(args.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/arguments-with-arguments-lex.js b/js/src/tests/test262/language/statements/generators/arguments-with-arguments-lex.js
new file mode 100644
index 0000000000..597774c590
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/arguments-with-arguments-lex.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+es6id: 9.2.12
+description: >
+ Arguments object is created even when the body contains a function named
+ "arguments"
+info: |
+ [...]
+ 19. Else if "arguments" is an element of parameterNames, then
+ a. Let argumentsObjectNeeded be false.
+ 20. Else if hasParameterExpressions is false, then
+ a. If "arguments" is an element of functionNames or if "arguments" is an
+ element of lexicalNames, then
+ i. Let argumentsObjectNeeded be false.
+ [...]
+flags: [noStrict]
+features: [generators]
+---*/
+
+var args;
+
+function* g(x = args = arguments) {
+ let arguments;
+}
+
+g().next();
+
+assert.sameValue(typeof args, 'object');
+assert.sameValue(args.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/generators/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..7a1e019871
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/array-destructuring-param-strict-body.js
@@ -0,0 +1,134 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/gen-func-decl.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [rest-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+function* f([element]) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/generators/browser.js b/js/src/tests/test262/language/statements/generators/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/browser.js
diff --git a/js/src/tests/test262/language/statements/generators/cptn-decl.js b/js/src/tests/test262/language/statements/generators/cptn-decl.js
new file mode 100644
index 0000000000..8b370933a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/cptn-decl.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 Apple Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-statement-semantics-runtime-semantics-evaluation
+description: Generator declaration completion value is empty.
+info: |
+ GeneratorDeclaration[Yield, Await, Default]:
+
+ function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
+
+ HoistableDeclaration : GeneratorDeclaration
+
+ 1. Return NormalCompletion(empty).
+features: [generators]
+---*/
+
+assert.sameValue(eval('function* f() {}'), undefined);
+assert.sameValue(eval('1; function* f() {}'), 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/declaration.js b/js/src/tests/test262/language/statements/generators/declaration.js
new file mode 100644
index 0000000000..8dba06f36a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/declaration.js
@@ -0,0 +1,20 @@
+// Copyright 2015 Cubane Canada, Inc. All rights reserved.
+// See LICENSE for details.
+
+/*---
+info: |
+ Generator can be declared with GeneratorDeclaration syntax
+es6id: 14.4
+author: Sam Mikes
+description: can declare generator functions
+features: [generators]
+---*/
+
+function *foo(a) { yield a+1; return; }
+
+var g = foo(3);
+
+assert.sameValue(g.next().value, 4);
+assert.sameValue(g.next().done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/default-proto.js b/js/src/tests/test262/language/statements/generators/default-proto.js
new file mode 100644
index 0000000000..c7171b80f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/default-proto.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-evaluatebody
+es6id: 14.4.11
+description: Intrinsic default prototype of GeneratorFunctions
+info: |
+ 1. Let G be ? OrdinaryCreateFromConstructor(functionObject,
+ "%GeneratorPrototype%", « [[GeneratorState]], [[GeneratorContext]] »).
+ [...]
+
+ 9.1.13 OrdinaryCreateFromConstructor
+
+ [...]
+ 2. Let proto be ? GetPrototypeFromConstructor(constructor,
+ intrinsicDefaultProto).
+ 3. Return ObjectCreate(proto, internalSlotsList).
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ [...]
+features: [generators]
+---*/
+
+function* g() {}
+var GeneratorPrototype = Object.getPrototypeOf(g).prototype;
+g.prototype = null;
+
+assert.sameValue(Object.getPrototypeOf(g()), GeneratorPrototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/generators/dflt-params-abrupt.js
new file mode 100644
index 0000000000..0a34923d1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dflt-params-abrupt.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/gen-func-decl.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+var callCount = 0;
+function* f(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+assert.sameValue(callCount, 0, 'generator function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/generators/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..d9b8460c22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,87 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/gen-func-decl.template
+/*---
+description: Use of initializer when argument value is not `undefined` (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function* ref(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+}
+
+ref(false, '', NaN, 0, null, obj).next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/generators/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..37b2956bcb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dflt-params-arg-val-undefined.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/gen-func-decl.template
+/*---
+description: Use of initializer when argument value is `undefined` (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function* ref(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+}
+
+ref(undefined, void 0).next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/generators/dflt-params-duplicates.js
new file mode 100644
index 0000000000..acff003ee0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dflt-params-duplicates.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/gen-func-decl.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+function* f(x = 0, x) {
+
+}
diff --git a/js/src/tests/test262/language/statements/generators/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/generators/dflt-params-ref-later.js
new file mode 100644
index 0000000000..d56330f90e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dflt-params-ref-later.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/gen-func-decl.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+function* f(x = y, y) {
+
+ callCount = callCount + 1;
+}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+assert.sameValue(callCount, 0, 'generator function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/generators/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..5b4d4bbf20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dflt-params-ref-prior.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/gen-func-decl.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function* ref(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+}
+
+ref(3).next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/generators/dflt-params-ref-self.js
new file mode 100644
index 0000000000..12e88a8c8c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dflt-params-ref-self.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/gen-func-decl.template
+/*---
+description: Referencing a parameter from within its own initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters, generators]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+function* f(x = x) {
+
+ callCount = callCount + 1;
+}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+assert.sameValue(callCount, 0, 'generator function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dflt-params-rest.js b/js/src/tests/test262/language/statements/generators/dflt-params-rest.js
new file mode 100644
index 0000000000..37b1ba1935
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dflt-params-rest.js
@@ -0,0 +1,67 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/gen-func-decl.template
+/*---
+description: RestParameter does not support an initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+function* f(...x = []) {
+
+}
diff --git a/js/src/tests/test262/language/statements/generators/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/generators/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..9e41293ecc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dflt-params-trailing-comma.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/gen-func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function* ref(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+}
+
+ref(42, undefined, 1).next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-close.js
new file mode 100644
index 0000000000..070211dc51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x]) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+};
+f(iter).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..061aacfcac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Abrupt completion returned by GetIterator (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+function* f([x, y, z]) {}
+
+assert.throws(TypeError, function() {
+ f([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-get-err.js
new file mode 100644
index 0000000000..cefbe3af8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-get-err.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Abrupt completion returned by GetIterator (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+function* f([x]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/generators/dstr/ary-init-iter-no-close.js
new file mode 100644
index 0000000000..8ec447cf4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x]) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+};
+f(iter).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/statements/generators/dstr/ary-name-iter-val.js
new file mode 100644
index 0000000000..ee87f9a426
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding with normal value iteration (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..edc36af3c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..2c41271fba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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* f([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+};
+f([[7, 8, 9]]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..7e3c622dcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..d028c485f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+};
+f([[]]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..5eb48c1c86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..8ffc811272
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f([[23]]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..a8275eeadc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[...x] = 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);
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..d0ec9ba538
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ callCount = callCount + 1;
+};
+f([values]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..488a9633da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Nested array destructuring with a null value (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+function* f([[x]]) {}
+
+assert.throws(TypeError, function() {
+ f([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..a6df78cd24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Destructuring initializer with an exhausted iterator (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..367c71d59a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..6da7e8c78f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..ed57c66ba5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..b736b59dec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..cba8655724
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// 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/gen-func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..1983b26ced
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Destructuring initializer with a "hole" (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+};
+f([,]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..66604d9783
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f([null, 0, false, '']).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..c818b5049e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Destructuring initializer returns an abrupt completion (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+function* f([x = (function() { throw new Test262Error(); })()]) {}
+
+assert.throws(Test262Error, function() {
+ f([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..78a9c350a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Destructuring initializer with an undefined value (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x = 23]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f([undefined]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..dde818edf6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Destructuring initializer is an unresolvable reference (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function* f([ x = unresolvableReference ]) {}
+
+assert.throws(ReferenceError, function() {
+ f([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..523dd78256
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding when value iteration completes (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..67d5bc220b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([_, x]) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..e88649739f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+function* f([x]) {}
+
+assert.throws(Test262Error, function() {
+ f(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..a085d0eab8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+function* f([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..2ef06dabcd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+function* f([x]) {}
+
+assert.throws(Test262Error, function() {
+ f(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..1a1c0f958b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..46b616eb41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..16b57f3c88
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+};
+f([{ x: 11, y: 22, z: 33 }]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..3f0e79c08b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..40aceb907c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f([{ u: 777, w: 888, y: 999 }]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..01eac68ef1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Nested object destructuring with a null value (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+function* f([{ x }]) {}
+
+assert.throws(TypeError, function() {
+ f([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..2ff371b420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Nested object destructuring with a value of `undefined` (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+function* f([{ x }]) {}
+
+assert.throws(TypeError, function() {
+ f([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..cb1baf966c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Elision accepts exhausted iterator (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([,]) {
+
+ callCount = callCount + 1;
+};
+f(iter).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..46233e56b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision-step-err.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+function* f([,]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-elision.js
new file mode 100644
index 0000000000..904635c9ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Elision advances iterator (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f(g()).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-empty.js
new file mode 100644
index 0000000000..f1e9a584c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+function* f([]) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+};
+f(iter).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..d089e10e00
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Rest element containing an array BindingElementList pattern (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+};
+f([3, 4, 5]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..bd98fc0d59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Rest element containing an elision (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+};
+f(g()).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..0624a5ecd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Rest element containing an "empty" array pattern (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...[]]) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+};
+f(iter).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..e70f0f4810
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Rest element containing a rest element (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...[...x]]) {
+ 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);
+
+ callCount = callCount + 1;
+};
+f(values).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..a757ac9395
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-direct.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Lone rest element (direct binding) (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+function* f([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+};
+f([1]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..b651e1d9ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Rest element following elision elements (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+function* f([, ...x]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..02b4a277dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Rest element following elision elements (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([ , , ...x]) {
+ 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);
+ callCount = callCount + 1;
+};
+f(values).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..51bcf5564f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: RestElement applied to an exhausted iterator (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+};
+f([1, 2]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..0e7649b5bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+function* f([...x]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..c9a30f0761
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+function* f([...x]) {}
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..52cf032774
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Lone rest element (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...x]) {
+ 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);
+ callCount = callCount + 1;
+};
+f(values).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..709ad6689f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..1c24f4886d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Rest element (identifier) does not support initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...x = []]) {
+
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..f707db33de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-init-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...{ x } = []]) {
+
+ callCount = callCount + 1;
+};
+f([]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..0be6d7726a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...[x], y]) {
+
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..1d928d1e08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Rest element (identifier) may not be followed by any element (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...x, y]) {
+
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..cb834ac504
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...{ x }, y]) {
+
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..f9888f1e95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Rest element containing an object binding pattern (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...{ length }]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+};
+f([1, 2, 3]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..f453270fe3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Rest element containing an object binding pattern (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+function* f([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+};
+f([7, 8, 9]).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/browser.js b/js/src/tests/test262/language/statements/generators/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-close.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..7fd04976ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x] = iter) {
+ assert.sameValue(doneCallCount, 1);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..0a3c267e4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+function* f([x, y, z] = [1, 2, 3]) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..89b6b056d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-get-err.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+function* f([x] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..d0070d79d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x] = iter) {
+ assert.sameValue(doneCallCount, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-name-iter-val.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..93a00016ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..7cb24f5326
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[x, y, z] = [4, 5, 6]] = []) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..b916777786
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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* f([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..1e8aa34711
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[,] = g()] = []) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..ef9dee96b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[,] = g()] = [[]]) {
+ assert.sameValue(callCount, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..96a8e0a8b1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[] = function() { initCount += 1; return iter; }()] = []) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..975e2645fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[] = function() { initCount += 1; }()] = [[23]]) {
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..0a591a0395
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[...x] = 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);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..c41f1fbc20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([[...x] = function() { initCount += 1; }()] = [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);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..702da478cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Nested array destructuring with a null value (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+function* f([[x]] = [null]) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..5fd55e6a1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x = 23] = []) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..426c3bf087
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([arrow = () => {}] = []) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..3dd2091151
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..08d78391d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([cover = (function () {}), xCover = (0, function() {})] = []) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..5f6ca23110
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([fn = function () {}, xFn = function x() {}] = []) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..4de7da79c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,65 @@
+// 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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([gen = function* () {}, xGen = function* x() {}] = []) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..cdf756a868
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x = 23] = [,]) {
+ assert.sameValue(x, 23);
+ // another statement
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..2c03a17217
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..7caca2e0d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+---*/
+
+function* f([x = (function() { throw new Test262Error(); })()] = [undefined]) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..78041dad4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x = 23] = [undefined]) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..f8c8754b86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function* f([ x = unresolvableReference ] = []) {}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..0cf4ada254
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..11ee30daaf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([_, x] = []) {
+ assert.sameValue(x, undefined);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..d14fda2324
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+function* f([x] = g) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..666519659e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,81 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var callCount = 0;
+function* f([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..4c5f951de9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,77 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+function* f([x] = g) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..43cbbf7241
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([x, y, z] = [1, 2, 3]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..73d5a7838d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..caa450eb7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..0ee3cd9141
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..ead6f84704
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..509fdef404
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Nested object destructuring with a null value (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+function* f([{ x }] = [null]) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..a47a0accd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+function* f([{ x }] = []) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..08b551c95e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Elision accepts exhausted iterator (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([,] = iter) {
+
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..2094923aa1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision-step-err.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+function* f([,] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..711b7ee8de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Elision advances iterator (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([,] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..16520a1cb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var callCount = 0;
+function* f([] = iter) {
+ assert.sameValue(iterations, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..687489bd84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...[x, y, z]] = [3, 4, 5]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..d8b153487f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Rest element containing an elision (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...[,]] = g()) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..4b912f4678
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...[]] = iter) {
+ assert.sameValue(iterations, 1);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..be6e892868
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Rest element containing a rest element (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...[...x]] = 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);
+
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..9be676e308
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Lone rest element (direct binding) (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var callCount = 0;
+function* f([...x] = [1]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..ac4e2ccb3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Rest element following elision elements (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 iter = (function*() { throw new Test262Error(); })();
+
+function* f([, ...x] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..ffd7a31d41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Rest element following elision elements (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([ , , ...x] = 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);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..8daf7bb3cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([, , ...x] = [1, 2]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..8ce90e621d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+function* f([...x] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..75e6e91f85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+function* f([...x] = iter) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..f2a486d518
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Lone rest element (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...x] = 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);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..bf253ad62b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..7b47998a9b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...x = []] = []) {
+
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..86b09cdf04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-init-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..36f8546852
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...[x], y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..7b55ea42d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...x, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..6600c24443
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,58 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+function* f([...{ x }, y] = [1, 2, 3]) {
+
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..6fd55ed9f0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Rest element containing an object binding pattern (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f([...{ length }] = [1, 2, 3]) {
+ assert.sameValue(length, 3);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..d80ed3e5a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Rest element containing an object binding pattern (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+ [...]
+---*/
+let length = "outer";
+
+var callCount = 0;
+function* f([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-init-null.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-init-null.js
new file mode 100644
index 0000000000..447533f2b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-init-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+function* f({} = null) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-init-undefined.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..96c3faceee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-init-undefined.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+function* f({} = undefined) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..fd0049c958
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+function* f({} = obj) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..94bb067028
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-get-value-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+function* f({ poisoned } = poisonedProperty) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..8865dae913
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ arrow = () => {} } = {}) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..120764e074
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..e0734ed86e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ cover = (function () {}), xCover = (0, function() {}) } = {}) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..a23ac6eeca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ fn = function () {}, xFn = function x() {} } = {}) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..83f4092ad5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ gen = function* () {}, xGen = function* x() {} } = {}) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..a76e614ede
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..5521677612
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-throws.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function* f({ x = thrower() } = {}) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..907bad7d5c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function* f({ x = unresolvableReference } = {}) {}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..7257f4ae99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function* f({ x, } = { x: 23 }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..ecc6954c8c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-list-err.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+function* f({ a, b = thrower(), c = ++initCount } = {}) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..976483e6cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w: [x, y, z] = [4, 5, 6] } = {}) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..79044cc81e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function* f({ x: [y], } = { x: [45] }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..bec276192a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function* f({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..67c750f56f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..0ed24be60d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-eval-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function* f({ [thrower()]: x } = {}) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..01abbe3a86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+function* f({ poisoned: x = ++initEvalCount } = poisonedProperty) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..f71580643b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..9654cbf55b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function* f({ x: y = thrower() } = {}) {}
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..a9a0838fd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function* f({ x: y = unresolvableReference } = {}) {}
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..e8e0cc2755
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+function* f({ x: y = 33 } = { }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..eb52e18c01
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function* f({ x: y, } = { x: 23 }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..25a935f599
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Binding as specified via property name and identifier (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+function* f({ x: y } = { x: 23 }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..2a81df1362
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..254bd5f4cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..bef3291660
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function* f({ w: { x, y, z } = undefined } = { }) {}
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..9210c8e1b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..0b2e08c505
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/gen-func-decl-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+function* f({...x} = { get v() { count++; return 2; } }) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..3bcf4bc03f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+function* f({...rest} = o) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/generators/dstr/dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..2c5a0de59b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/dflt-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/gen-func-decl-dflt.template
+/*---
+description: Rest object contains just unextracted data (generator function declaration (default parameter))
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, generators, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+function* f({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f().next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-init-null.js b/js/src/tests/test262/language/statements/generators/dstr/obj-init-null.js
new file mode 100644
index 0000000000..c7b9ebcc6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-init-null.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+function* f({}) {}
+
+assert.throws(TypeError, function() {
+ f(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-init-undefined.js b/js/src/tests/test262/language/statements/generators/dstr/obj-init-undefined.js
new file mode 100644
index 0000000000..a848b4ecd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-init-undefined.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+function* f({}) {}
+
+assert.throws(TypeError, function() {
+ f(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-empty.js
new file mode 100644
index 0000000000..9b32514df7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var callCount = 0;
+function* f({}) {
+ assert.sameValue(accessCount, 0);
+ callCount = callCount + 1;
+};
+f(obj).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..81b68df892
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-get-value-err.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+function* f({ poisoned }) {}
+
+assert.throws(Test262Error, function() {
+ f(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..a5ed67f583
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ callCount = callCount + 1;
+};
+f({}).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..09ceecbbdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ callCount = callCount + 1;
+};
+f({}).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..a5b47f9827
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ callCount = callCount + 1;
+};
+f({}).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..b685b28bba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ callCount = callCount + 1;
+};
+f({}).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..7db82c0115
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ callCount = callCount + 1;
+};
+f({}).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..1c3121fdce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ callCount = callCount + 1;
+};
+f({ w: null, x: 0, y: false, z: '' }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..189d76f211
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-throws.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Error thrown when evaluating the initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function* f({ x = thrower() }) {}
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..f90a60608c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Destructuring initializer is an unresolvable reference (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function* f({ x = unresolvableReference }) {}
+
+assert.throws(ReferenceError, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..2e84e3cee0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function* f({ x, }) {
+ assert.sameValue(x, 23);
+ callCount = callCount + 1;
+};
+f({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-list-err.js
new file mode 100644
index 0000000000..61f598558e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-list-err.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+function* f({ a, b = thrower(), c = ++initCount }) {}
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..c909c78b71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({}).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..ff3428a01c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function* f({ x: [y], }) {
+ assert.sameValue(y,45);
+ callCount = callCount + 1;
+};
+f({ x: [45] }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..caed1efbf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function* f({ w: [x, y, z] = [4, 5, 6] }) {}
+
+assert.throws(TypeError, function() {
+ f({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..45d0cc62e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({ w: [7, undefined, ] }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..10a8a93a4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-eval-err.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Evaluation of property name returns an abrupt completion (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function* f({ [thrower()]: x }) {}
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..0b27f0c3a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+function* f({ poisoned: x = ++initEvalCount }) {}
+
+assert.throws(Test262Error, function() {
+ f(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..70ff1b6d1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ callCount = callCount + 1;
+};
+f({ s: null, u: 0, w: false, y: '' }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..7ce5179fad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Error thrown when evaluating the initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+function* f({ x: y = thrower() }) {}
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..5abdd969a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Destructuring initializer is an unresolvable reference (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+function* f({ x: y = unresolvableReference }) {}
+
+assert.throws(ReferenceError, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..f2be8328f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+function* f({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f({ }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..80d26f50a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var callCount = 0;
+function* f({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..9c1aa78c65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Binding as specified via property name and identifier (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var callCount = 0;
+function* f({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ callCount = callCount + 1;
+};
+f({ x: 23 }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..4bfe00d8ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({ w: undefined }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..703a216c95
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}
+
+assert.throws(TypeError, function() {
+ f({ w: null });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..f3ddc0a9b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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.
+---*/
+
+function* f({ w: { x, y, z } = undefined }) {}
+
+assert.throws(TypeError, function() {
+ f({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..eac87078f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env 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 callCount = 0;
+function* f({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ callCount = callCount + 1;
+};
+f({ w: { x: undefined, z: 7 } }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..a6bd6854a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-getter.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/gen-func-decl.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var count = 0;
+
+var callCount = 0;
+function* f({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f({ get v() { count++; return 2; } }).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..f5b2501a1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var callCount = 0;
+function* f({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ callCount = callCount + 1;
+};
+f(o).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/generators/dstr/obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..5191cb3772
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/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/gen-func-decl.template
+/*---
+description: Rest object contains just unextracted data (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [object-rest, generators, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+---*/
+
+var callCount = 0;
+function* f({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ callCount = callCount + 1;
+};
+f({x: 1, y: 2, a: 5, b: 3}).next();
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/dstr/shell.js b/js/src/tests/test262/language/statements/generators/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/generators/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/statements/generators/eval-var-scope-syntax-err.js
new file mode 100644
index 0000000000..04dbe5a94e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/eval-var-scope-syntax-err.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/eval-var-scope-syntax-err.case
+// - src/function-forms/error-no-strict/gen-func-decl.template
+/*---
+description: sloppy direct eval in params introduces var (generator function declaration in sloppy code)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [default-parameters, generators]
+flags: [generated, noStrict]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+
+ Runtime Semantics: IteratorBindingInitialization
+ FormalParameter : BindingElement
+
+ 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment.
+
+---*/
+
+var callCount = 0;
+function* f(a = eval("var a = 42")) {
+
+ callCount = callCount + 1;
+}
+
+assert.throws(SyntaxError, function() {
+ f();
+});
+
+assert.sameValue(callCount, 0, 'generator function body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/gen-func-decl-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/gen-func-decl-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..02b8f26aa2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/gen-func-decl-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template
+/*---
+description: Forbidden extension, f.arguments (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators]
+flags: [generated, noStrict]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+function* f() {
+ assert.sameValue(f.hasOwnProperty("arguments"), false);
+ callCount++;
+}
+
+f().next();
+assert.sameValue(callCount, 1, 'generator function body evaluated');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/gen-func-decl-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/gen-func-decl-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..e2374ef984
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/gen-func-decl-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template
+/*---
+description: Forbidden extension, o.caller (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators]
+flags: [generated, noStrict]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+function* f() {
+ assert.sameValue(f.hasOwnProperty("caller"), false);
+ callCount++;
+}
+
+f().next();
+assert.sameValue(callCount, 1, 'generator function body evaluated');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..f54bcc46e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template
+/*---
+description: Forbidden extension, o.caller (generator function declaration)
+esid: sec-generator-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators]
+flags: [generated, noStrict]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+function* f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+
+ callCount++;
+}
+
+f().next();
+
+assert.sameValue(callCount, 1, 'generator function body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..61f682b147
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template
+/*---
+description: Forbidden extension, o.caller (generator function declaration)
+esid: sec-generator-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators]
+flags: [generated, noStrict]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+function* f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+
+ callCount++;
+}
+
+f().next();
+
+assert.sameValue(callCount, 1, 'generator function body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..9afd4406c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/gen-func-decl-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template
+/*---
+description: Forbidden extension, o.caller (generator function declaration)
+esid: sec-generator-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators]
+flags: [generated, noStrict]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+function* f() {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+
+ callCount++;
+}
+
+f().next();
+
+assert.sameValue(callCount, 1, 'generator function body evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/generators/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/generators/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/generators/generator-created-after-decl-inst.js b/js/src/tests/test262/language/statements/generators/generator-created-after-decl-inst.js
new file mode 100644
index 0000000000..f3dd6f7312
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/generator-created-after-decl-inst.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-generator-function-definitions-runtime-semantics-evaluatebody
+description: >
+ The generator object is created after FunctionDeclarationInstantiation.
+info: |
+ 14.4.10 Runtime Semantics: EvaluateBody
+
+ 1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList).
+ 2. Let G be ? OrdinaryCreateFromConstructor(functionObject, "%GeneratorPrototype%",
+ « [[GeneratorState]], [[GeneratorContext]] »).
+ 3. Perform GeneratorStart(G, FunctionBody).
+ ...
+
+features: [generators]
+---*/
+
+function* g(a = (g.prototype = null)) {}
+var oldPrototype = g.prototype;
+var it = g();
+
+assert.notSameValue(Object.getPrototypeOf(it), oldPrototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/has-instance.js b/js/src/tests/test262/language/statements/generators/has-instance.js
new file mode 100644
index 0000000000..964cb7a390
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/has-instance.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ A Generator object is an instance of a generator function.
+es6id: 25.3
+features: [generators]
+---*/
+
+function* g() {}
+
+assert(g() instanceof g, 'Instance created via function invocation');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/invoke-as-constructor.js b/js/src/tests/test262/language/statements/generators/invoke-as-constructor.js
new file mode 100644
index 0000000000..041fd4ff6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/invoke-as-constructor.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Generator statements cannot be used as constructors.
+es6id: 14.4
+features: [generators]
+---*/
+
+function* g(){}
+
+assert.throws(TypeError, function() {
+ var instance = new g();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/length-dflt.js b/js/src/tests/test262/language/statements/generators/length-dflt.js
new file mode 100644
index 0000000000..1882a29404
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/length-dflt.js
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 14.1.6
+description: >
+ Default parameters' effect on function length
+info: |
+ Function length is counted by the non initialized parameters in the left.
+
+ 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope)
+
+ [...]
+ 2. Let len be the ExpectedArgumentCount of ParameterList.
+ 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]:
+ len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}).
+ [...]
+
+ FormalsList : FormalParameter
+
+ 1. If HasInitializer of FormalParameter is true return 0
+ 2. Return 1.
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let count be the ExpectedArgumentCount of FormalsList.
+ 2. If HasInitializer of FormalsList is true or HasInitializer of
+ FormalParameter is true, return count.
+ 3. Return count+1.
+features: [generators, default-parameters]
+includes: [propertyHelper.js]
+---*/
+
+
+function* f1(x = 42) {}
+
+assert.sameValue(f1.length, 0, 'FormalsList: x = 42');
+verifyNotEnumerable(f1, 'length');
+verifyNotWritable(f1, 'length');
+verifyConfigurable(f1, 'length');
+
+function* f2(x = 42, y) {}
+
+assert.sameValue(f2.length, 0, 'FormalsList: x = 42, y');
+verifyNotEnumerable(f2, 'length');
+verifyNotWritable(f2, 'length');
+verifyConfigurable(f2, 'length');
+
+function* f3(x, y = 42) {}
+
+assert.sameValue(f3.length, 1, 'FormalsList: x, y = 42');
+verifyNotEnumerable(f3, 'length');
+verifyNotWritable(f3, 'length');
+verifyConfigurable(f3, 'length');
+
+function* f4(x, y = 42, z) {}
+
+assert.sameValue(f4.length, 1, 'FormalsList: x, y = 42, z');
+verifyNotEnumerable(f4, 'length');
+verifyNotWritable(f4, 'length');
+verifyConfigurable(f4, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/length-property-descriptor.js b/js/src/tests/test262/language/statements/generators/length-property-descriptor.js
new file mode 100644
index 0000000000..65fd5e811e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/length-property-descriptor.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Generator functions should define a `length` property.
+includes: [propertyHelper.js]
+es6id: 25.2.4
+features: [generators]
+---*/
+
+function* g() {}
+
+assert.sameValue(g.length, 0);
+verifyNotEnumerable(g, 'length');
+verifyNotWritable(g, 'length');
+verifyConfigurable(g, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/name.js b/js/src/tests/test262/language/statements/generators/name.js
new file mode 100644
index 0000000000..4818f0f109
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/name.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Assignment of function `name` attribute
+es6id: 14.4.12
+info: |
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 6. Perform SetFunctionName(F, name).
+includes: [propertyHelper.js]
+features: [generators]
+---*/
+
+function* g() {}
+
+assert.sameValue(g.name, 'g');
+verifyNotEnumerable(g, 'name');
+verifyNotWritable(g, 'name');
+verifyConfigurable(g, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/no-yield.js b/js/src/tests/test262/language/statements/generators/no-yield.js
new file mode 100644
index 0000000000..e7d2aeaefc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/no-yield.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Generators declared with GeneratorDeclaration syntax do not require a
+ `yield` expression.
+es6id: 14.4
+features: [generators]
+---*/
+
+function *foo(a) {}
+
+var g = foo(3);
+
+assert.sameValue(g.next().value, undefined);
+assert.sameValue(g.next().done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/generators/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..1863755399
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/object-destructuring-param-strict-body.js
@@ -0,0 +1,134 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/gen-func-decl.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [rest-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+function* f({property}) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/generators/param-dflt-yield.js b/js/src/tests/test262/language/statements/generators/param-dflt-yield.js
new file mode 100644
index 0000000000..8f3a7ef9bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/param-dflt-yield.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-generator-function-definitions
+es6id: 14.4
+description: >
+ YieldExpression cannot be used within the FormalParameters of a generator
+ function
+info: |
+ GeneratorDeclaration[Yield, Default] :
+ function * BindingIdentifier[?Yield] ( FormalParameters[Yield] ) { GeneratorBody }
+
+ YieldExpression cannot be used within the FormalParameters of a generator
+ function because any expressions that are part of FormalParameters are
+ evaluated before the resulting generator object is in a resumable state.
+features: [generators, default-parameters]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function* g(x = yield) {}
diff --git a/js/src/tests/test262/language/statements/generators/params-dflt-args-unmapped.js b/js/src/tests/test262/language/statements/generators/params-dflt-args-unmapped.js
new file mode 100644
index 0000000000..b1379dcd8d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/params-dflt-args-unmapped.js
@@ -0,0 +1,83 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+es6id: 14.4.12
+features: [generators, default-parameters]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+function* f(x, _ = 0) {
+ assert.sameValue(x, undefined, 'parameter binding value (initial)');
+ assert.sameValue(
+ arguments[0], undefined, 'arguments property value (initial)'
+ );
+
+ arguments[0] = 1;
+
+ assert.sameValue(
+ x, undefined, 'parameter binding value (after arguments modification)'
+ );
+ assert.sameValue(
+ arguments[0], 1, 'arguments property value (after arguments modification)'
+ );
+
+ x = 2;
+
+ assert.sameValue(
+ x, 2, 'parameter binding value (after parameter binding modification)'
+ );
+ assert.sameValue(
+ arguments[0],
+ 1,
+ 'arguments property value (after parameter binding modification)'
+ );
+ callCount = callCount + 1;
+}
+
+f().next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/params-dflt-ref-arguments.js b/js/src/tests/test262/language/statements/generators/params-dflt-ref-arguments.js
new file mode 100644
index 0000000000..bc73a87f35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/params-dflt-ref-arguments.js
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Referencing the arguments object from a default parameter (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+es6id: 14.4.12
+features: [generators, default-parameters]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+---*/
+
+var callCount = 0;
+function* f(x = arguments[2], y = arguments[3], z) {
+ assert.sameValue(x, 'third', 'first parameter');
+ assert.sameValue(y, 'fourth', 'second parameter');
+ assert.sameValue(z, 'third', 'third parameter');
+ callCount = callCount + 1;
+}
+
+f(undefined, undefined, 'third', 'fourth').next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/generators/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..7453319b42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/params-trailing-comma-multiple.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/gen-func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function* ref(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+}
+
+ref(42, 39, 1).next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+assert.sameValue(ref.length, 2, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/generators/params-trailing-comma-single.js
new file mode 100644
index 0000000000..86cf35bb64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/params-trailing-comma-single.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/gen-func-decl.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators]
+flags: [generated]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function* ref(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+}
+
+ref(42, 39).next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+assert.sameValue(ref.length, 1, 'length is properly set');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/prototype-own-properties.js b/js/src/tests/test262/language/statements/generators/prototype-own-properties.js
new file mode 100644
index 0000000000..d3587d0be7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/prototype-own-properties.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.4.2
+description: >
+ The `prototype` property of GeneratorFunction instances are created as
+ plain objects with no "own" properties.
+features: [generators]
+---*/
+
+function* g() {}
+var ownProperties = Object.getOwnPropertyNames(g.prototype);
+assert.sameValue(ownProperties.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/prototype-property-descriptor.js b/js/src/tests/test262/language/statements/generators/prototype-property-descriptor.js
new file mode 100644
index 0000000000..6d34087cfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/prototype-property-descriptor.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Generator objects should define a `prototype` property.
+includes: [propertyHelper.js]
+es6id: 25.2.4
+features: [generators]
+---*/
+
+function* g() {}
+
+verifyNotEnumerable(g, 'prototype');
+verifyWritable(g, 'prototype');
+verifyNotConfigurable(g, 'prototype');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/prototype-relation-to-function.js b/js/src/tests/test262/language/statements/generators/prototype-relation-to-function.js
new file mode 100644
index 0000000000..a5c2b8104c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/prototype-relation-to-function.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The value of the [[Prototype]] internal slot of the GeneratorFunction
+ prototype object is the FunctionPrototype intrinsic object.
+es6id: 25.2.2.2
+features: [generators]
+---*/
+
+function f() {}
+function* g() {}
+
+assert.sameValue(
+ Object.getPrototypeOf(Object.getPrototypeOf(g)),
+ Object.getPrototypeOf(f)
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/prototype-typeof.js b/js/src/tests/test262/language/statements/generators/prototype-typeof.js
new file mode 100644
index 0000000000..f86584d346
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/prototype-typeof.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 25.2.4.2
+description: >
+ Whenever a GeneratorFunction instance is created another ordinary object is
+ also created and is the initial value of the generator function’s prototype
+ property.
+features: [generators]
+---*/
+
+function* g() {}
+assert.sameValue(typeof g.prototype, 'object');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/prototype-uniqueness.js b/js/src/tests/test262/language/statements/generators/prototype-uniqueness.js
new file mode 100644
index 0000000000..adb22b820c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/prototype-uniqueness.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ GeneratorFunction instances are created with a unique prototype object.
+es6id: 25.2.1
+features: [generators]
+---*/
+
+function* g1() {}
+function* g2() {}
+
+assert(g1.prototype !== g2.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/prototype-value.js b/js/src/tests/test262/language/statements/generators/prototype-value.js
new file mode 100644
index 0000000000..1cd94ba4e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/prototype-value.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Generator instances directly inherit properties from the object that is the
+ value of the prototype property of the Generator function that created the
+ instance.
+es6id: 25.3
+features: [generators]
+---*/
+
+function* g() {}
+
+assert.sameValue(
+ Object.getPrototypeOf(g()),
+ g.prototype,
+ 'Instance created via function invocation'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/rest-param-strict-body.js b/js/src/tests/test262/language/statements/generators/rest-param-strict-body.js
new file mode 100644
index 0000000000..9d84869552
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/rest-param-strict-body.js
@@ -0,0 +1,134 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/gen-func-decl.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [rest-parameters, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+function* f(a,...rest) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/generators/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/generators/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..60f52da105
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,60 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/gen-func-decl.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+function* f(...a,) {
+
+}
diff --git a/js/src/tests/test262/language/statements/generators/restricted-properties.js b/js/src/tests/test262/language/statements/generators/restricted-properties.js
new file mode 100644
index 0000000000..262e6d762b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/restricted-properties.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Functions created using GeneratorFunction syntactic form do not have own
+ properties "caller" or "arguments", but inherit them from
+ %FunctionPrototype%.
+features: [generators]
+---*/
+
+function* generator() {}
+
+assert.sameValue(
+ generator.hasOwnProperty('caller'), false, 'No "caller" own property'
+);
+assert.sameValue(
+ generator.hasOwnProperty('arguments'), false, 'No "arguments" own property'
+);
+
+assert.throws(TypeError, function() {
+ return generator.caller;
+});
+
+assert.throws(TypeError, function() {
+ generator.caller = {};
+});
+
+assert.throws(TypeError, function() {
+ return generator.arguments;
+});
+
+assert.throws(TypeError, function() {
+ generator.arguments = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/return.js b/js/src/tests/test262/language/statements/generators/return.js
new file mode 100644
index 0000000000..cf1f53d0cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/return.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ return is a valid statement within generator function bodies.
+es6id: 14.4
+features: [generators]
+---*/
+
+function* g1() { return; }
+function* g2() { return 1; }
+
+var result = g1().next();
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+result = g2().next();
+assert.sameValue(result.value, 1);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/scope-body-lex-distinct.js b/js/src/tests/test262/language/statements/generators/scope-body-lex-distinct.js
new file mode 100644
index 0000000000..8a7a034473
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/scope-body-lex-distinct.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new lexical environment (distinct from the variable
+ environment) for the function body outside of strict mode
+info: |
+ [...]
+ 29. If strict is false, then
+ a. Let lexEnv be NewDeclarativeEnvironment(varEnv).
+ b. NOTE: Non-strict functions use a separate lexical Environment Record
+ for top-level lexical declarations so that a direct eval can
+ determine whether any var scoped declarations introduced by the eval
+ code conflict with pre-existing top-level lexically scoped
+ declarations. This is not needed for strict functions because a
+ strict direct eval always places all declarations into a new
+ Environment Record.
+ [...]
+
+ 18.2.1.3 Runtime Semantics: EvalDeclarationInstantiation
+
+ [...]
+ 5. If strict is false, then
+ [...]
+ b. Let thisLex be lexEnv.
+ c. Assert: The following loop will terminate.
+ d. Repeat while thisLex is not the same as varEnv,
+ i. Let thisEnvRec be thisLex's EnvironmentRecord.
+ ii. If thisEnvRec is not an object Environment Record, then
+ 1. NOTE: The environment of with statements cannot contain any
+ lexical declaration so it doesn't need to be checked for
+ var/let hoisting conflicts.
+ 2. For each name in varNames, do
+ a. If thisEnvRec.HasBinding(name) is true, then
+ i. Throw a SyntaxError exception.
+ ii. NOTE: Annex B.3.5 defines alternate semantics for the
+ above step.
+ b. NOTE: A direct eval will not hoist var declaration over a
+ like-named lexical declaration.
+ iii. Let thisLex be thisLex's outer environment reference.
+flags: [noStrict]
+features: [generators, let]
+---*/
+
+function* g() {
+ let x;
+ eval('var x;');
+}
+var iter = g();
+
+assert.throws(SyntaxError, function() {
+ iter.next();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/scope-param-elem-var-close.js b/js/src/tests/test262/language/statements/generators/scope-param-elem-var-close.js
new file mode 100644
index 0000000000..7dcb433ee9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/scope-param-elem-var-close.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ sloppy direct evals in params introduce vars
+info: |
+ [...]
+ 20. Else,
+ a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
+ b. Let calleeEnv be the LexicalEnvironment of calleeContext.
+ c. Let env be NewDeclarativeEnvironment(calleeEnv).
+ d. Let envRec be env's EnvironmentRecord.
+ [...]
+flags: [noStrict]
+features: [generators]
+---*/
+
+var x = 'outside';
+var probe1, probe2, probeBody;
+
+function* g(
+ _ = (eval('var x = "inside";'), probe1 = function() { return x; }),
+ __ = probe2 = function() { return x; }
+ ) {
+ probeBody = function() { return x; };
+}
+g().next();
+
+assert.sameValue(probe1(), 'inside');
+assert.sameValue(probe2(), 'inside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/scope-param-elem-var-open.js b/js/src/tests/test262/language/statements/generators/scope-param-elem-var-open.js
new file mode 100644
index 0000000000..aef1e39ce6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/scope-param-elem-var-open.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ sloppy direct evals in params introduce vars
+info: |
+ [...]
+ 20. Else,
+ a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
+ b. Let calleeEnv be the LexicalEnvironment of calleeContext.
+ c. Let env be NewDeclarativeEnvironment(calleeEnv).
+ d. Let envRec be env's EnvironmentRecord.
+ [...]
+flags: [noStrict]
+features: [generators]
+---*/
+
+var x = 'outside';
+var probe1, probe2;
+
+function* g(
+ _ = probe1 = function() { return x; },
+ __ = (eval('var x = "inside";'), probe2 = function() { return x; })
+ ) {
+}
+g().next();
+
+assert.sameValue(probe1(), 'inside');
+assert.sameValue(probe2(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/scope-param-rest-elem-var-close.js b/js/src/tests/test262/language/statements/generators/scope-param-rest-elem-var-close.js
new file mode 100644
index 0000000000..84cc0d71b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/scope-param-rest-elem-var-close.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ sloppy direct evals in params introduce vars
+info: |
+ [...]
+ 20. Else,
+ a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
+ b. Let calleeEnv be the LexicalEnvironment of calleeContext.
+ c. Let env be NewDeclarativeEnvironment(calleeEnv).
+ d. Let envRec be env's EnvironmentRecord.
+ [...]
+flags: [noStrict]
+features: [generators]
+---*/
+
+var x = 'outside';
+var probeParam, probeBody;
+
+function* g(
+ ...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })]
+ ) {
+ probeBody = function() { return x; }
+}
+g().next();
+
+assert.sameValue(probeParam(), 'inside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/scope-param-rest-elem-var-open.js b/js/src/tests/test262/language/statements/generators/scope-param-rest-elem-var-open.js
new file mode 100644
index 0000000000..a7e8e00a50
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/scope-param-rest-elem-var-open.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ sloppy direct evals in params introduce vars
+info: |
+ [...]
+ 20. Else,
+ a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
+ b. Let calleeEnv be the LexicalEnvironment of calleeContext.
+ c. Let env be NewDeclarativeEnvironment(calleeEnv).
+ d. Let envRec be env's EnvironmentRecord.
+ [...]
+flags: [noStrict]
+features: [generators]
+---*/
+
+var x = 'outside';
+var probe1, probe2;
+
+function* g(
+ _ = probe1 = function() { return x; },
+ ...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })]
+ ) {
+}
+g().next();
+
+assert.sameValue(probe1(), 'inside');
+assert.sameValue(probe2(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/scope-paramsbody-var-close.js b/js/src/tests/test262/language/statements/generators/scope-paramsbody-var-close.js
new file mode 100644
index 0000000000..64de0d62d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/scope-paramsbody-var-close.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Disposal of variable environment for the function body
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+features: [generators]
+---*/
+
+var probe;
+
+// A parameter expression is necessary to trigger the creation of the scope
+// under test.
+function* g(_ = null) {
+ var x = 'inside';
+ probe = function() { return x; };
+}
+g().next();
+
+var x = 'outside';
+
+assert.sameValue(probe(), 'inside');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/scope-paramsbody-var-open.js b/js/src/tests/test262/language/statements/generators/scope-paramsbody-var-open.js
new file mode 100644
index 0000000000..ac1ae44c34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/scope-paramsbody-var-open.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-functiondeclarationinstantiation
+description: >
+ Creation of new variable environment for the function body (as distinct from
+ that for the function's parameters)
+info: |
+ [...]
+ 26. If hasParameterExpressions is false, then
+ [...]
+ 27. Else,
+ a. NOTE A separate Environment Record is needed to ensure that closures
+ created by expressions in the formal parameter list do not have
+ visibility of declarations in the function body.
+ b. Let varEnv be NewDeclarativeEnvironment(env).
+ c. Let varEnvRec be varEnv's EnvironmentRecord.
+ d. Set the VariableEnvironment of calleeContext to varEnv.
+ e. Let instantiatedVarNames be a new empty List.
+ [...]
+features: [generators]
+---*/
+
+var x = 'outside';
+var probeParams, probeBody;
+
+function* g(_ = probeParams = function() { return x; }) {
+ var x = 'inside';
+ probeBody = function() { return x; };
+}
+g().next();
+
+assert.sameValue(probeParams(), 'outside');
+assert.sameValue(probeBody(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/shell.js b/js/src/tests/test262/language/statements/generators/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/shell.js
diff --git a/js/src/tests/test262/language/statements/generators/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/statements/generators/unscopables-with-in-nested-fn.js
new file mode 100644
index 0000000000..e63d6c3998
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/unscopables-with-in-nested-fn.js
@@ -0,0 +1,104 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with-in-nested-fn.case
+// - src/function-forms/default/gen-func-decl.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [globalThis, Symbol.unscopables, generators]
+flags: [generated, noStrict]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function* ref(x) {
+ (function() {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ }
+ })();
+ (function() {
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ })();
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+}
+
+ref(10).next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/unscopables-with.js b/js/src/tests/test262/language/statements/generators/unscopables-with.js
new file mode 100644
index 0000000000..dd6b4f414d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/unscopables-with.js
@@ -0,0 +1,98 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with.case
+// - src/function-forms/default/gen-func-decl.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (generator function declaration)
+esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject
+features: [globalThis, Symbol.unscopables, generators]
+flags: [generated, noStrict]
+info: |
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ [...]
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ [...]
+
+ 9.2.1 [[Call]] ( thisArgument, argumentsList)
+
+ [...]
+ 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
+ [...]
+
+ 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
+
+ 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
+ [...]
+
+ 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
+
+ [...]
+ 23. Let iteratorRecord be Record {[[iterator]]:
+ CreateListIterator(argumentsList), [[done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ b. Let formalStatus be IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+var callCount = 0;
+// Stores a reference `ref` for case evaluation
+function* ref(x) {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
+ }
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+}
+
+ref(10).next();
+
+assert.sameValue(callCount, 1, 'generator function invoked exactly once');
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/use-strict-with-non-simple-param.js b/js/src/tests/test262/language/statements/generators/use-strict-with-non-simple-param.js
new file mode 100644
index 0000000000..3ae57eded4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/use-strict-with-non-simple-param.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-generator-function-definitions-static-semantics-early-errors
+description: >
+ A SyntaxError is thrown if a generator contains a non-simple parameter list and a UseStrict directive.
+info: |
+ Static Semantics: Early Errors
+
+ It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and IsSimpleParameterList of FormalParameters is false.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+function* f(a = 0) {
+ "use strict";
+}
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/generators/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..edad56157b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier-escaped.case
+// - src/generators/syntax/declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+function *gen() {
+ var yi\u0065ld;
+}
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/generators/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..7837b6f9a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-binding-identifier.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-binding-identifier.case
+// - src/generators/syntax/declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+function *gen() {
+ var yield;
+}
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-function-expression-binding-identifier.js b/js/src/tests/test262/language/statements/generators/yield-as-function-expression-binding-identifier.js
new file mode 100644
index 0000000000..dae59de887
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-function-expression-binding-identifier.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` may be used as the binding identifier of a function expression
+ within generator bodies.
+es6id: 14.1
+flags: [noStrict]
+features: [generators]
+---*/
+
+var result;
+function* g() {
+ (function yield() {})
+}
+
+result = g().next();
+
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-generator-declaration-binding-identifier.js b/js/src/tests/test262/language/statements/generators/yield-as-generator-declaration-binding-identifier.js
new file mode 100644
index 0000000000..26d6f54d2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-generator-declaration-binding-identifier.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` is a valid BindingIdentifier for GeneratorDeclarations outside of
+ strict mode.
+es6id: 12.1.1
+flags: [noStrict]
+features: [generators]
+---*/
+
+var iter, result;
+function* yield() { (yield 3) + (yield 4); }
+
+iter = yield();
+
+result = iter.next();
+assert.sameValue(result.value, 3, 'First result `value`');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, 4, 'Second result `value`');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'Third result `value`');
+assert.sameValue(result.done, true, 'Third result `done` flag');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-identifier-in-nested-function.js b/js/src/tests/test262/language/statements/generators/yield-as-identifier-in-nested-function.js
new file mode 100644
index 0000000000..3d55989017
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-identifier-in-nested-function.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` is not a reserved keyword within normal function bodies declared
+ within generator function bodies.
+es6id: 12.1.1
+flags: [noStrict]
+features: [generators]
+---*/
+
+var result;
+function* g() {
+ function h() {
+ yield = 1;
+ }
+}
+
+result = g().next();
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/generators/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..22c7c171f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference-escaped.case
+// - src/generators/syntax/declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+function *gen() {
+ void yi\u0065ld;
+}
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/generators/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..c38aa16c56
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-identifier-reference.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-identifier-reference.case
+// - src/generators/syntax/declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+function *gen() {
+ void yield;
+}
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/generators/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..f596b33410
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-label-identifier-escaped.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier-escaped.case
+// - src/generators/syntax/declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+function *gen() {
+ yi\u0065ld: ;
+}
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/generators/yield-as-label-identifier.js
new file mode 100644
index 0000000000..504094f0ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-label-identifier.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-as-label-identifier.case
+// - src/generators/syntax/declaration.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+function *gen() {
+ yield: ;
+}
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-literal-property-name.js b/js/src/tests/test262/language/statements/generators/yield-as-literal-property-name.js
new file mode 100644
index 0000000000..325bccfba7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-literal-property-name.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` may be used as a literal property name in an object literal
+ within generator function bodies.
+es6id: 12.1.1
+features: [generators]
+---*/
+
+var result;
+function* g() {
+ ({ get yield() { return 1 } });
+}
+
+result = g().next();
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-logical-or-expression.js b/js/src/tests/test262/language/statements/generators/yield-as-logical-or-expression.js
new file mode 100644
index 0000000000..de91cb5cba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-logical-or-expression.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` expressions are not LogicalOrExpressions.
+es6id: 12.1.1
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+
+function* g() {
+ yield ? yield : yield
+}
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-parameter.js b/js/src/tests/test262/language/statements/generators/yield-as-parameter.js
new file mode 100644
index 0000000000..84425578a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-parameter.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` is a reserved keyword within generator function bodies and may
+ not be used as the binding identifier of a parameter.
+es6id: 12.1.1
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+function* g(yield) {}
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-property-name.js b/js/src/tests/test262/language/statements/generators/yield-as-property-name.js
new file mode 100644
index 0000000000..5593f8f437
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-property-name.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` may be used as a literal property name in an object literal
+ within generator function bodies.
+es6id: 12.1.1
+features: [generators]
+---*/
+
+var result;
+function* g() {
+ ({ yield: 1 });
+}
+
+result = g().next();
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-statement.js b/js/src/tests/test262/language/statements/generators/yield-as-statement.js
new file mode 100644
index 0000000000..98f7b51a04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-statement.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` is a valid statement within generator function bodies.
+es6id: 14.4
+features: [generators]
+---*/
+
+var iter, result;
+function* g1() { yield; }
+function* g2() { yield 1; }
+
+iter = g1();
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Without right-hand-side: first result `value`'
+);
+assert.sameValue(
+ result.done, false, 'Without right-hand-side: first result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'Without right-hand-side: second result `value`'
+);
+assert.sameValue(
+ result.done, true, 'Without right-hand-eside: second result `done` flag'
+);
+
+iter = g2();
+result = iter.next();
+assert.sameValue(
+ result.value, 1, 'With right-hand-side: first result `value`'
+);
+assert.sameValue(
+ result.done, false, 'With right-hand-side: first result `done` flag'
+);
+result = iter.next();
+assert.sameValue(
+ result.value, undefined, 'With right-hand-side: second result `value`'
+);
+assert.sameValue(
+ result.done, true, 'With right-hand-eside: second result `done` flag'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-as-yield-operand.js b/js/src/tests/test262/language/statements/generators/yield-as-yield-operand.js
new file mode 100644
index 0000000000..6c4ecfd004
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-as-yield-operand.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` expressions may be used as the right-hand-side of other `yield`
+ expressions.
+es6id: 14.4
+features: [generators]
+---*/
+
+var iter, result;
+function* g() {
+ yield yield 1;
+}
+
+iter = g();
+
+result = iter.next();
+assert.sameValue(result.value, 1, 'First result `value`');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'Second result `value`');
+assert.sameValue(result.done, false, 'Second result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'Third result `value`');
+assert.sameValue(result.done, true, 'Thid result `done` flag');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-identifier-non-strict.js b/js/src/tests/test262/language/statements/generators/yield-identifier-non-strict.js
new file mode 100644
index 0000000000..d10a2b6ec7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-identifier-non-strict.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-non-strict.case
+// - src/generators/non-strict/declaration.template
+/*---
+description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Generator function declaration - valid for non-strict only cases)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated, noStrict]
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration[Yield, Await, Default]:
+ function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
+
+---*/
+
+var callCount = 0;
+
+function *gen() {
+ callCount += 1;
+ return (function(arg) {
+ var yield = arg + 1;
+ return yield;
+ }(yield))
+}
+
+var iter = gen();
+
+var item = iter.next();
+
+assert.sameValue(item.done, false);
+assert.sameValue(item.value, undefined);
+
+item = iter.next(42);
+
+assert.sameValue(item.done, true);
+assert.sameValue(item.value, 43);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-identifier-spread-non-strict.js b/js/src/tests/test262/language/statements/generators/yield-identifier-spread-non-strict.js
new file mode 100644
index 0000000000..824ea2f763
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-identifier-spread-non-strict.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-spread-non-strict.case
+// - src/generators/non-strict/declaration.template
+/*---
+description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Generator function declaration - valid for non-strict only cases)
+esid: prod-GeneratorDeclaration
+features: [Symbol, object-spread, generators]
+flags: [generated, noStrict]
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration[Yield, Await, Default]:
+ function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+var s = Symbol('s');
+
+var callCount = 0;
+
+function *gen() {
+ callCount += 1;
+ yield {
+ ...yield yield,
+ ...(function(arg) {
+ var yield = arg;
+ return {...yield};
+ }(yield)),
+ ...yield,
+ }
+}
+
+var iter = gen();
+
+var iter = gen();
+
+iter.next();
+iter.next();
+iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
+iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
+var item = iter.next({ z: 30, b: 2 });
+
+var value = item.value;
+
+assert.sameValue(item.done, false);
+assert.sameValue(value.x, 10);
+assert.sameValue(value.y, 20);
+assert.sameValue(value.z, 30);
+assert.sameValue(value.a, 1);
+assert.sameValue(value.b, 2);
+assert.sameValue(value[s], 42);
+assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property");
+assert.sameValue(Object.keys(value).length, 5);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/generators/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..98f1951839
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,46 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-spread-strict.case
+// - src/generators/default/declaration.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [object-spread, generators]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+function *gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+}
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/generators/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/generators/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..ecda48bd3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-identifier-strict-strict.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-identifier-strict.case
+// - src/generators/default/declaration.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+var callCount = 0;
+
+function *gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+}
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/generators/yield-newline.js b/js/src/tests/test262/language/statements/generators/yield-newline.js
new file mode 100644
index 0000000000..c1d8cc0912
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-newline.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Newlines terminate `yield` expressions.
+es6id: 14.4
+features: [generators]
+---*/
+
+var iter, result;
+function* g() {
+ yield
+ 1
+}
+
+iter = g();
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'First result `value`');
+assert.sameValue(result.done, false, 'First result `done` flag');
+
+result = iter.next();
+assert.sameValue(result.value, undefined, 'Second result `value`');
+assert.sameValue(result.done, true, 'Second result `done` flag');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/generators/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..25a835d11e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-spread-arr-multiple.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-multiple.case
+// - src/generators/default/declaration.template
+/*---
+description: Use yield value in a array spread position (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+var callCount = 0;
+
+function *gen() {
+ callCount += 1;
+ yield [...yield yield];
+}
+
+var iter = gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+item = iter.next(item.value);
+
+assert.compareArray(item.value, arr);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/generators/yield-spread-arr-single.js
new file mode 100644
index 0000000000..1390c8fff1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-spread-arr-single.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-arr-single.case
+// - src/generators/default/declaration.template
+/*---
+description: Use yield value in a array spread position (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [generators]
+flags: [generated]
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+---*/
+var arr = ['a', 'b', 'c'];
+
+var callCount = 0;
+
+function *gen() {
+ callCount += 1;
+ yield [...yield];
+}
+
+var iter = gen();
+
+iter.next(false);
+var item = iter.next(arr);
+var value = item.value;
+
+assert.notSameValue(value, arr, 'value is a new array');
+assert(Array.isArray(value), 'value is an Array exotic object');
+assert.sameValue(value.length, 3)
+assert.sameValue(value[0], 'a');
+assert.sameValue(value[1], 'b');
+assert.sameValue(value[2], 'c');
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-spread-obj.js b/js/src/tests/test262/language/statements/generators/yield-spread-obj.js
new file mode 100644
index 0000000000..d6c728a2a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-spread-obj.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/generators/yield-spread-obj.case
+// - src/generators/default/declaration.template
+/*---
+description: Use yield value in a object spread position (Generator Function declaration)
+esid: prod-GeneratorDeclaration
+features: [object-spread, generators]
+flags: [generated]
+info: |
+ 14.4 Generator Function Definitions
+
+ GeneratorDeclaration :
+ function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+var callCount = 0;
+
+function *gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+}
+
+var iter = gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+assert.sameValue(item.value.x, 42);
+assert.sameValue(item.value.y, 39);
+assert.sameValue(Object.keys(item.value).length, 2);
+assert.sameValue(item.done, false);
+
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-star-after-newline.js b/js/src/tests/test262/language/statements/generators/yield-star-after-newline.js
new file mode 100644
index 0000000000..74ad568b7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-star-after-newline.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ A newline may not precede the `*` token in a `yield` expression.
+es6id: 14.4
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+function* g() {
+ yield
+ * 1
+}
diff --git a/js/src/tests/test262/language/statements/generators/yield-star-before-newline.js b/js/src/tests/test262/language/statements/generators/yield-star-before-newline.js
new file mode 100644
index 0000000000..1cd8fa188e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-star-before-newline.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The right-hand side of a `yield *` expression may appear on a new line.
+es6id: 14.4
+features: [generators]
+---*/
+
+var result;
+function* g() {
+ yield *
+ g2();
+}
+function* g2() {}
+
+result = g().next();
+assert.sameValue(result.value, undefined);
+assert.sameValue(result.done, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/generators/yield-weak-binding.js b/js/src/tests/test262/language/statements/generators/yield-weak-binding.js
new file mode 100644
index 0000000000..457290d102
--- /dev/null
+++ b/js/src/tests/test262/language/statements/generators/yield-weak-binding.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ `yield` expressions bind weakly
+es6id: 14.4
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+function* g() { yield 3 + yield 4; }
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A1.1_T1.js b/js/src/tests/test262/language/statements/if/S12.5_A1.1_T1.js
new file mode 100644
index 0000000000..11708598fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A1.1_T1.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 0, null, undefined, false, empty string, NaN in expression is evaluated
+ to false
+es5id: 12.5_A1.1_T1
+description: Using "if" without "else" construction
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+
+if(0)
+ throw new Test262Error('#1: 0 in expression is evaluated to false ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(false)
+ throw new Test262Error('#2: false in expression is evaluated to false ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(null)
+ throw new Test262Error('#3: null in expression is evaluated to false ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(undefined)
+ throw new Test262Error('#4: undefined in expression is evaluated to false ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if("")
+ throw new Test262Error('#5: empty string in expression is evaluated to false ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#6
+if(NaN)
+ throw new Test262Error('#5: NaN in expression is evaluated to false ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A1.1_T2.js b/js/src/tests/test262/language/statements/if/S12.5_A1.1_T2.js
new file mode 100644
index 0000000000..f1d01e944e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A1.1_T2.js
@@ -0,0 +1,73 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 0, null, undefined, false, empty string, NaN in expression is evaluated
+ to false
+es5id: 12.5_A1.1_T2
+description: Using "if/else" construction
+---*/
+
+var c=0;
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(0)
+ throw new Test262Error('#1.1: 0 in expression is evaluated to false ');
+else
+ c++;
+if (c!=1) throw new Test262Error('#1.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(false)
+ throw new Test262Error('#2.1: false in expression is evaluated to false ');
+else
+ c++;
+if (c!=2) throw new Test262Error('#2.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(null)
+ throw new Test262Error('#3.1: null in expression is evaluated to false ');
+else
+ c++;
+if (c!=3) throw new Test262Error('#3.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(undefined)
+ throw new Test262Error('#4.1: undefined in expression is evaluated to false ');
+else
+ c++;
+if (c!=4) throw new Test262Error('#4.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if("")
+ throw new Test262Error('#5.1: empty string in expression is evaluated to false ');
+else
+ c++;
+if (c!=5) throw new Test262Error('#5.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#6
+if(NaN)
+ throw new Test262Error('#6.1: NaN in expression is evaluated to false ');
+else
+ c++;
+if (c!=6) throw new Test262Error('#6.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A1.2_T1.js b/js/src/tests/test262/language/statements/if/S12.5_A1.2_T1.js
new file mode 100644
index 0000000000..9c89635145
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A1.2_T1.js
@@ -0,0 +1,75 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 1, true, non-empty string and others in expression is evaluated to true
+ when using operator "new"
+es5id: 12.5_A1.2_T1
+description: Using "if" without "else" construction
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(!(new Number(1)))
+ throw new Test262Error('#1: new 1 in expression is evaluated to true');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(!(new Boolean(true)))
+ throw new Test262Error('#2: new true in expression is evaluated to true');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(!(new String("1")))
+ throw new Test262Error('#3: new "1" in expression is evaluated to true');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(!(new String("A")))
+ throw new Test262Error('#4: new "A" in expression is evaluated to true');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if(!(new Boolean(false)))
+ throw new Test262Error('#2: new false in expression is evaluated to true ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#6
+if(!(new Number(NaN)))
+ throw new Test262Error('#6: new NaN in expression is evaluated to true ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#7
+if(!(new Number(null)))
+ throw new Test262Error('#7: new null in expression is evaluated to true ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#8
+if(!(new String(undefined)))
+ throw new Test262Error('#8: new undefined in expression is evaluated to true ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#9
+if(!(new String("")))
+ throw new Test262Error('#9: new empty string in expression is evaluated to true ');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A1.2_T2.js b/js/src/tests/test262/language/statements/if/S12.5_A1.2_T2.js
new file mode 100644
index 0000000000..278f576964
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A1.2_T2.js
@@ -0,0 +1,103 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ 1, true, non-empty string and others in expression is evaluated to true
+ when using operator "new"
+es5id: 12.5_A1.2_T2
+description: Using "if/else" construction
+---*/
+
+var c=0;
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(!(new Number(1)))
+ throw new Test262Error('#1.1: new 1 in expression is evaluated to true');
+else
+ c++;
+if (c!=1) throw new Test262Error('#1.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(!(new Boolean(true)))
+ throw new Test262Error('#2.1: new true in expression is evaluated to true');
+else
+ c++;
+if (c!=2) throw new Test262Error('#2.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(!(new String("1")))
+ throw new Test262Error('#3.1: new "1" in expression is evaluated to true');
+else
+ c++;
+if (c!=3) throw new Test262Error('#3.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(!(new String("A")))
+ throw new Test262Error('#4.1: new "A" in expression is evaluated to true');
+else
+ c++;
+if (c!=4) throw new Test262Error('#4.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if(!(new Boolean(false)))
+ throw new Test262Error('#5.1: new false in expression is evaluated to true ');
+else
+ c++;
+if (c!=5) throw new Test262Error('#5.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#6
+if(!(new Number(NaN)))
+ throw new Test262Error('#6.1: new NaN in expression is evaluated to true ');
+else
+ c++;
+if (c!=6) throw new Test262Error('#6.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#7
+if(!(new Number(null)))
+ throw new Test262Error('#7.1: new null in expression is evaluated to true ');
+else
+ c++;
+if (c!=7) throw new Test262Error('#7.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#8
+if(!(new String(undefined)))
+ throw new Test262Error('#8.1: new undefined in expression is evaluated to true ');
+else
+ c++;
+if (c!=8) throw new Test262Error('#8.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#9
+if(!(new String("")))
+ throw new Test262Error('#9.1: new empty string in expression is evaluated to true ');
+else
+ c++;
+if (c!=9) throw new Test262Error('#9.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A10_T1.js b/js/src/tests/test262/language/statements/if/S12.5_A10_T1.js
new file mode 100644
index 0000000000..144ec51b96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A10_T1.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function expession inside the "if" expression is allowed
+es5id: 12.5_A10_T1
+description: >
+ Using function expession(function __func(){return 0;}) inside the
+ "if" expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+if(function __func(){return 0;}){
+ ;
+}else {
+ throw new Test262Error('#1: Function expession inside the "if" expression is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A10_T2.js b/js/src/tests/test262/language/statements/if/S12.5_A10_T2.js
new file mode 100644
index 0000000000..b919216368
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A10_T2.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Function expession inside the "if" expression is allowed
+es5id: 12.5_A10_T2
+description: >
+ Using function expession "function __func(){return 0;}()" within
+ "if" expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+if(function __func(){return 0;}()){
+ throw new Test262Error('#1: Function expession inside the if expression is allowed');
+}else {
+ ;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A11.js b/js/src/tests/test262/language/statements/if/S12.5_A11.js
new file mode 100644
index 0000000000..8e7c8d4c62
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A11.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "{} within the \"if\" expression is not allowed"
+es5id: 12.5_A11
+description: Checking if execution of "if({1})" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+if({1})
+ {
+ ;
+ }else
+ {
+ ;
+ }
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A12_T1.js b/js/src/tests/test262/language/statements/if/S12.5_A12_T1.js
new file mode 100644
index 0000000000..b8750c099f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A12_T1.js
@@ -0,0 +1,58 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Embedded "if/else" constructions are allowed
+es5id: 12.5_A12_T1
+description: Using embedded "if/else" into "if/else" constructions
+---*/
+
+//CHECK# 1
+if(true)
+ if (false)
+ throw new Test262Error('#1.1: At embedded "if/else" constructions engine must select right branches');
+ else
+ ;
+else
+ if (true)
+ throw new Test262Error('#1.2: At embedded "if/else" constructions engine must select right branches');
+ else
+ throw new Test262Error('#1.3: At embedded "if/else" constructions engine must select right branches');
+
+//CHECK# 2
+if(true)
+ if (true)
+ ;
+ else
+ throw new Test262Error('#2.1: At embedded "if/else" constructions engine must select right branches');
+else
+ if (true)
+ throw new Test262Error('#2.2: At embedded "if/else" constructions engine must select right branches');
+ else
+ throw new Test262Error('#2.3: At embedded "if/else" constructions engine must select right branches');
+
+//CHECK# 3
+if(false)
+ if (true)
+ throw new Test262Error('#3.1: At embedded "if/else" constructions engine must select right branches');
+ else
+ throw new Test262Error('#3.2: At embedded "if/else" constructions engine must select right branches');
+else
+ if (true)
+ ;
+ else
+ throw new Test262Error('#3.3: At embedded "if/else" constructions engine must select right branches');
+
+//CHECK# 4
+if(false)
+ if (true)
+ throw new Test262Error('#4.1: At embedded "if/else" constructions engine must select right branches');
+ else
+ throw new Test262Error('#4.2: At embedded "if/else" constructions engine must select right branches');
+else
+ if (false)
+ throw new Test262Error('#4.3: At embedded "if/else" constructions engine must select right branches');
+ else
+ ;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A12_T2.js b/js/src/tests/test262/language/statements/if/S12.5_A12_T2.js
new file mode 100644
index 0000000000..34ec99c3c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A12_T2.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Embedded "if/else" constructions are allowed
+es5id: 12.5_A12_T2
+description: Using embedded "if" into "if/else" constructions
+---*/
+
+//CHECK# 1
+if(true){
+ if (false)
+ throw new Test262Error('#1.1: At embedded "if/else" constructions engine must select right branches');
+}
+else{
+ if (true)
+ throw new Test262Error('#1.2: At embedded "if/else" constructions engine must select right branches');
+}
+
+//CHECK# 2
+if(true){
+ if (true)
+ ;
+}
+else{
+ if (true)
+ throw new Test262Error('#2.2: At embedded "if/else" constructions engine must select right branches');
+}
+
+//CHECK# 3
+if(false){
+ if (true)
+ throw new Test262Error('#3.1: At embedded "if/else" constructions engine must select right branches');
+}
+else{
+ if (true)
+ ;
+}
+
+//CHECK# 4
+if(false){
+ if (true)
+ throw new Test262Error('#4.1: At embedded "if/else" constructions engine must select right branches');
+}
+else{
+ if (false)
+ throw new Test262Error('#4.3: At embedded "if/else" constructions engine must select right branches');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A12_T3.js b/js/src/tests/test262/language/statements/if/S12.5_A12_T3.js
new file mode 100644
index 0000000000..f068501d2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A12_T3.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Embedded "if/else" constructions are allowed
+es5id: 12.5_A12_T3
+description: Using embedded "if/else" into "if" without "else" constructions
+---*/
+
+//CHECK# 1
+if(true)
+ if (false)
+ throw new Test262Error('#1.1: At embedded "if/else" constructions engine must select right branches');
+ else
+ ;
+
+//CHECK# 2
+if(true)
+ if (true)
+ ;
+ else
+ throw new Test262Error('#2.1: At embedded "if/else" constructions engine must select right branches');
+
+//CHECK# 3
+if(false)
+ if (true)
+ throw new Test262Error('#3.1: At embedded "if/else" constructions engine must select right branches');
+ else
+ throw new Test262Error('#3.2: At embedded "if/else" constructions engine must select right branches');
+
+//CHECK# 4
+if(false)
+ if (true)
+ throw new Test262Error('#4.1: At embedded "if/else" constructions engine must select right branches');
+ else
+ throw new Test262Error('#4.2: At embedded "if/else" constructions engine must select right branches');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A12_T4.js b/js/src/tests/test262/language/statements/if/S12.5_A12_T4.js
new file mode 100644
index 0000000000..5933e1d092
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A12_T4.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Embedded "if/else" constructions are allowed
+es5id: 12.5_A12_T4
+description: Using embedded "if" into "if" constructions
+---*/
+
+//CHECK# 1
+if(true)
+ if (false)
+ throw new Test262Error('#1.1: At embedded "if/else" constructions engine must select right branches');
+
+//CHECK# 2
+var c=0;
+if(true)
+ if (true)
+ c=2;
+if (c!==2)
+ throw new Test262Error('#2: At embedded "if/else" constructions engine must select right branches');
+
+//CHECK# 3
+if(false)
+ if (true)
+ throw new Test262Error('#3.1: At embedded "if/else" constructions engine must select right branches');
+
+//CHECK# 4
+if(false)
+ if (true)
+ throw new Test262Error('#4.1: At embedded "if/else" constructions engine must select right branches');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A1_T1.js b/js/src/tests/test262/language/statements/if/S12.5_A1_T1.js
new file mode 100644
index 0000000000..45b7820749
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A1_T1.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: 1, true, non-empty string in expression is evaluated to true
+es5id: 12.5_A1_T1
+description: Using "if" without "else" construction
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(!(1))
+ throw new Test262Error('#1: 1 in expression is evaluated to true');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(!(true))
+ throw new Test262Error('#2: true in expression is evaluated to true');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(!("1"))
+ throw new Test262Error('#3: "1" in expression is evaluated to true');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(!("A"))
+ throw new Test262Error('#4: "A" in expression is evaluated to true');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A1_T2.js b/js/src/tests/test262/language/statements/if/S12.5_A1_T2.js
new file mode 100644
index 0000000000..fb80e18739
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A1_T2.js
@@ -0,0 +1,51 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: 1, true, non-empty string in expression is evaluated to true
+es5id: 12.5_A1_T2
+description: Using "if/else" construction
+---*/
+
+var c=0;
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(!(1))
+ throw new Test262Error('#1.1: 1 in expression is evaluated to true');
+else
+ c++;
+if (c!=1) throw new Test262Error('#1.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(!(true))
+ throw new Test262Error('#2.1: true in expression is evaluated to true');
+else
+ c++;
+if (c!=2) throw new Test262Error('#2.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(!("1"))
+ throw new Test262Error('#3.1: "1" in expression is evaluated to true');
+else
+ c++;
+if (c!=3) throw new Test262Error('#3.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(!("A"))
+ throw new Test262Error('#4.1: "A" in expression is evaluated to true');
+else
+ c++;
+if (c!=4) throw new Test262Error('#4.2: else branch don`t execute');
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A2.js b/js/src/tests/test262/language/statements/if/S12.5_A2.js
new file mode 100644
index 0000000000..cdd6ee9cad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A2.js
@@ -0,0 +1,15 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: In the "if" Statement eval in Expression is admitted
+es5id: 12.5_A2
+description: Checking by using eval "eval("true")"
+---*/
+
+if (eval("true")) {
+} else {
+ throw new Test262Error('#1: In the "if" Statement eval as Expression is admitted');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A3.js b/js/src/tests/test262/language/statements/if/S12.5_A3.js
new file mode 100644
index 0000000000..d453858fe1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A3.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the production "IfStatement: if ( Expression ) Statement else
+ Statement" is evaluated, Expression is evaluated first
+es5id: 12.5_A3
+description: The Expression is "(function(){throw 1})()"
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ if ((function(){throw 1})()) abracadabra
+} catch (e) {
+ if (e !== 1) {
+ throw new Test262Error('#1: Exception === 1. Actual: Exception ==='+ e);
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try {
+ if ((function(){throw 1})()) abracadabra; else blablachat;
+} catch (e) {
+ if (e !== 1) {
+ throw new Test262Error('#2: Exception === 1. Actual: Exception ==='+ e);
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A4.js b/js/src/tests/test262/language/statements/if/S12.5_A4.js
new file mode 100644
index 0000000000..a73ebdacbc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A4.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When the production "IfStatement: if ( Expression ) Statement else
+ Statement" is evaluated, Statement(s) is(are) evaluated second
+es5id: 12.5_A4
+description: The first statement is "(function(){throw "instatement"})()"
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ if (true) (function(){throw "instatement"})();
+ throw new Test262Error("#1 failed")
+} catch (e) {
+ if (e !== "instatement") {
+ throw new Test262Error('#1: Exception === "instatement". Actual: Exception ==='+ e);
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try {
+ if (false) (function(){throw "truebranch"})(); (function(){throw "missbranch"})();
+ throw new Test262Error("#2 failed")
+} catch (e) {
+ if (e !== "missbranch") {
+ throw new Test262Error('#2: Exception === "missbranch". Actual: Exception ==='+ e);
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A5.js b/js/src/tests/test262/language/statements/if/S12.5_A5.js
new file mode 100644
index 0000000000..bbf738f127
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A5.js
@@ -0,0 +1,49 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ FunctionDeclaration inside the "if" Expression is evaluated as true and
+ function will not be declarated
+es5id: 12.5_A5
+description: >
+ The "if" Expression is "function __func(){throw
+ "FunctionExpression";}"
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ __func=__func;
+ throw new Test262Error('#1: "__func=__func" lead to throwing exception');
+} catch (e) {
+ ;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try {
+ if(function __func(){throw "FunctionExpression";}) (function(){throw "TrueBranch"})(); else (function(){"MissBranch"})();
+} catch (e) {
+ if (e !== "TrueBranch") {
+ throw new Test262Error('#2: Exception ==="TrueBranch". Actual: Exception ==='+ e);
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+try {
+ __func=__func;
+ throw new Test262Error('#3: "__func=__func" lead to throwing exception');
+} catch (e) {
+ ;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A6_T1.js b/js/src/tests/test262/language/statements/if/S12.5_A6_T1.js
new file mode 100644
index 0000000000..294413d053
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A6_T1.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: In the If statement expression must be enclosed in braces
+es5id: 12.5_A6_T1
+description: Checking if execution of "if true" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if true;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A6_T2.js b/js/src/tests/test262/language/statements/if/S12.5_A6_T2.js
new file mode 100644
index 0000000000..210514dba8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A6_T2.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: In the If statement expression must be enclosed in braces
+es5id: 12.5_A6_T2
+description: Checking if execution of "if false" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if false;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/if/S12.5_A8.js b/js/src/tests/test262/language/statements/if/S12.5_A8.js
new file mode 100644
index 0000000000..248b166a41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/S12.5_A8.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: In the "if" Statement empty expression is not allowed
+es5id: 12.5_A8
+description: Checking if execution of "if()" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if();
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/if/browser.js b/js/src/tests/test262/language/statements/if/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/browser.js
diff --git a/js/src/tests/test262/language/statements/if/cptn-else-false-abrupt-empty.js b/js/src/tests/test262/language/statements/if/cptn-else-false-abrupt-empty.js
new file mode 100644
index 0000000000..be9317eff1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/cptn-else-false-abrupt-empty.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-if-statement-runtime-semantics-evaluation
+description: >
+ Completion value when expression is false with an `else` clause and body
+ returns an empty abrupt completion
+info: |
+ IfStatement : if ( Expression ) Statement else Statement
+
+ 3. If exprValue is true, then
+ [...]
+ 4. Else,
+ a. Let stmtCompletion be the result of evaluating the second Statement.
+ 5. Return Completion(UpdateEmpty(stmtCompletion, undefined)).
+---*/
+
+assert.sameValue(
+ eval('1; do { if (false) { } else { break; } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('2; do { 3; if (false) { } else { break; } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('4; do { if (false) { 5; } else { break; } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('6; do { 7; if (false) { 8; } else { break; } } while (false)'),
+ undefined
+);
+
+assert.sameValue(
+ eval('9; do { if (false) { } else { continue; } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('10; do { 11; if (false) { } else { continue; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('12; do { if (false) { 13; } else { continue; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('14; do { 15; if (false) { 16; } else { continue; } } while (false)'),
+ undefined
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/cptn-else-false-nrml.js b/js/src/tests/test262/language/statements/if/cptn-else-false-nrml.js
new file mode 100644
index 0000000000..cb31580666
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/cptn-else-false-nrml.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.7
+description: >
+ Completion value when expression is false with an `else` clause and body
+ returns a normal completion
+info: |
+ IfStatement : if ( Expression ) Statement else Statement
+
+ 4. If exprValue is true, then
+ [...]
+ 5. Else,
+ a. Let stmtCompletion be the result of evaluating the second Statement.
+ 6. ReturnIfAbrupt(stmtCompletion).
+ 7. If stmtCompletion.[[value]] is not empty, return stmtCompletion.
+ 8. Return NormalCompletion(undefined).
+---*/
+
+assert.sameValue(eval('1; if (false) { } else { }'), undefined);
+assert.sameValue(eval('2; if (false) { } else { 3; }'), 3);
+assert.sameValue(eval('4; if (false) { 5; } else { }'), undefined);
+assert.sameValue(eval('6; if (false) { 7; } else { 8; }'), 8);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/cptn-else-true-abrupt-empty.js b/js/src/tests/test262/language/statements/if/cptn-else-true-abrupt-empty.js
new file mode 100644
index 0000000000..b0c1678425
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/cptn-else-true-abrupt-empty.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-if-statement-runtime-semantics-evaluation
+description: >
+ Completion value when expression is true with an `else` clause and body
+ returns an abrupt completion
+info: |
+ IfStatement : if ( Expression ) Statement else Statement
+
+ 3. If exprValue is true, then
+ a. Let stmtCompletion be the result of evaluating the first Statement.
+ 4. Else,
+ [...]
+ 5. Return Completion(UpdateEmpty(stmtCompletion, undefined)).
+---*/
+
+assert.sameValue(
+ eval('1; do { if (true) { break; } else { } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('2; do { 3; if (true) { break; } else { } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('4; do { if (true) { break; } else { 5; } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('6; do { 7; if (true) { break; } else { 8; } } while (false)'),
+ undefined
+);
+
+assert.sameValue(
+ eval('1; do { if (true) { continue; } else { } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('2; do { 3; if (true) { continue; } else { } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('4; do { if (true) { continue; } else { 5; } } while (false)'), undefined
+);
+assert.sameValue(
+ eval('6; do { 7; if (true) { continue; } else { 8; } } while (false)'),
+ undefined
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/cptn-else-true-nrml.js b/js/src/tests/test262/language/statements/if/cptn-else-true-nrml.js
new file mode 100644
index 0000000000..cf262e6a5b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/cptn-else-true-nrml.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.7
+description: >
+ Completion value when expression is true with an `else` clause and body
+ returns a normal completion
+info: |
+ IfStatement : if ( Expression ) Statement else Statement
+
+ 4. If exprValue is true, then
+ a. Let stmtCompletion be the result of evaluating the first Statement.
+ 5. Else,
+ [...]
+ 6. ReturnIfAbrupt(stmtCompletion).
+ 7. If stmtCompletion.[[value]] is not empty, return stmtCompletion.
+ 8. Return NormalCompletion(undefined).
+---*/
+
+assert.sameValue(eval('1; if (true) { } else { }'), undefined);
+assert.sameValue(eval('2; if (true) { 3; } else { }'), 3);
+assert.sameValue(eval('4; if (true) { } else { 5; }'), undefined);
+assert.sameValue(eval('6; if (true) { 7; } else { 8; }'), 7);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/cptn-empty-statement.js b/js/src/tests/test262/language/statements/if/cptn-empty-statement.js
new file mode 100644
index 0000000000..d8b2c5bcd3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/cptn-empty-statement.js
@@ -0,0 +1,16 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ In the "if" statement empty statement is allowed and is evaluated to
+ "undefined"
+es5id: 12.5_A7
+description: Checking by using eval "eval("if(1);"))"
+---*/
+
+var __evaluated = eval("if(1);");
+
+assert.sameValue(__evaluated, undefined, '#1: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/cptn-no-else-false.js b/js/src/tests/test262/language/statements/if/cptn-no-else-false.js
new file mode 100644
index 0000000000..3eff2032f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/cptn-no-else-false.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.7
+description: Completion value when expression is false without an `else` clause
+info: |
+ IfStatement : if ( Expression ) Statement
+
+ [...]
+ 4. If exprValue is false, then
+ a. Return NormalCompletion(undefined).
+---*/
+
+assert.sameValue(eval('1; if (false) { }'), undefined);
+assert.sameValue(eval('2; if (false) { 3; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/cptn-no-else-true-abrupt-empty.js b/js/src/tests/test262/language/statements/if/cptn-no-else-true-abrupt-empty.js
new file mode 100644
index 0000000000..819497a063
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/cptn-no-else-true-abrupt-empty.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-if-statement-runtime-semantics-evaluation
+description: >
+ Completion value when expression is true without an `else` clause and body
+ returns an empty abrupt completion
+info: |
+ IfStatement : if ( Expression ) Statement
+
+ 3. If exprValue is false, then
+ [...]
+ 4. Else,
+ a. Let stmtCompletion be the result of evaluating Statement.
+ b. Return Completion(UpdateEmpty(stmtCompletion, undefined)).
+---*/
+
+assert.sameValue(
+ eval('1; do { 2; if (true) { 3; break; } 4; } while (false)'), 3
+);
+assert.sameValue(
+ eval('5; do { 6; if (true) { break; } 7; } while (false)'), undefined
+);
+
+assert.sameValue(
+ eval('8; do { 9; if (true) { 10; continue; } 11; } while (false)'), 10
+);
+assert.sameValue(
+ eval('12; do { 13; if (true) { continue; } 14; } while (false)'), undefined
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/cptn-no-else-true-nrml.js b/js/src/tests/test262/language/statements/if/cptn-no-else-true-nrml.js
new file mode 100644
index 0000000000..6b5f2ad1ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/cptn-no-else-true-nrml.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.7
+description: >
+ Completion value when expression is true without an `else` clause and body
+ returns a normal completion.
+info: |
+ IfStatement : if ( Expression ) Statement
+
+ [...]
+ 4. If exprValue is false, then
+ [...]
+ 5. Else,
+ a. Let stmtCompletion be the result of evaluating Statement.
+ b. ReturnIfAbrupt(stmtCompletion).
+ c. If stmtCompletion.[[value]] is not empty, return stmtCompletion.
+ d. Return NormalCompletion(undefined).
+---*/
+
+assert.sameValue(eval('1; if (true) { }'), undefined);
+assert.sameValue(eval('2; if (true) { 3; }'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/empty-statement.js b/js/src/tests/test262/language/statements/if/empty-statement.js
new file mode 100644
index 0000000000..eb58e5ffe3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/empty-statement.js
@@ -0,0 +1,11 @@
+// Copyright 2019 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: In the "if" statement empty statement is allowed.
+es5id: 12.5_A7
+---*/
+
+if(1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/if-async-fun-else-async-fun.js b/js/src/tests/test262/language/statements/if/if-async-fun-else-async-fun.js
new file mode 100644
index 0000000000..ce2f37bf32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-async-fun-else-async-fun.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) async function f() { } else async function _f() {}
diff --git a/js/src/tests/test262/language/statements/if/if-async-fun-else-stmt.js b/js/src/tests/test262/language/statements/if/if-async-fun-else-stmt.js
new file mode 100644
index 0000000000..93e9241d8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-async-fun-else-stmt.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) async function f() { } else ;
diff --git a/js/src/tests/test262/language/statements/if/if-async-fun-no-else.js b/js/src/tests/test262/language/statements/if/if-async-fun-no-else.js
new file mode 100644
index 0000000000..5fc1ef0dd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-async-fun-no-else.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) async function f() { }
diff --git a/js/src/tests/test262/language/statements/if/if-async-gen-else-async-gen.js b/js/src/tests/test262/language/statements/if/if-async-gen-else-async-gen.js
new file mode 100644
index 0000000000..fd44f72614
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-async-gen-else-async-gen.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) async function* f() { } else async function* _f() {}
diff --git a/js/src/tests/test262/language/statements/if/if-async-gen-else-stmt.js b/js/src/tests/test262/language/statements/if/if-async-gen-else-stmt.js
new file mode 100644
index 0000000000..83a01db591
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-async-gen-else-stmt.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) async function* f() { } else ;
diff --git a/js/src/tests/test262/language/statements/if/if-async-gen-no-else.js b/js/src/tests/test262/language/statements/if/if-async-gen-no-else.js
new file mode 100644
index 0000000000..057c79c607
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-async-gen-no-else.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) async function* f() { }
diff --git a/js/src/tests/test262/language/statements/if/if-cls-else-cls.js b/js/src/tests/test262/language/statements/if/if-cls-else-cls.js
new file mode 100644
index 0000000000..37724e0cb7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-cls-else-cls.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) class C {} else class D {}
diff --git a/js/src/tests/test262/language/statements/if/if-cls-else-stmt.js b/js/src/tests/test262/language/statements/if/if-cls-else-stmt.js
new file mode 100644
index 0000000000..7a1cb274a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-cls-else-stmt.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) class C {} else ;
diff --git a/js/src/tests/test262/language/statements/if/if-cls-no-else.js b/js/src/tests/test262/language/statements/if/if-cls-no-else.js
new file mode 100644
index 0000000000..aae8ab2977
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-cls-no-else.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) class C {}
diff --git a/js/src/tests/test262/language/statements/if/if-const-else-const.js b/js/src/tests/test262/language/statements/if/if-const-else-const.js
new file mode 100644
index 0000000000..c72e7f59f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-const-else-const.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) const x = null; else const y = null;
diff --git a/js/src/tests/test262/language/statements/if/if-const-else-stmt.js b/js/src/tests/test262/language/statements/if/if-const-else-stmt.js
new file mode 100644
index 0000000000..45835be19f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-const-else-stmt.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) const x = null; else ;
diff --git a/js/src/tests/test262/language/statements/if/if-const-no-else.js b/js/src/tests/test262/language/statements/if/if-const-no-else.js
new file mode 100644
index 0000000000..7cd91b667f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-const-no-else.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) const x = null;
diff --git a/js/src/tests/test262/language/statements/if/if-decl-else-decl-strict-strict.js b/js/src/tests/test262/language/statements/if/if-decl-else-decl-strict-strict.js
new file mode 100644
index 0000000000..2a3b6ae4e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-decl-else-decl-strict-strict.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AnnexB extension not honored in strict mode (IfStatement with a declaration in both statement positions in the global scope)
+es6id: B.3.4
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ The following rules for IfStatement augment those in 13.6:
+
+ IfStatement[Yield, Return]:
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
+ if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
+
+ The above rules are only applied when parsing code that is not strict mode code.
+---*/
+
+$DONOTEVALUATE();
+
+if (true) function f() { } else function _f() {}
diff --git a/js/src/tests/test262/language/statements/if/if-decl-else-stmt-strict-strict.js b/js/src/tests/test262/language/statements/if/if-decl-else-stmt-strict-strict.js
new file mode 100644
index 0000000000..a6b4d3aaa7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-decl-else-stmt-strict-strict.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AnnexB extension not honored in strict mode (IfStatement with a declaration in the first statement position in the global scope)
+es6id: B.3.4
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ The following rules for IfStatement augment those in 13.6:
+
+ IfStatement[Yield, Return]:
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
+ if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
+
+ The above rules are only applied when parsing code that is not strict mode code.
+---*/
+
+$DONOTEVALUATE();
+
+if (true) function f() { } else ;
diff --git a/js/src/tests/test262/language/statements/if/if-decl-no-else-strict-strict.js b/js/src/tests/test262/language/statements/if/if-decl-no-else-strict-strict.js
new file mode 100644
index 0000000000..a3b0bc241f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-decl-no-else-strict-strict.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AnnexB extension not honored in strict mode (IfStatement without an else clause in the global scope)
+es6id: B.3.4
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ The following rules for IfStatement augment those in 13.6:
+
+ IfStatement[Yield, Return]:
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
+ if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
+
+ The above rules are only applied when parsing code that is not strict mode code.
+---*/
+
+$DONOTEVALUATE();
+
+if (true) function f() { }
diff --git a/js/src/tests/test262/language/statements/if/if-fun-else-fun-strict-strict.js b/js/src/tests/test262/language/statements/if/if-fun-else-fun-strict-strict.js
new file mode 100644
index 0000000000..3aff76f3b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-fun-else-fun-strict-strict.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AnnexB extension not honored in strict mode (IfStatement with a declaration in both statement positions in the global scope)
+esid: sec-if-statement
+es6id: 13.6
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ The following rules for IfStatement augment those in 13.6:
+
+ IfStatement[Yield, Return]:
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
+ if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
+
+ The above rules are only applied when parsing code that is not strict mode code.
+---*/
+
+$DONOTEVALUATE();
+
+if (true) function f() {} else function _f() {}
diff --git a/js/src/tests/test262/language/statements/if/if-fun-else-stmt-strict-strict.js b/js/src/tests/test262/language/statements/if/if-fun-else-stmt-strict-strict.js
new file mode 100644
index 0000000000..9d89018bbd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-fun-else-stmt-strict-strict.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AnnexB extension not honored in strict mode (IfStatement with a declaration in the first statement position in the global scope)
+esid: sec-if-statement
+es6id: 13.6
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ The following rules for IfStatement augment those in 13.6:
+
+ IfStatement[Yield, Return]:
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
+ if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
+
+ The above rules are only applied when parsing code that is not strict mode code.
+---*/
+
+$DONOTEVALUATE();
+
+if (true) function f() {} else ;
diff --git a/js/src/tests/test262/language/statements/if/if-fun-no-else-strict-strict.js b/js/src/tests/test262/language/statements/if/if-fun-no-else-strict-strict.js
new file mode 100644
index 0000000000..c79beace1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-fun-no-else-strict-strict.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AnnexB extension not honored in strict mode (IfStatement without an else clause in the global scope)
+esid: sec-if-statement
+es6id: 13.6
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ The following rules for IfStatement augment those in 13.6:
+
+ IfStatement[Yield, Return]:
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
+ if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
+
+ The above rules are only applied when parsing code that is not strict mode code.
+---*/
+
+$DONOTEVALUATE();
+
+if (true) function f() {}
diff --git a/js/src/tests/test262/language/statements/if/if-gen-else-gen.js b/js/src/tests/test262/language/statements/if/if-gen-else-gen.js
new file mode 100644
index 0000000000..917044da15
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-gen-else-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) function* g() { } else function* _g() {}
diff --git a/js/src/tests/test262/language/statements/if/if-gen-else-stmt.js b/js/src/tests/test262/language/statements/if/if-gen-else-stmt.js
new file mode 100644
index 0000000000..bd5bc3cc59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-gen-else-stmt.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) function* g() { } else ;
diff --git a/js/src/tests/test262/language/statements/if/if-gen-no-else.js b/js/src/tests/test262/language/statements/if/if-gen-no-else.js
new file mode 100644
index 0000000000..b405120b9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-gen-no-else.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) function* g() { }
diff --git a/js/src/tests/test262/language/statements/if/if-let-else-let.js b/js/src/tests/test262/language/statements/if/if-let-else-let.js
new file mode 100644
index 0000000000..cc61674b89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-let-else-let.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) let x; else let y;
diff --git a/js/src/tests/test262/language/statements/if/if-let-else-stmt.js b/js/src/tests/test262/language/statements/if/if-let-else-stmt.js
new file mode 100644
index 0000000000..019a1a6f03
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-let-else-stmt.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) let x; else ;
diff --git a/js/src/tests/test262/language/statements/if/if-let-no-else.js b/js/src/tests/test262/language/statements/if/if-let-no-else.js
new file mode 100644
index 0000000000..66b4bf9640
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-let-no-else.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) let x;
diff --git a/js/src/tests/test262/language/statements/if/if-stmt-else-async-fun.js b/js/src/tests/test262/language/statements/if/if-stmt-else-async-fun.js
new file mode 100644
index 0000000000..34d5a63bdf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-stmt-else-async-fun.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+if (false) ; else async function f() { }
diff --git a/js/src/tests/test262/language/statements/if/if-stmt-else-async-gen.js b/js/src/tests/test262/language/statements/if/if-stmt-else-async-gen.js
new file mode 100644
index 0000000000..51feb3f68c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-stmt-else-async-gen.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+if (false) ; else async function* f() { }
diff --git a/js/src/tests/test262/language/statements/if/if-stmt-else-cls.js b/js/src/tests/test262/language/statements/if/if-stmt-else-cls.js
new file mode 100644
index 0000000000..50cfe82301
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-stmt-else-cls.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (false) ; else class C {}
diff --git a/js/src/tests/test262/language/statements/if/if-stmt-else-const.js b/js/src/tests/test262/language/statements/if/if-stmt-else-const.js
new file mode 100644
index 0000000000..b9dfa2dd7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-stmt-else-const.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (false) ; else const x = null;
diff --git a/js/src/tests/test262/language/statements/if/if-stmt-else-decl-strict-strict.js b/js/src/tests/test262/language/statements/if/if-stmt-else-decl-strict-strict.js
new file mode 100644
index 0000000000..1cb37c2ac6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-stmt-else-decl-strict-strict.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AnnexB extension not honored in strict mode (IfStatement with a declaration in the second statement position in the global scope)
+es6id: B.3.4
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ The following rules for IfStatement augment those in 13.6:
+
+ IfStatement[Yield, Return]:
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
+ if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
+
+ B.3.3.2 Changes to GlobalDeclarationInstantiation
+
+ 1. 1. Let strict be IsStrict of script
+ 2. If strict is *false*, then
+ [...]
+---*/
+
+$DONOTEVALUATE();
+
+if (false) ; else function f() { }
diff --git a/js/src/tests/test262/language/statements/if/if-stmt-else-fun-strict-strict.js b/js/src/tests/test262/language/statements/if/if-stmt-else-fun-strict-strict.js
new file mode 100644
index 0000000000..1116b762fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-stmt-else-fun-strict-strict.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AnnexB extension not honored in strict mode (IfStatement with a declaration in the second statement position in the global scope)
+esid: sec-if-statement
+es6id: 13.6
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ The following rules for IfStatement augment those in 13.6:
+
+ IfStatement[Yield, Return]:
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return]
+ if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield]
+ if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield]
+
+ B.3.3.2 Changes to GlobalDeclarationInstantiation
+
+ 1. 1. Let strict be IsStrict of script
+ 2. If strict is *false*, then
+ [...]
+---*/
+
+$DONOTEVALUATE();
+
+if (false) ; else function f() {}
diff --git a/js/src/tests/test262/language/statements/if/if-stmt-else-gen.js b/js/src/tests/test262/language/statements/if/if-stmt-else-gen.js
new file mode 100644
index 0000000000..4fdb6faeb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-stmt-else-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+if (false) ; else function* g() { }
diff --git a/js/src/tests/test262/language/statements/if/if-stmt-else-let.js b/js/src/tests/test262/language/statements/if/if-stmt-else-let.js
new file mode 100644
index 0000000000..1004cbcff4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/if-stmt-else-let.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-if-statement
+es6id: 13.6
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (false) ; else let x;
diff --git a/js/src/tests/test262/language/statements/if/labelled-fn-stmt-first.js b/js/src/tests/test262/language/statements/if/labelled-fn-stmt-first.js
new file mode 100644
index 0000000000..5dc561e7d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/labelled-fn-stmt-first.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-if-statement-static-semantics-early-errors
+es6id: 13.6.1
+description: >
+ A labelled function declaration is never permitted in the first of two
+ Statement positions
+info: |
+ IfStatement :
+
+ if ( Expression ) Statement else Statement
+ if ( Expression ) Statement
+
+ - It is a Syntax Error if IsLabelledFunction(Statement) is true.
+
+ NOTE It is only necessary to apply this rule if the extension specified in
+ B.3.2 is implemented.
+
+ In the absence of Annex B.3.2, a SyntaxError should be produced due to the
+ labelled function declaration itself.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (false) label1: label2: function test262() {} else ;
diff --git a/js/src/tests/test262/language/statements/if/labelled-fn-stmt-lone.js b/js/src/tests/test262/language/statements/if/labelled-fn-stmt-lone.js
new file mode 100644
index 0000000000..0a18cd7316
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/labelled-fn-stmt-lone.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-if-statement-static-semantics-early-errors
+es6id: 13.6.1
+description: >
+ A labelled function declaration is never permitted in the sole Statement
+ position
+info: |
+ IfStatement :
+
+ if ( Expression ) Statement else Statement
+ if ( Expression ) Statement
+
+ - It is a Syntax Error if IsLabelledFunction(Statement) is true.
+
+ NOTE It is only necessary to apply this rule if the extension specified in
+ B.3.2 is implemented.
+
+ In the absence of Annex B.3.2, a SyntaxError should be produced due to the
+ labelled function declaration itself.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (false) label1: label2: function test262() {}
diff --git a/js/src/tests/test262/language/statements/if/labelled-fn-stmt-second.js b/js/src/tests/test262/language/statements/if/labelled-fn-stmt-second.js
new file mode 100644
index 0000000000..9acb6cbfd4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/labelled-fn-stmt-second.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-if-statement-static-semantics-early-errors
+es6id: 13.6.1
+description: >
+ A labelled function declaration is never permitted in the second of two
+ Statement positions
+info: |
+ IfStatement :
+
+ if ( Expression ) Statement else Statement
+ if ( Expression ) Statement
+
+ - It is a Syntax Error if IsLabelledFunction(Statement) is true.
+
+ NOTE It is only necessary to apply this rule if the extension specified in
+ B.3.2 is implemented.
+
+ In the absence of Annex B.3.2, a SyntaxError should be produced due to the
+ labelled function declaration itself.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+if (true) ; else label1: label2: function test262() {}
diff --git a/js/src/tests/test262/language/statements/if/let-array-with-newline.js b/js/src/tests/test262/language/statements/if/let-array-with-newline.js
new file mode 100644
index 0000000000..e81973a5e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/let-array-with-newline.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+if (false) let
+[a] = 0;
diff --git a/js/src/tests/test262/language/statements/if/let-block-with-newline.js b/js/src/tests/test262/language/statements/if/let-block-with-newline.js
new file mode 100644
index 0000000000..4c158434c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/let-block-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let {`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+if (false) let // ASI
+{}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/let-identifier-with-newline.js b/js/src/tests/test262/language/statements/if/let-identifier-with-newline.js
new file mode 100644
index 0000000000..29629fa4c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/let-identifier-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-if-statement
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+if (false) let // ASI
+x = 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/shell.js b/js/src/tests/test262/language/statements/if/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/if/tco-else-body-strict.js b/js/src/tests/test262/language/statements/if/tco-else-body-strict.js
new file mode 100644
index 0000000000..64883d7e39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/tco-else-body-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ if (false) { } else { return f(n - 1); }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/if/tco-if-body-strict.js b/js/src/tests/test262/language/statements/if/tco-if-body-strict.js
new file mode 100644
index 0000000000..85188bdc36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/if/tco-if-body-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ if (true) { return f(n - 1); }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/S12.12_A1_T1.js b/js/src/tests/test262/language/statements/labeled/S12.12_A1_T1.js
new file mode 100644
index 0000000000..009339fa1b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/S12.12_A1_T1.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Labelled statements are only used in conjunction with labelled
+ break and continue statements
+es5id: 12.12_A1_T1
+description: Checking if labelled break works. See continue and break sections
+---*/
+
+var object = {p1: 1, p2: 1};
+var result = 0;
+lbl: for(var i in object){
+ result += object[i];
+ break lbl;
+}
+
+if(!(result === 1)){
+ throw new Test262Error("'break label' should break execution of labelled iteration statement");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/browser.js b/js/src/tests/test262/language/statements/labeled/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/browser.js
diff --git a/js/src/tests/test262/language/statements/labeled/continue.js b/js/src/tests/test262/language/statements/labeled/continue.js
new file mode 100644
index 0000000000..7eaae138b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/continue.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-labelled-statements-static-semantics-containsundefinedcontinuetarget
+es6id: 13.13.4
+description: Does not modify `iterationSet`
+info: |
+ With arguments iterationSet and labelSet.
+
+ LabelledStatement : LabelIdentifier : LabelledItem
+
+ 1. Let label be the StringValue of LabelIdentifier.
+ 2. Let newLabelSet be a copy of labelSet with label appended.
+ 3. Return ContainsUndefinedContinueTarget of LabelledItem with arguments
+ iterationSet and newLabelSet.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+do {
+ test262: {
+ continue test262;
+ }
+} while (false)
diff --git a/js/src/tests/test262/language/statements/labeled/cptn-break.js b/js/src/tests/test262/language/statements/labeled/cptn-break.js
new file mode 100644
index 0000000000..5e374af5d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/cptn-break.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-labelled-statements-runtime-semantics-labelledevaluation
+es6id: 13.13.14
+description: Completion value when LabelledItem returns a "break" completion
+info: |
+ LabelledStatement : LabelIdentifier : LabelledItem
+
+ 1. Let label be the StringValue of LabelIdentifier.
+ 2. Append label as an element of labelSet.
+ 3. Let stmtResult be LabelledEvaluation of LabelledItem with argument
+ labelSet.
+ 4. If stmtResult.[[Type]] is break and SameValue(stmtResult.[[Target]],
+ label) is true, then
+ a. Let stmtResult be NormalCompletion(stmtResult.[[Value]]).
+---*/
+
+assert.sameValue(eval('test262id: { 5; break test262id; 9; }'), 5);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/cptn-nrml.js b/js/src/tests/test262/language/statements/labeled/cptn-nrml.js
new file mode 100644
index 0000000000..ad04ba0ba7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/cptn-nrml.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-labelled-statements-runtime-semantics-labelledevaluation
+es6id: 13.13.14
+description: Completion value when LabelledItem returns normally
+info: |
+ LabelledStatement : LabelIdentifier : LabelledItem
+
+ 1. Let label be the StringValue of LabelIdentifier.
+ 2. Append label as an element of labelSet.
+ 3. Let stmtResult be LabelledEvaluation of LabelledItem with argument
+ labelSet.
+ 4. If stmtResult.[[Type]] is break and SameValue(stmtResult.[[Target]],
+ label) is true, then
+ [...]
+ 5. Return Completion(stmtResult).
+---*/
+
+assert.sameValue(eval('test262id: 2;'), 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/decl-async-function.js b/js/src/tests/test262/language/statements/labeled/decl-async-function.js
new file mode 100644
index 0000000000..63b8e17016
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/decl-async-function.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-labelled-statements
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+label: async function f() {}
diff --git a/js/src/tests/test262/language/statements/labeled/decl-async-generator.js b/js/src/tests/test262/language/statements/labeled/decl-async-generator.js
new file mode 100644
index 0000000000..c11f582bb4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/decl-async-generator.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-labelled-statements
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+label: async function* g() {}
diff --git a/js/src/tests/test262/language/statements/labeled/decl-cls.js b/js/src/tests/test262/language/statements/labeled/decl-cls.js
new file mode 100644
index 0000000000..1dd24bd805
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/decl-cls.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-labelled-statements
+es6id: 13.13
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+label: class C {}
diff --git a/js/src/tests/test262/language/statements/labeled/decl-const.js b/js/src/tests/test262/language/statements/labeled/decl-const.js
new file mode 100644
index 0000000000..903bbfe85e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/decl-const.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-labelled-statements
+es6id: 13.13
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+label: const x = null;
diff --git a/js/src/tests/test262/language/statements/labeled/decl-fun-strict-strict.js b/js/src/tests/test262/language/statements/labeled/decl-fun-strict-strict.js
new file mode 100644
index 0000000000..75ad6bc614
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/decl-fun-strict-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-labelled-statements
+es6id: 13.13
+description: >
+ function declarations in statement position in strict mode:
+ label: Statement
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+label: function g() {}
diff --git a/js/src/tests/test262/language/statements/labeled/decl-gen.js b/js/src/tests/test262/language/statements/labeled/decl-gen.js
new file mode 100644
index 0000000000..7811b09f31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/decl-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-labelled-statements
+es6id: 13.13
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+label: function* g() {}
diff --git a/js/src/tests/test262/language/statements/labeled/decl-let.js b/js/src/tests/test262/language/statements/labeled/decl-let.js
new file mode 100644
index 0000000000..758f884dbb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/decl-let.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-labelled-statements
+es6id: 13.13
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+label: let x;
diff --git a/js/src/tests/test262/language/statements/labeled/let-array-with-newline.js b/js/src/tests/test262/language/statements/labeled/let-array-with-newline.js
new file mode 100644
index 0000000000..daa158c099
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/let-array-with-newline.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-labelled-statements
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+// Wrapped in an if-statement to avoid reference errors at runtime.
+if (false) {
+ L: let
+ [a] = 0;
+}
diff --git a/js/src/tests/test262/language/statements/labeled/let-block-with-newline.js b/js/src/tests/test262/language/statements/labeled/let-block-with-newline.js
new file mode 100644
index 0000000000..5ecd38824b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/let-block-with-newline.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-labelled-statements
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let {`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+// Wrapped in an if-statement to avoid reference errors at runtime.
+if (false) {
+ L: let // ASI
+ {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/let-identifier-with-newline.js b/js/src/tests/test262/language/statements/labeled/let-identifier-with-newline.js
new file mode 100644
index 0000000000..97911aed22
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/let-identifier-with-newline.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-labelled-statements
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+// Wrapped in an if-statement to avoid reference errors at runtime.
+if (false) {
+ L: let // ASI
+ x = 1;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/shell.js b/js/src/tests/test262/language/statements/labeled/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/labeled/static-init-invalid-await.js b/js/src/tests/test262/language/statements/labeled/static-init-invalid-await.js
new file mode 100644
index 0000000000..ac8268847a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/static-init-invalid-await.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: Restriction on `await`
+info: |
+ LabelIdentifier : Identifier
+
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ await: 0;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/labeled/tco-strict.js b/js/src/tests/test262/language/statements/labeled/tco-strict.js
new file mode 100644
index 0000000000..b0889704a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/tco-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ test262: return f(n - 1);
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/value-await-module-escaped.js b/js/src/tests/test262/language/statements/labeled/value-await-module-escaped.js
new file mode 100644
index 0000000000..16c0f9cf1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/value-await-module-escaped.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+ `await` is a reserved identifier in module code and may not be used as a label.
+info: |
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if the goal symbol of the syntactic grammar is Module and
+ the StringValue of IdentifierName is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+aw\u0061it: 1;
diff --git a/js/src/tests/test262/language/statements/labeled/value-await-module.js b/js/src/tests/test262/language/statements/labeled/value-await-module.js
new file mode 100644
index 0000000000..7284a29126
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/value-await-module.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+ `await` is a reserved identifier in module code and may not be used as a label.
+info: |
+ LabelIdentifier : await
+
+ It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+await: 1;
diff --git a/js/src/tests/test262/language/statements/labeled/value-await-non-module-escaped.js b/js/src/tests/test262/language/statements/labeled/value-await-non-module-escaped.js
new file mode 100644
index 0000000000..4a8b7441bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/value-await-non-module-escaped.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+ `await` is not a reserved identifier in non-module code and may be used as a label.
+info: |
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if the goal symbol of the syntactic grammar is Module and
+ the StringValue of IdentifierName is "await".
+---*/
+
+aw\u0061it: 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/value-await-non-module.js b/js/src/tests/test262/language/statements/labeled/value-await-non-module.js
new file mode 100644
index 0000000000..4e6237d457
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/value-await-non-module.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+ `await` is not a reserved identifier in non-module code and may be used as a label.
+info: |
+ LabelIdentifier : await
+
+ It is a Syntax Error if the goal symbol of the syntactic grammar is Module.
+---*/
+
+await: 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/value-yield-non-strict-escaped.js b/js/src/tests/test262/language/statements/labeled/value-yield-non-strict-escaped.js
new file mode 100644
index 0000000000..4503bf2daf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/value-yield-non-strict-escaped.js
@@ -0,0 +1,13 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+ `yield` is not a reserved identifier in non-strict mode code and may be used as a label.
+flags: [noStrict]
+---*/
+
+yi\u0065ld: 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/value-yield-non-strict.js b/js/src/tests/test262/language/statements/labeled/value-yield-non-strict.js
new file mode 100644
index 0000000000..d9dce33d84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/value-yield-non-strict.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` is not a reserved identifier in non-strict mode code and may be
+ used as a label.
+ es6id: 12.1.1
+ flags: [noStrict]
+---*/
+
+yield: 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/labeled/value-yield-strict-escaped-strict.js b/js/src/tests/test262/language/statements/labeled/value-yield-strict-escaped-strict.js
new file mode 100644
index 0000000000..1b472202cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/value-yield-strict-escaped-strict.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-identifiers-static-semantics-early-errors
+description: >
+ `yield` is a reserved identifier in strict mode code and may not be used as a label.
+info: |
+ Identifier : IdentifierName but not ReservedWord
+
+ It is a Syntax Error if this phrase is contained in strict mode code and the
+ StringValue of IdentifierName is: "implements", "interface", "let", "package",
+ "private", "protected", "public", "static", or "yield".
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+yi\u0065ld: 1;
diff --git a/js/src/tests/test262/language/statements/labeled/value-yield-strict-strict.js b/js/src/tests/test262/language/statements/labeled/value-yield-strict-strict.js
new file mode 100644
index 0000000000..539a1ff351
--- /dev/null
+++ b/js/src/tests/test262/language/statements/labeled/value-yield-strict-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2013 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+ description: >
+ `yield` is a reserved identifier in strict mode code and may not be used
+ as a label.
+ es6id: 12.1.1
+ negative:
+ phase: parse
+ type: SyntaxError
+ flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+yield: 1;
diff --git a/js/src/tests/test262/language/statements/let/block-local-closure-get-before-initialization.js b/js/src/tests/test262/language/statements/let/block-local-closure-get-before-initialization.js
new file mode 100644
index 0000000000..fd97ac02b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/block-local-closure-get-before-initialization.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: block local closure [[Get]] before initialization.
+ (TDZ, Temporal Dead Zone)
+---*/
+{
+ function f() { return x + 1; }
+
+ assert.throws(ReferenceError, function() {
+ f();
+ });
+
+ let x;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/block-local-closure-set-before-initialization.js b/js/src/tests/test262/language/statements/let/block-local-closure-set-before-initialization.js
new file mode 100644
index 0000000000..76ed35c598
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/block-local-closure-set-before-initialization.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: block local closure [[Set]] before initialization.
+ (TDZ, Temporal Dead Zone)
+---*/
+{
+ function f() { x = 1; }
+
+ assert.throws(ReferenceError, function() {
+ f();
+ });
+
+ let x;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/block-local-use-before-initialization-in-declaration-statement.js b/js/src/tests/test262/language/statements/let/block-local-use-before-initialization-in-declaration-statement.js
new file mode 100644
index 0000000000..debfa1cefe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/block-local-use-before-initialization-in-declaration-statement.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: block local use before initialization in declaration statement.
+ (TDZ, Temporal Dead Zone)
+---*/
+assert.throws(ReferenceError, function() {
+ {
+ let x = x + 1;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/block-local-use-before-initialization-in-prior-statement.js b/js/src/tests/test262/language/statements/let/block-local-use-before-initialization-in-prior-statement.js
new file mode 100644
index 0000000000..b54d51a036
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/block-local-use-before-initialization-in-prior-statement.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: block local use before initialization in prior statement.
+ (TDZ, Temporal Dead Zone)
+---*/
+assert.throws(ReferenceError, function() {
+ {
+ x; let x;
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/browser.js b/js/src/tests/test262/language/statements/let/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/browser.js
diff --git a/js/src/tests/test262/language/statements/let/cptn-value.js b/js/src/tests/test262/language/statements/let/cptn-value.js
new file mode 100644
index 0000000000..f32f676e10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/cptn-value.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+es6id: 13.3.1.4
+description: Returns an empty completion
+info: |
+ LexicalDeclaration : LetOrConst BindingList ;
+
+ 1. Let next be the result of evaluating BindingList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+---*/
+
+assert.sameValue(
+ eval('let test262id1;'), undefined, 'Single declaration without initializer'
+);
+assert.sameValue(
+ eval('let test262id2 = 2;'),
+ undefined,
+ 'Single declaration bearing initializer'
+);
+assert.sameValue(
+ eval('let test262id3 = 3, test262id4;'),
+ undefined,
+ 'Multiple declarations, final without initializer'
+);
+assert.sameValue(
+ eval('let test262id5, test262id6 = 6;'),
+ undefined,
+ 'Multiple declarations, final bearing initializer'
+);
+
+assert.sameValue(eval('7; let test262id8;'), 7);
+assert.sameValue(eval('9; let test262id10 = 10;'), 9);
+assert.sameValue(eval('11; let test262id12 = 12, test262id13;'), 11);
+assert.sameValue(eval('14; let test262id15, test262id16 = 16;'), 14);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-close.js
new file mode 100644
index 0000000000..7c8c73e2b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-close.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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 {};
+ }
+ };
+};
+
+let [x] = iter;
+
+assert.sameValue(doneCallCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..f31b786c1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Abrupt completion returned by GetIterator (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ let [x, y, z] = [1, 2, 3];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-get-err.js
new file mode 100644
index 0000000000..a074c57553
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-get-err.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Abrupt completion returned by GetIterator (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ let [x] = iter;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-no-close.js
new file mode 100644
index 0000000000..f787d6bbdc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-init-iter-no-close.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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 {};
+ }
+ };
+};
+
+let [x] = iter;
+
+assert.sameValue(doneCallCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/statements/let/dstr/ary-name-iter-val.js
new file mode 100644
index 0000000000..9dd83be9a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-name-iter-val.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: SingleNameBinding with normal value iteration (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [x, y, z] = [1, 2, 3];
+
+assert.sameValue(x, 1);
+assert.sameValue(y, 2);
+assert.sameValue(z, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..d0ac82fdeb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let [[x, y, z] = [4, 5, 6]] = [];
+
+assert.sameValue(x, 4);
+assert.sameValue(y, 5);
+assert.sameValue(z, 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..e7b74dcbf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let [[x, y, z] = [4, 5, 6]] = [[7, 8, 9]];
+
+assert.sameValue(x, 7);
+assert.sameValue(y, 8);
+assert.sameValue(z, 9);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..9a7f741d75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+};
+
+let [[,] = g()] = [];
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..7db10de306
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+};
+
+let [[,] = g()] = [[]];
+
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..a1c84bcc7b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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; }();
+
+let [[] = function() { initCount += 1; return iter; }()] = [];
+
+assert.sameValue(initCount, 1);
+assert.sameValue(iterCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..62514d45da
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+let [[] = function() { initCount += 1; }()] = [[23]];
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..5c576005d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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];
+
+let [[...x] = 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..03d22a869c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+
+let [[...x] = function() { initCount += 1; }()] = [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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..123b499419
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Nested array destructuring with a null value (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ let [[x]] = [null];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..b47f0379de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [x = 23] = [];
+
+assert.sameValue(x, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..99c94f72ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,38 @@
+// 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/let-stmt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [arrow = () => {}] = [];
+
+assert.sameValue(arrow.name, 'arrow');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..32b66db8f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,40 @@
+// 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/let-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = [];
+
+assert.sameValue(cls.name, 'cls');
+assert.notSameValue(xCls.name, 'xCls');
+assert.notSameValue(xCls2.name, 'xCls2');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..5f52505bd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,39 @@
+// 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/let-stmt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [cover = (function () {}), xCover = (0, function() {})] = [];
+
+assert.sameValue(cover.name, 'cover');
+assert.notSameValue(xCover.name, 'xCover');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..5f432c3482
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,39 @@
+// 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/let-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [fn = function () {}, xFn = function x() {}] = [];
+
+assert.sameValue(fn.name, 'fn');
+assert.notSameValue(xFn.name, 'xFn');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..592aea0ceb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,40 @@
+// 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/let-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+
+let [gen = function* () {}, xGen = function* x() {}] = [];
+
+assert.sameValue(gen.name, 'gen');
+assert.notSameValue(xGen.name, 'xGen');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..9d0bc8cc7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Destructuring initializer with a "hole" (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [x = 23] = [,];
+
+assert.sameValue(x, 23);
+// another statement
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..de2e563261
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+}
+
+let [w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, ''];
+
+assert.sameValue(w, null);
+assert.sameValue(x, 0);
+assert.sameValue(y, false);
+assert.sameValue(z, '');
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..f73536e38a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ let [x = (function() { throw new Test262Error(); })()] = [undefined];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..2c05ca4ff4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Destructuring initializer with an undefined value (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [x = 23] = [undefined];
+
+assert.sameValue(x, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..41577595fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ let [ x = unresolvableReference ] = [];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..4f774ff808
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: SingleNameBinding when value iteration completes (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [x] = [];
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..812c416ae7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [_, x] = [];
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..075cf02863
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ let [x] = g;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..109de67a37
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,56 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+let [x, y, z] = [1, 2, 3];
+
+assert.sameValue(x, 1);
+assert.sameValue(y, 2);
+assert.sameValue(z, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..780c85feeb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ let [x] = g;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..f2c1ebba91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [x, y, z] = [1, 2, 3];
+
+assert.sameValue(x, 1);
+assert.sameValue(y, 2);
+assert.sameValue(z, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..2e0b2fb753
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let [{ x, y, z } = { x: 44, y: 55, z: 66 }] = [];
+
+assert.sameValue(x, 44);
+assert.sameValue(y, 55);
+assert.sameValue(z, 66);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..bbdfb64cb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-id.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let [{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }];
+
+assert.sameValue(x, 11);
+assert.sameValue(y, 22);
+assert.sameValue(z, 33);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..140efb9b19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [];
+
+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;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..c580f7c1fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..d9aba4592c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Nested object destructuring with a null value (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ let [{ x }] = [null];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..b88f2e22b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ let [{ x }] = [];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..db120423e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision-exhausted.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Elision accepts exhausted iterator (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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();
+
+let [,] = iter;
+
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..072891f08b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision-step-err.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ let [,] = iter;
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision.js
new file mode 100644
index 0000000000..71e129bdc7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-elision.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Elision advances iterator (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+};
+
+let [,] = g();
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-empty.js
new file mode 100644
index 0000000000..d4d6e28157
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-empty.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+let [] = iter;
+
+assert.sameValue(iterations, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..990517c33d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,59 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let [...[x, y, z]] = [3, 4, 5];
+
+assert.sameValue(x, 3);
+assert.sameValue(y, 4);
+assert.sameValue(z, 5);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..4546cbe0a9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element containing an elision (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+};
+
+let [...[,]] = g();
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..eef1caaa8d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element containing an "empty" array pattern (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+}();
+
+let [...[]] = iter;
+
+assert.sameValue(iterations, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..82b68650f9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element containing a rest element (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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];
+
+let [...[...x]] = 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);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..c04060f9cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-direct.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Lone rest element (direct binding) (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+let [...x] = [1];
+
+assert(Array.isArray(x));
+assert.compareArray(x, [1]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..96c0da10c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Rest element following elision elements (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ let [, ...x] = iter;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..7c4b92ee9e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-elision.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element following elision elements (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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];
+
+let [ , , ...x] = 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..8c27a133a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: RestElement applied to an exhausted iterator (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+
+let [, , ...x] = [1, 2];
+
+assert(Array.isArray(x));
+assert.sameValue(x.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..6eca0d9d4c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ let [...x] = iter;
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..001cf5ea52
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ let [...x] = iter;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..d5c0c3001c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-id.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Lone rest element (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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];
+
+let [...x] = 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..35216536ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-ary.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+let [...[ x ] = []] = [];
+
+
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..75400737e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-id.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element (identifier) does not support initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+let [...x = []] = [];
+
+
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..967d3cbfdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-init-obj.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+let [...{ x } = []] = [];
+
+
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..06f6e51ebc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+let [...[x], y] = [1, 2, 3];
+
+
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..eb4734b341
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+let [...x, y] = [1, 2, 3];
+
+
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..91769d44d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+let [...{ x }, y] = [1, 2, 3];
+
+
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..0ab9b660f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-obj-id.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element containing an object binding pattern (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+ [...]
+---*/
+
+let [...{ length }] = [1, 2, 3];
+
+assert.sameValue(length, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..6d892bceec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest element containing an object binding pattern (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+ [...]
+---*/
+let length = "outer";
+
+let [...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9];
+
+assert.sameValue(v, 7);
+assert.sameValue(w, 8);
+assert.sameValue(x, 9);
+assert.sameValue(y, undefined);
+assert.sameValue(z, 3);
+
+assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/browser.js b/js/src/tests/test262/language/statements/let/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-init-null.js b/js/src/tests/test262/language/statements/let/dstr/obj-init-null.js
new file mode 100644
index 0000000000..f9f11094e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-init-null.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ let {} = null;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-init-undefined.js b/js/src/tests/test262/language/statements/let/dstr/obj-init-undefined.js
new file mode 100644
index 0000000000..9bcdb7b965
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-init-undefined.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ let {} = undefined;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-empty.js
new file mode 100644
index 0000000000..f5174f38cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-empty.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+let {} = obj;
+
+assert.sameValue(accessCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..259b172d79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-get-value-err.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ let { poisoned } = poisonedProperty;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..96d7e4b3dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let { arrow = () => {} } = {};
+
+assert.sameValue(arrow.name, 'arrow');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..8d45be754a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {};
+
+assert.sameValue(cls.name, 'cls');
+assert.notSameValue(xCls.name, 'xCls');
+assert.notSameValue(xCls2.name, 'xCls2');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..764d02062a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let { cover = (function () {}), xCover = (0, function() {}) } = {};
+
+assert.sameValue(cover.name, 'cover');
+assert.notSameValue(xCover.name, 'xCover');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..bd7698ad7c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+---*/
+
+let { fn = function () {}, xFn = function x() {} } = {};
+
+assert.sameValue(fn.name, 'fn');
+assert.notSameValue(xFn.name, 'xFn');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..700bbfb1f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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).
+
+---*/
+
+let { gen = function* () {}, xGen = function* x() {} } = {};
+
+assert.sameValue(gen.name, 'gen');
+assert.notSameValue(xGen.name, 'xGen');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..0193b5dc2d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-skipped.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+}
+
+let { w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..55cfae552c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-throws.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Error thrown when evaluating the initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ let { x = thrower() } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..9c3114d452
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ let { x = unresolvableReference } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..30c9ffde34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+let { x, } = { x: 23 };
+
+assert.sameValue(x, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-list-err.js
new file mode 100644
index 0000000000..92c5711bcb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-list-err.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ let { a, b = thrower(), c = ++initCount } = {};
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..4d452c8f29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-init.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let { w: [x, y, z] = [4, 5, 6] } = {};
+
+assert.sameValue(x, 4);
+assert.sameValue(y, 5);
+assert.sameValue(z, 6);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..a93be03616
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+let { x: [y], } = { x: [45] };
+
+assert.sameValue(y,45);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..814e2eba2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ let { w: [x, y, z] = [4, 5, 6] } = { w: null };
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..76da804abf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-ary.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let { w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] };
+
+assert.sameValue(x, 7);
+assert.sameValue(y, undefined);
+assert.sameValue(z, undefined);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..1f58ab7c97
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-eval-err.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ let { [thrower()]: x } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..3ee31ad290
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ let { poisoned: x = ++initEvalCount } = poisonedProperty;
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..aef6d1236e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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;
+}
+
+let { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..986106e695
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Error thrown when evaluating the initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ let { x: y = thrower() } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..38d7d93e19
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ let { x: y = unresolvableReference } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..3e38ddd047
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-init.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+let { x: y = 33 } = { };
+
+assert.sameValue(y, 33);
+assert.throws(ReferenceError, function() {
+ x;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..f4f096c0a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+let { x: y, } = { x: 23 };
+
+assert.sameValue(y, 23);
+
+assert.throws(ReferenceError, function() {
+ x;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..916ce1d723
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-id.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Binding as specified via property name and identifier (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+let { x: y } = { x: 23 };
+
+assert.sameValue(y, 23);
+assert.throws(ReferenceError, function() {
+ x;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..ff3b9aa914
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-init.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined };
+
+assert.sameValue(x, 4);
+assert.sameValue(y, 5);
+assert.sameValue(z, 6);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..adbfb90561
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null };
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..714119a6f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/let-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+assert.throws(TypeError, function() {
+ let { w: { x, y, z } = undefined } = { };
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..e9274d324b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-prop-obj.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env 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.
+---*/
+
+let { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } };
+
+assert.sameValue(x, undefined);
+assert.sameValue(y, undefined);
+assert.sameValue(z, 7);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..83b6b5c774
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-getter.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+var count = 0;
+
+let {...x} = { get v() { count++; return 2; } };
+
+assert.sameValue(count, 1);
+
+verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..a1819d293e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+let {...rest} = o;
+
+assert.sameValue(rest.x, undefined);
+
+verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+});
+
+verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..456f5e1811
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/obj-ptrn-rest-val-obj.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/let-stmt.template
+/*---
+description: Rest object contains just unextracted data (`let` statement)
+esid: sec-let-and-const-declarations-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ LexicalBinding : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let value be GetValue(rhs).
+ 3. ReturnIfAbrupt(value).
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Return the result of performing BindingInitialization for BindingPattern
+ using value and env as the arguments.
+---*/
+
+let {a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3};
+
+assert.sameValue(rest.a, undefined);
+assert.sameValue(rest.b, undefined);
+
+verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+});
+
+verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/dstr/shell.js b/js/src/tests/test262/language/statements/let/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/let/fn-name-arrow.js b/js/src/tests/test262/language/statements/let/fn-name-arrow.js
new file mode 100644
index 0000000000..d83d9fa27b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/fn-name-arrow.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: Assignment of function `name` attribute (ArrowFunction)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+---*/
+
+let arrow = () => {};
+
+assert.sameValue(arrow.name, 'arrow');
+verifyNotEnumerable(arrow, 'name');
+verifyNotWritable(arrow, 'name');
+verifyConfigurable(arrow, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/fn-name-class.js b/js/src/tests/test262/language/statements/let/fn-name-class.js
new file mode 100644
index 0000000000..26af323891
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/fn-name-class.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: Assignment of function `name` attribute (ClassExpression)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+features: [class]
+---*/
+
+let xCls = class x {};
+let cls = class {};
+let xCls2 = class { static name() {} };
+
+assert.notSameValue(xCls.name, 'xCls');
+assert.notSameValue(xCls2.name, 'xCls2');
+
+assert.sameValue(cls.name, 'cls');
+verifyNotEnumerable(cls, 'name');
+verifyNotWritable(cls, 'name');
+verifyConfigurable(cls, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/fn-name-cover.js b/js/src/tests/test262/language/statements/let/fn-name-cover.js
new file mode 100644
index 0000000000..e997179639
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/fn-name-cover.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: >
+ Assignment of function `name` attribute (CoverParenthesizedExpression)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+---*/
+
+let xCover = (0, function() {});
+let cover = (function() {});
+
+assert(xCover.name !== 'xCover');
+
+assert.sameValue(cover.name, 'cover');
+verifyNotEnumerable(cover, 'name');
+verifyNotWritable(cover, 'name');
+verifyConfigurable(cover, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/fn-name-fn.js b/js/src/tests/test262/language/statements/let/fn-name-fn.js
new file mode 100644
index 0000000000..608fe2f6b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/fn-name-fn.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: Assignment of function `name` attribute (FunctionExpression)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+---*/
+
+let xFn = function x() {};
+let fn = function() {};
+
+assert(xFn.name !== 'xFn');
+
+assert.sameValue(fn.name, 'fn');
+verifyNotEnumerable(fn, 'name');
+verifyNotWritable(fn, 'name');
+verifyConfigurable(fn, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/fn-name-gen.js b/js/src/tests/test262/language/statements/let/fn-name-gen.js
new file mode 100644
index 0000000000..849c852637
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/fn-name-gen.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.1.4
+description: Assignment of function `name` attribute (GeneratorExpression)
+info: |
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+features: [generators]
+---*/
+
+let xGen = function* x() {};
+let gen = function*() {};
+
+assert(xGen.name !== 'xGen');
+
+assert.sameValue(gen.name, 'gen');
+verifyNotEnumerable(gen, 'name');
+verifyNotWritable(gen, 'name');
+verifyConfigurable(gen, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/function-local-closure-get-before-initialization.js b/js/src/tests/test262/language/statements/let/function-local-closure-get-before-initialization.js
new file mode 100644
index 0000000000..f8c3bbddbc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/function-local-closure-get-before-initialization.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: function local closure [[Get]] before initialization.
+ (TDZ, Temporal Dead Zone)
+---*/
+(function() {
+ function f() { return x + 1; }
+
+ assert.throws(ReferenceError, function() {
+ f();
+ });
+
+ let x;
+}());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/function-local-closure-set-before-initialization.js b/js/src/tests/test262/language/statements/let/function-local-closure-set-before-initialization.js
new file mode 100644
index 0000000000..8c9118b8c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/function-local-closure-set-before-initialization.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: function local closure [[Set]] before initialization.
+ (TDZ, Temporal Dead Zone)
+---*/
+(function() {
+ function f() { x = 1; }
+
+ assert.throws(ReferenceError, function() {
+ f();
+ });
+
+ let x;
+}());
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/function-local-use-before-initialization-in-declaration-statement.js b/js/src/tests/test262/language/statements/let/function-local-use-before-initialization-in-declaration-statement.js
new file mode 100644
index 0000000000..74dd7dca71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/function-local-use-before-initialization-in-declaration-statement.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: function local use before initialization in declaration statement.
+ (TDZ, Temporal Dead Zone)
+---*/
+assert.throws(ReferenceError, function() {
+ (function() {
+ let x = x + 1;
+ }());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/function-local-use-before-initialization-in-prior-statement.js b/js/src/tests/test262/language/statements/let/function-local-use-before-initialization-in-prior-statement.js
new file mode 100644
index 0000000000..eb4c8eff99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/function-local-use-before-initialization-in-prior-statement.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: function local use before initialization in prior statement.
+ (TDZ, Temporal Dead Zone)
+---*/
+assert.throws(ReferenceError, function() {
+ (function() {
+ x; let x;
+ }());
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/global-closure-get-before-initialization.js b/js/src/tests/test262/language/statements/let/global-closure-get-before-initialization.js
new file mode 100644
index 0000000000..55b667d8ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/global-closure-get-before-initialization.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: global closure [[Get]] before initialization.
+ (TDZ, Temporal Dead Zone)
+---*/
+function f() { return x + 1; }
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+let x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/global-closure-set-before-initialization.js b/js/src/tests/test262/language/statements/let/global-closure-set-before-initialization.js
new file mode 100644
index 0000000000..a1db51c8b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/global-closure-set-before-initialization.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: global closure [[Set]] before initialization.
+ (TDZ, Temporal Dead Zone)
+---*/
+function f() { x = 1; }
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+let x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/global-use-before-initialization-in-declaration-statement.js b/js/src/tests/test262/language/statements/let/global-use-before-initialization-in-declaration-statement.js
new file mode 100644
index 0000000000..ff38195a70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/global-use-before-initialization-in-declaration-statement.js
@@ -0,0 +1,13 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: global use before initialization in declaration statement.
+ (TDZ, Temporal Dead Zone)
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+let x = x + 1;
diff --git a/js/src/tests/test262/language/statements/let/global-use-before-initialization-in-prior-statement.js b/js/src/tests/test262/language/statements/let/global-use-before-initialization-in-prior-statement.js
new file mode 100644
index 0000000000..c8487a32cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/global-use-before-initialization-in-prior-statement.js
@@ -0,0 +1,13 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: global use before initialization in prior statement.
+ (TDZ, Temporal Dead Zone)
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+x; let x;
diff --git a/js/src/tests/test262/language/statements/let/redeclaration-error-from-within-strict-mode-function.js b/js/src/tests/test262/language/statements/let/redeclaration-error-from-within-strict-mode-function.js
new file mode 100644
index 0000000000..6a60c8f343
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/redeclaration-error-from-within-strict-mode-function.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ Redeclaration error within strict mode function inside non-strict code.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+(function() { 'use strict'; { let f; var f; } })
+
diff --git a/js/src/tests/test262/language/statements/let/shell.js b/js/src/tests/test262/language/statements/let/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/shell.js
diff --git a/js/src/tests/test262/language/statements/let/static-init-await-binding-invalid.js b/js/src/tests/test262/language/statements/let/static-init-await-binding-invalid.js
new file mode 100644
index 0000000000..842867b48b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/static-init-await-binding-invalid.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: BindingIdentifier may not be `await` within class static blocks
+info: |
+ BindingIdentifier : Identifier
+
+ [...]
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ let await;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/let/static-init-await-binding-valid.js b/js/src/tests/test262/language/statements/let/static-init-await-binding-valid.js
new file mode 100644
index 0000000000..e6a531cd3d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/static-init-await-binding-valid.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The `await` keyword is interpreted as an identifier within arrow function bodies
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ [...]
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+features: [class-static-block]
+---*/
+
+class C {
+ static {
+ (() => { let await; });
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/browser.js b/js/src/tests/test262/language/statements/let/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/browser.js
diff --git a/js/src/tests/test262/language/statements/let/syntax/escaped-let.js b/js/src/tests/test262/language/statements/let/syntax/escaped-let.js
new file mode 100644
index 0000000000..04c60ff840
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/escaped-let.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-grammar-notation
+description: >
+ The `let` contextual keyword must not contain Unicode escape sequences.
+info: |
+ Terminal symbols are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+flags: [noStrict]
+---*/
+
+// Add a global property "let", so we won't get a runtime reference error below.
+this.let = 0;
+
+l\u0065t // ASI
+a;
+
+// If the parser treated the previous escaped "let" as a lexical declaration,
+// this variable declaration will result an early syntax error.
+var a;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict-strict.js b/js/src/tests/test262/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict-strict.js
new file mode 100644
index 0000000000..3d8af4f80e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.0.1
+description: >
+ for declaration:
+ identifier "let" disallowed as lefthandside expression in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+var o = { a: 1 };
+for (let in o) { }
+
diff --git a/js/src/tests/test262/language/statements/let/syntax/identifier-let-disallowed-as-boundname.js b/js/src/tests/test262/language/statements/let/syntax/identifier-let-disallowed-as-boundname.js
new file mode 100644
index 0000000000..f93207d844
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/identifier-let-disallowed-as-boundname.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.6.4.1
+description: >
+ It is a Syntax Error if the BoundNames of ForDeclaration contains "let".
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+for (let let in {}) { }
+
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-condition.js b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-condition.js
new file mode 100644
index 0000000000..e0d20e129e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-condition.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: closure inside for loop condition
+---*/
+let a = [];
+for (let i = 0; a.push(function () { return i; }), i < 5; ++i) { }
+for (let k = 0; k < 5; ++k) {
+ assert.sameValue(k, a[k]());
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-initialization.js b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-initialization.js
new file mode 100644
index 0000000000..29322ec1e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-initialization.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: closure inside for loop initialization
+---*/
+let a = [];
+for (let i = 0, f = function() { return i }; i < 5; ++i) {
+ a.push(f);
+}
+for (let k = 0; k < 5; ++k) {
+ assert.sameValue(0, a[k]());
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-next-expression.js b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-next-expression.js
new file mode 100644
index 0000000000..e2d7a08ead
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-next-expression.js
@@ -0,0 +1,14 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let: closure inside for loop next-expression
+---*/
+let a = [];
+for (let i = 0; i < 5; a.push(function () { return i; }), ++i) { }
+for (let k = 0; k < 5; ++k) {
+ assert.sameValue(k + 1, a[k]());
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js b/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js
new file mode 100644
index 0000000000..99b7421991
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ In a normal for statement the iteration variable is freshly allocated for each iteration. Multi let binding
+---*/
+let a = [], b = [];
+for (let i = 0, j = 10; i < 5; ++i, ++j) {
+ a.push(function () { return i; });
+ b.push(function () { return j; });
+}
+for (let k = 0; k < 5; ++k) {
+ assert.sameValue(k, a[k]());
+ assert.sameValue(k + 10, b[k]());
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js b/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js
new file mode 100644
index 0000000000..33cc84c50a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ In a normal for statement the iteration variable is freshly allocated for each iteration. Single let binding
+---*/
+let a = [];
+for (let i = 0; i < 5; ++i) {
+ a.push(function () { return i; });
+}
+for (let j = 0; j < 5; ++j) {
+ assert.sameValue(j, a[j]());
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-split-across-two-lines.js b/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-split-across-two-lines.js
new file mode 100644
index 0000000000..ffc309bf53
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-split-across-two-lines.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2015 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Jeff Walden
+es6id: 13.3.1.1
+description: >
+ let: |let let| split across two lines is not subject to automatic semicolon insertion.
+info: |
+ |let| followed by a name is a lexical declaration. This is so even if the
+ name is on a new line. ASI applies *only* if an offending token not allowed
+ by the grammar is encountered, and there's no [no LineTerminator here]
+ restriction in LexicalDeclaration or ForDeclaration forbidding a line break.
+
+ It's a tricky point, but this is true *even if* the name is "let", a name that
+ can't be bound by LexicalDeclaration or ForDeclaration. Per 5.3, static
+ semantics early errors are validated *after* determining productions matching
+ the source text.
+
+ So in this testcase, the eval text matches LexicalDeclaration. No ASI occurs,
+ because "let\nlet = ..." matches LexicalDeclaration before static semantics
+ are considered. *Then* 13.3.1.1's static semantics for the LexicalDeclaration
+ just chosen, per 5.3, are validated to recognize the Script as invalid. Thus
+ the eval script can't be evaluated, and a SyntaxError is thrown.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+let // start of a LexicalDeclaration, *not* an ASI opportunity
+let;
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js b/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js
new file mode 100644
index 0000000000..28d5758eb9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2015 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Jeff Walden
+es6id: 13.3.1.1
+description: >
+ let: |let let| split across two lines is not subject to automatic semicolon insertion.
+info: |
+ |let| followed by a name is a lexical declaration. This is so even if the
+ name is on a new line. ASI applies *only* if an offending token not allowed
+ by the grammar is encountered, and there's no [no LineTerminator here]
+ restriction in LexicalDeclaration or ForDeclaration forbidding a line break.
+
+ It's a tricky point, but this is true *even if* the name is "let", a name that
+ can't be bound by LexicalDeclaration or ForDeclaration. Per 5.3, static
+ semantics early errors are validated *after* determining productions matching
+ the source text.
+
+ So in this testcase, the eval text matches LexicalDeclaration. No ASI occurs,
+ because "let\nlet = ..." matches LexicalDeclaration before static semantics
+ are considered. *Then* 13.3.1.1's static semantics for the LexicalDeclaration
+ just chosen, per 5.3, are validated to recognize the Script as invalid. Thus
+ the eval script can't be evaluated, and a SyntaxError is thrown.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+let // start of a LexicalDeclaration, *not* an ASI opportunity
+let = "irrelevant initializer";
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-newline-await-in-normal-function.js b/js/src/tests/test262/language/statements/let/syntax/let-newline-await-in-normal-function.js
new file mode 100644
index 0000000000..aa3735d09a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-newline-await-in-normal-function.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Jeff Walden <jwalden+code@mit.edu>
+esid: sec-let-and-const-declarations
+description: >
+ `let await` does not permit ASI in between, as `await` is a BindingIdentifier
+info: |
+ `await` is a perfectly cromulent binding name in any context grammatically, just
+ prohibited by static semantics in some contexts. Therefore ASI can never apply
+ between `let` (where a LexicalDeclaration is permitted) and `await`,
+ so a subsequent `0` where `=` was expected is a syntax error.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ let
+ await 0;
+}
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-generator-function.js b/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-generator-function.js
new file mode 100644
index 0000000000..86a3c429bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-generator-function.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Jeff Walden <jwalden+code@mit.edu>
+esid: sec-let-and-const-declarations
+description: >
+ `let yield` does not permit ASI in between, as `yield` is a BindingIdentifier
+info: |
+ `yield` is a perfectly cromulent binding name in any context grammatically, just
+ prohibited by static semantics in some contexts. Therefore ASI can never apply
+ between `let` (where a LexicalDeclaration is permitted) and `yield`,
+ so a subsequent `0` where `=` was expected is a syntax error.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+function* f() {
+ let
+ yield 0;
+}
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-normal-function.js b/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-normal-function.js
new file mode 100644
index 0000000000..fdf257f95f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-normal-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-let-and-const-declarations
+description: >
+ `let yield` does not permit ASI in between, as `yield` is a BindingIdentifier
+info: |
+ `yield` is a perfectly cromulent binding name in any context grammatically, just
+ prohibited by static semantics in some contexts. Therefore ASI can never apply
+ between `let` (where a LexicalDeclaration is permitted) and `yield`,
+ so a subsequent `0` where `=` was expected is a syntax error.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ let
+ yield 0;
+}
diff --git a/js/src/tests/test262/language/statements/let/syntax/let-outer-inner-let-bindings.js b/js/src/tests/test262/language/statements/let/syntax/let-outer-inner-let-bindings.js
new file mode 100644
index 0000000000..ece8f016ef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let-outer-inner-let-bindings.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ outer let binding unchanged by for-loop let binding
+---*/
+//
+
+let x = "outer_x";
+let y = "outer_y";
+
+for (let x = "inner_x", i = 0; i < 1; i++) {
+ let y = "inner_y";
+
+ assert.sameValue(x, "inner_x");
+ assert.sameValue(y, "inner_y");
+}
+assert.sameValue(x, "outer_x");
+assert.sameValue(y, "outer_y");
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/let.js b/js/src/tests/test262/language/statements/let/syntax/let.js
new file mode 100644
index 0000000000..cf9bd1b53c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/let.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ global and block scope let
+---*/
+let x;
+let y = 2;
+
+// Block local
+{
+ let y;
+ let x = 3;
+}
+
+assert.sameValue(x, undefined);
+assert.sameValue(y, 2);
+
+if (true) {
+ let y;
+ assert.sameValue(y, undefined);
+}
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/shell.js b/js/src/tests/test262/language/statements/let/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/shell.js
diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-case-expression-statement-list.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-case-expression-statement-list.js
new file mode 100644
index 0000000000..79a17ed3c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-case-expression-statement-list.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations with initialisers in statement positions:
+ case Expression : StatementList
+---*/
+switch (true) { case true: let x = 1; }
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-default-statement-list.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-default-statement-list.js
new file mode 100644
index 0000000000..0788ee9d8d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-default-statement-list.js
@@ -0,0 +1,12 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations with initialisers in statement positions:
+ default : StatementList
+---*/
+switch (true) { default: let x = 1; }
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-do-statement-while-expression.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-do-statement-while-expression.js
new file mode 100644
index 0000000000..f452223e92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-do-statement-while-expression.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations with initialisers in statement positions:
+ do Statement while ( Expression )
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+do let x = 1; while (false)
diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-for-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-for-statement.js
new file mode 100644
index 0000000000..cc0d1cd796
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-for-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations with initialisers in statement positions:
+ for ( ;;) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+for (;false;) let x = 1;
diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js
new file mode 100644
index 0000000000..72ef204832
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations with initialisers in statement positions:
+ if ( Expression ) Statement else Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+if (true) {} else let x = 1;
diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement.js
new file mode 100644
index 0000000000..f0b34129e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations with initialisers in statement positions:
+ if ( Expression ) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+if (true) let x = 1;
diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-label-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-label-statement.js
new file mode 100644
index 0000000000..55336769c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-label-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations with initialisers in statement positions:
+ label: Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+label: let x = 1;
diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-while-expression-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-while-expression-statement.js
new file mode 100644
index 0000000000..eb2f85897e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-while-expression-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations with initialisers in statement positions:
+ while ( Expression ) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+while (false) let x = 1;
diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-case-expression-statement-list.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-case-expression-statement-list.js
new file mode 100644
index 0000000000..089beebeb3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-case-expression-statement-list.js
@@ -0,0 +1,11 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations without initialisers in statement positions:
+ case Expression : StatementList
+---*/
+switch (true) { case true: let x; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-default-statement-list.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-default-statement-list.js
new file mode 100644
index 0000000000..128f3cb6ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-default-statement-list.js
@@ -0,0 +1,11 @@
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations without initialisers in statement positions:
+ default : StatementList
+---*/
+switch (true) { default: let x; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-do-statement-while-expression.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-do-statement-while-expression.js
new file mode 100644
index 0000000000..568b4463b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-do-statement-while-expression.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations without initialisers in statement positions:
+ do Statement while ( Expression )
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+do let x; while (false)
diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-for-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-for-statement.js
new file mode 100644
index 0000000000..1730e07c1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-for-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations without initialisers in statement positions:
+ for ( ;;) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+for (;false;) let x;
diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js
new file mode 100644
index 0000000000..bf634c5103
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations without initialisers in statement positions:
+ if ( Expression ) Statement else Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+if (true) {} else let x;
diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement.js
new file mode 100644
index 0000000000..8c9ad1e56b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations without initialisers in statement positions:
+ if ( Expression ) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+if (true) let x;
diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-label-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-label-statement.js
new file mode 100644
index 0000000000..7298a666ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-label-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations without initialisers in statement positions:
+ label: Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+label: let x;
diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-while-expression-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-while-expression-statement.js
new file mode 100644
index 0000000000..705e47e5d6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-while-expression-statement.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2011 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.1
+description: >
+ let declarations without initialisers in statement positions:
+ while ( Expression ) Statement
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+while (false) let x;
diff --git a/js/src/tests/test262/language/statements/return/12.9-1.js b/js/src/tests/test262/language/statements/return/12.9-1.js
new file mode 100644
index 0000000000..8d14087994
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/12.9-1.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.9-1
+description: >
+ The return Statement - a return statement without an expression
+ may have a LineTerminator before the semi-colon
+---*/
+
+ var sum = 0;
+ (function innerTest() {
+ for (var i = 1; i <= 10; i++) {
+ if (i === 6) {
+ return
+ ;
+ }
+ sum += i;
+ }
+ })();
+
+assert.sameValue(sum, 15, 'sum');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T1.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T1.js
new file mode 100644
index 0000000000..2205a4163e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T1.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T1
+description: Checking if execution of "return" with no function fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x=1;
+return;
+var y=2;
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T10.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T10.js
new file mode 100644
index 0000000000..b62da2f4a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T10.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T10
+description: Checking if execution of "return (0)" with no function fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+return (0);
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T2.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T2.js
new file mode 100644
index 0000000000..b20861a898
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T2.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T2
+description: Checking if execution of "return x" with no function fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x=1;
+return x;
+var y=2;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T3.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T3.js
new file mode 100644
index 0000000000..72d67624aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T3.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T3
+description: Checking if execution of "return" within "try" statement fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ return 1;
+} catch(e){
+ return 1;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T4.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T4.js
new file mode 100644
index 0000000000..bc16285c74
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T4.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T4
+description: Checking if execution of "return" with no function fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+return;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T5.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T5.js
new file mode 100644
index 0000000000..b6b3b653cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T5.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T5
+description: >
+ Checking if execution of "return" with no function, placed into a
+ Block, fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+{
+ var x=1;
+ return;
+ var y=2;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T6.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T6.js
new file mode 100644
index 0000000000..af898c5830
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T6.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T6
+description: >
+ Checking if execution of "return" with no function, placed into a
+ loop, fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do {
+ var x=1;
+ return;
+ var y=2;
+} while(0);
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T7.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T7.js
new file mode 100644
index 0000000000..e4ba4e3ef6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T7.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T7
+description: >
+ Checking if execution of "return x" with no function, placed
+ inside Block, fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+{
+ var x=1;
+ return x;
+ var y=2;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T8.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T8.js
new file mode 100644
index 0000000000..2d7d918549
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T8.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T8
+description: >
+ Checking if execution of "return x" with no function, placed into
+ a loop, fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+do {
+ var x=1;
+ return x;
+ var y=2;
+} while(0);
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A1_T9.js b/js/src/tests/test262/language/statements/return/S12.9_A1_T9.js
new file mode 100644
index 0000000000..5ba06d10cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A1_T9.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Appearing of "return" without a function body leads to syntax error
+es5id: 12.9_A1_T9
+description: Checking if execution of "return", placed into a catch Block, fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ throw 1;
+} catch(e){
+ return e;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A3.js b/js/src/tests/test262/language/statements/return/S12.9_A3.js
new file mode 100644
index 0000000000..979dd039d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A3.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: If Expression is omitted, the return value is undefined
+es5id: 12.9_A3
+description: Return without Expression
+---*/
+
+var __evaluated;
+__evaluated = (function (){return;})();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__evaluated !== undefined) {
+ throw new Test262Error('#1: If Expression is omitted, the return value is undefined');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A4.js b/js/src/tests/test262/language/statements/return/S12.9_A4.js
new file mode 100644
index 0000000000..1e808efd75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A4.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production ReturnStatement : return Expression; is evaluated as:
+ i) Evaluate Expression.
+ ii) Call GetValue(Result(2)).
+ iii) Return (return, Result(3), empty)
+es5id: 12.9_A4
+description: Return very sophisticated expression and function
+---*/
+
+// second derivative
+function DD_operator(f, delta){return function(x){return (f(x+delta)-2*f(x)+f(x-delta))/(delta*delta)};}
+
+var DDsin;
+DDsin = DD_operator(Math.sin, 0.00001);
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+// ((sin(x))')' = -sin(x)
+if (DDsin( Math.PI/2 ) + Math.sin( Math.PI/2 ) > 0.00001) {
+ throw new Test262Error('#1: return Expression yields to Return (return, GetValue(Evaluate Expression), empty)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/return/S12.9_A5.js b/js/src/tests/test262/language/statements/return/S12.9_A5.js
new file mode 100644
index 0000000000..8adf1f9140
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/S12.9_A5.js
@@ -0,0 +1,40 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Code after ReturnStatement is not evaluated
+es5id: 12.9_A5
+description: Using code after Return statement
+---*/
+
+//CHECK#1
+var x1=1;
+function myfunc1(){
+ x1++;
+ return;
+ x1*=2;
+}
+myfunc1();
+if (x1!==2) throw new Test262Error('#1: x1 === 2. Actual: x1 ==='+ x1 );
+
+//CHECK#2
+var x2=1;
+function myfunc2(){
+ x2++;
+ return x2;
+ x2*=2;
+}
+myfunc2();
+if (x2!==2) throw new Test262Error('#2: x2 === 2. Actual: x2 ==='+ x2 );
+
+//CHECK#3
+var x3=1;
+function myfunc3(){
+ x3++;
+ return;
+ return x3;
+ x3*=2;
+}
+if (myfunc3()!==undefined) throw new Test262Error('#3: myfunc3() === undefined. Actual: myfunc3() ==='+ myfunc3() );
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/return/browser.js b/js/src/tests/test262/language/statements/return/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/browser.js
diff --git a/js/src/tests/test262/language/statements/return/line-terminators.js b/js/src/tests/test262/language/statements/return/line-terminators.js
new file mode 100644
index 0000000000..6af7ff9af9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/line-terminators.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ LineTerminator between return and Identifier_opt yields return without
+ Identifier_opt
+es5id: 12.9_A2
+description: Inserting LineTerminator between return and Variable
+---*/
+
+assert.sameValue(
+ function(){ return
+1; }(),
+ undefined,
+ "#1: LineTerminator(U-000A) between return and Identifier_opt yields return without Identifier_opt"
+);
+
+assert.sameValue(
+ function(){ return 1; }(),
+ undefined,
+ "#1: LineTerminator(U-000D) between return and Identifier_opt yields return without Identifier_opt"
+);
+
+
+assert.sameValue(
+ function(){ return
1; }(),
+ undefined,
+ "#1: LineTerminator(U-2028) between return and Identifier_opt yields return without Identifier_opt"
+);
+
+assert.sameValue(
+ function(){ return
1; }(),
+ undefined,
+ "#1: LineTerminator(U-2029) between return and Identifier_opt yields return without Identifier_opt"
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/return/shell.js b/js/src/tests/test262/language/statements/return/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/return/tco-strict.js b/js/src/tests/test262/language/statements/return/tco-strict.js
new file mode 100644
index 0000000000..619cfdfb7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/return/tco-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ return f(n - 1);
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/shell.js b/js/src/tests/test262/language/statements/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/shell.js
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A1_T1.js b/js/src/tests/test262/language/statements/switch/S12.11_A1_T1.js
new file mode 100644
index 0000000000..7313278b82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A1_T1.js
@@ -0,0 +1,75 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Result.type is break and Result.target is in the current
+ label set, return (normal, Result.value, empty)
+es5id: 12.11_A1_T1
+description: Simple test using switch statement
+---*/
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ break;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case 4:
+ result += 64;
+ }
+
+ return result;
+}
+
+if(!(SwitchTest(0) === 6)){
+ throw new Test262Error("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) );
+}
+
+if(!(SwitchTest(1) === 4)){
+ throw new Test262Error("#2: SwitchTest(1) === 4. Actual: SwitchTest(1) ==="+ SwitchTest(1) );
+}
+
+if(!(SwitchTest(2) === 56)){
+ throw new Test262Error("#3: SwitchTest(2) === 56. Actual: SwitchTest(2) ==="+ SwitchTest(2) );
+}
+
+if(!(SwitchTest(3) === 48)){
+ throw new Test262Error("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) );
+}
+
+if(!(SwitchTest(4) === 64)){
+ throw new Test262Error("#5: SwitchTest(4) === 64. Actual: SwitchTest(4) ==="+ SwitchTest(4) );
+}
+
+if(!(SwitchTest(true) === 32)){
+ throw new Test262Error("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) );
+}
+
+if(!(SwitchTest(false) === 32)){
+ throw new Test262Error("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) );
+}
+
+if(!(SwitchTest(null) === 32)){
+ throw new Test262Error("#8: SwitchTest(null) === 32. Actual: SwitchTest(null) ==="+ SwitchTest(null) );
+}
+
+if(!(SwitchTest(void 0) === 32)){
+ throw new Test262Error("#9: SwitchTest(void 0) === 32. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) );
+}
+
+if(!(SwitchTest('0') === 32)){
+ throw new Test262Error("#10: SwitchTest('0') === 32. Actual: SwitchTest('0') ==="+ SwitchTest('0') );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A1_T2.js b/js/src/tests/test262/language/statements/switch/S12.11_A1_T2.js
new file mode 100644
index 0000000000..43e524e89c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A1_T2.js
@@ -0,0 +1,89 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Result.type is break and Result.target is in the current
+ label set, return (normal, Result.value, empty)
+es5id: 12.11_A1_T2
+description: Switch with different types of variables
+---*/
+
+var x = new Number(2);
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ case '1':
+ result += 4;
+ break;
+ case new Number(2):
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case 4:
+ result += 64;
+ break;
+ case x:
+ result += 128;
+ break;
+ case 0:
+ result += 256;
+ case 1:
+ result += 512;
+ }
+
+ return result;
+}
+
+if(!(SwitchTest(0) === 6)){
+ throw new Test262Error("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) );
+}
+
+if(!(SwitchTest(1) === 512)){
+ throw new Test262Error("#2: SwitchTest(1) === 512. Actual: SwitchTest(1) ==="+ SwitchTest(1) );
+}
+
+if(!(SwitchTest(2) === 32)){
+ throw new Test262Error("#3: SwitchTest(2) === 32. Actual: SwitchTest(2) ==="+ SwitchTest(2) );
+}
+
+if(!(SwitchTest(3) === 48)){
+ throw new Test262Error("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) );
+}
+
+if(!(SwitchTest(4) === 64)){
+ throw new Test262Error("#5: SwitchTest(4) === 64. Actual: SwitchTest(4) ==="+ SwitchTest(4) );
+}
+
+if(!(SwitchTest(true) === 32)){
+ throw new Test262Error("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) );
+}
+
+if(!(SwitchTest(false) === 32)){
+ throw new Test262Error("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) );
+}
+
+if(!(SwitchTest(null) === 32)){
+ throw new Test262Error("#8: SwitchTest(null) === 32. Actual: SwitchTest(null) ==="+ SwitchTest(null) );
+}
+
+if(!(SwitchTest(void 0) === 32)){
+ throw new Test262Error("#9: SwitchTest(void 0) === 32. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) );
+}
+
+if(!(SwitchTest('0') === 32)){
+ throw new Test262Error("#10: SwitchTest('0') === 32. Actual: SwitchTest('0') ==="+ SwitchTest('0') );
+}
+
+if(!(SwitchTest(x) === 128)){
+ throw new Test262Error("#10: SwitchTest(x) === 128. Actual: SwitchTest(x) ==="+ SwitchTest(x) );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A1_T3.js b/js/src/tests/test262/language/statements/switch/S12.11_A1_T3.js
new file mode 100644
index 0000000000..62298e3d65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A1_T3.js
@@ -0,0 +1,93 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Result.type is break and Result.target is in the current
+ label set, return (normal, Result.value, empty)
+es5id: 12.11_A1_T3
+description: Using case with null, NaN, Infinity
+---*/
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ break;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case null:
+ result += 64;
+ case NaN:
+ result += 128;
+ break;
+ case Infinity:
+ result += 256;
+ case 2+3:
+ result += 512;
+ break;
+ case undefined:
+ result += 1024;
+ }
+
+ return result;
+}
+
+if(!(SwitchTest(0) === 6)){
+ throw new Test262Error("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) );
+}
+
+if(!(SwitchTest(1) === 4)){
+ throw new Test262Error("#2: SwitchTest(1) === 4. Actual: SwitchTest(1) ==="+ SwitchTest(1) );
+}
+
+if(!(SwitchTest(2) === 56)){
+ throw new Test262Error("#3: SwitchTest(2) === 56. Actual: SwitchTest(2) ==="+ SwitchTest(2) );
+}
+
+if(!(SwitchTest(3) === 48)){
+ throw new Test262Error("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) );
+}
+
+if(!(SwitchTest(4) === 32)){
+ throw new Test262Error("#5: SwitchTest(4) === 32. Actual: SwitchTest(4) ==="+ SwitchTest(4) );
+}
+
+if(!(SwitchTest(5) === 512)){
+ throw new Test262Error("#5: SwitchTest(5) === 512. Actual: SwitchTest(5) ==="+ SwitchTest(5) );
+}
+
+if(!(SwitchTest(true) === 32)){
+ throw new Test262Error("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) );
+}
+
+if(!(SwitchTest(false) === 32)){
+ throw new Test262Error("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) );
+}
+
+if(!(SwitchTest(null) === 192)){
+ throw new Test262Error("#8: SwitchTest(null) === 192. Actual: SwitchTest(null) ==="+ SwitchTest(null) );
+}
+
+if(!(SwitchTest(void 0) === 1024)){
+ throw new Test262Error("#9: SwitchTest(void 0) === 1024. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) );
+}
+
+if(!(SwitchTest(NaN) === 32)){
+ throw new Test262Error("#10: SwitchTest(NaN) === 32. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
+}
+
+if(!(SwitchTest(Infinity) === 768)){
+ throw new Test262Error("#10: SwitchTest(NaN) === 768. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A1_T4.js b/js/src/tests/test262/language/statements/switch/S12.11_A1_T4.js
new file mode 100644
index 0000000000..8d2c19f49e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A1_T4.js
@@ -0,0 +1,83 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Result.type is break and Result.target is in the current
+ label set, return (normal, Result.value, empty)
+es5id: 12.11_A1_T4
+description: Using case with isNaN and isNaN(value)
+---*/
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ break;
+ case 2:
+ result += 8;
+ case isNaN(value):
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case null:
+ result += 64;
+ case isNaN:
+ result += 128;
+ break;
+ case Infinity:
+ result += 256;
+ case 2+3:
+ result += 512;
+ break;
+ case undefined:
+ result += 1024;
+ }
+
+ return result;
+}
+
+var n = Number(false);
+
+if(!(SwitchTest(n) === 6)){
+ throw new Test262Error("#1: SwitchTest(Number(false)) === 6. Actual: SwitchTest(Number(false)) ==="+ SwitchTest(n) );
+}
+
+if(!(SwitchTest(parseInt) === 32)){
+ throw new Test262Error("#2: SwitchTest(parseInt) === 32. Actual: SwitchTest(parseInt) ==="+ SwitchTest(parseInt) );
+}
+
+if(!(SwitchTest(isNaN) === 128)){
+ throw new Test262Error("#3: SwitchTest(isNaN) === 128. Actual: SwitchTest(isNaN) ==="+ SwitchTest(isNaN) );
+}
+
+if(!(SwitchTest(true) === 32)){
+ throw new Test262Error("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) );
+}
+
+if(!(SwitchTest(false) === 48)){
+ throw new Test262Error("#7: SwitchTest(false) === 48. Actual: SwitchTest(false) ==="+ SwitchTest(false) );
+}
+
+if(!(SwitchTest(null) === 192)){
+ throw new Test262Error("#8: SwitchTest(null) === 192. Actual: SwitchTest(null) ==="+ SwitchTest(null) );
+}
+
+if(!(SwitchTest(void 0) === 1024)){
+ throw new Test262Error("#9: SwitchTest(void 0) === 1024. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) );
+}
+
+if(!(SwitchTest(NaN) === 32)){
+ throw new Test262Error("#10: SwitchTest(NaN) === 32. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
+}
+
+if(!(SwitchTest(Infinity) === 768)){
+ throw new Test262Error("#10: SwitchTest(NaN) === 768. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A2_T1.js b/js/src/tests/test262/language/statements/switch/S12.11_A2_T1.js
new file mode 100644
index 0000000000..293fcf6181
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A2_T1.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: There can be only one DefaultClause
+es5id: 12.11_A2_T1
+description: Duplicate DefaultClause
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T1.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T1.js
new file mode 100644
index 0000000000..80e2a8c7e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T1.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T1
+description: Checking if execution of "switch() {}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch() {
+ case 0:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T2.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T2.js
new file mode 100644
index 0000000000..2605e24aa8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T2.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T2
+description: Checking if execution of "switch {}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch {
+ case 0:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T3.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T3.js
new file mode 100644
index 0000000000..f946e094eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T3.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T3
+description: Checking if execution of "switch(value)" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+switch(value);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T4.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T4.js
new file mode 100644
index 0000000000..369011c9a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T4.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T4
+description: >
+ Using "case" that has no Expresson after it. "CaseClause: case
+ Expression : [StatementList]"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T5.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T5.js
new file mode 100644
index 0000000000..6439de051a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T5.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T5
+description: Introducing statement not followed by "case" keyword
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ result =2;
+ case 0:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A4_T1.js b/js/src/tests/test262/language/statements/switch/S12.11_A4_T1.js
new file mode 100644
index 0000000000..2588709288
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A4_T1.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Embedded syntax constructions of switch statement
+es5id: 12.11_A4_T1
+description: Nesting one "switch" statement into StatementList of the other's
+---*/
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ switch(value) {
+ case 0:
+ result += 3;
+ break;
+ default:
+ result += 32;
+ break;
+ }
+ result *= 2;
+ break;
+ result=3;
+ default:
+ result += 32;
+ break;
+ }
+ return result;
+}
+
+var x = SwitchTest(0);
+if(x!==6) throw new Test262Error("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) );
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/browser.js b/js/src/tests/test262/language/statements/switch/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/browser.js
diff --git a/js/src/tests/test262/language/statements/switch/cptn-a-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-a-abrupt-empty.js
new file mode 100644
index 0000000000..2bd948fd21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-a-abrupt-empty.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the matching case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ 1. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ 2. Else, return Completion(clauseSelector).
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": break; default: }'), undefined
+);
+assert.sameValue(
+ eval('2; switch ("a") { case "a": { 3; break; } default: }'), 3
+);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { case "a": continue; default: } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { case "a": { 6; continue; } default: } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..8fa4a1b125
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ a. If found is false, then
+ [...]
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; case "b": 3; break; default: }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": case "b": 5; break; default: }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; case "b": break; default: }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { case "a": 9; case "b": 10; continue; default: } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { case "a": case "b": 12; continue; default: } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { case "a": 14; case "b": continue; default: } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-nrml.js
new file mode 100644
index 0000000000..2bc7e5f0de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-nrml.js
@@ -0,0 +1,68 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ [...]
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ [...]
+ [...]
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ [...]
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; default: 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": default: 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; default: }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-abrupt-empty.js
new file mode 100644
index 0000000000..b866c73b6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-abrupt-empty.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when case block is empty
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { }
+
+ 1. Return NormalCompletion(undefined).
+---*/
+
+assert.sameValue(eval('1; switch(null) {}'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-b-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-b-abrupt-empty.js
new file mode 100644
index 0000000000..7e3b0ef97b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-b-abrupt-empty.js
@@ -0,0 +1,66 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the matching case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ 2. If clauseSelector is an abrupt completion, then
+ a. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ b. Else, return Completion(clauseSelector).
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ 1. Let R be the result of evaluating CaseClause C.
+ 2. If R.[[value]] is not empty, let V = R.[[value]].
+ 3. If R is an abrupt completion, return
+ Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "a": break; }'), undefined
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: case "a": { 3; break; } }'), 3
+);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { default: case "a": continue; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { default: case "a": { 6; continue; } } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..59d82a569b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ 2. If clauseSelector is an abrupt completion, then
+ a. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ b. Else, return Completion(clauseSelector).
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ 1. Let R be the result of evaluating CaseClause C.
+ 2. If R.[[value]] is not empty, let V = R.[[value]].
+ 3. If R is an abrupt completion, return
+ Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "a": 2; case "b": 3; break; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "a": case "b": 5; break; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { default: case "a": 7; case "b": break; }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { default: case "a": 9; case "b": 10; continue; } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { default: case "a": case "b": 12; continue; } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { default: case "a": 14; case "b": continue; } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-nrml.js
new file mode 100644
index 0000000000..2555aedb54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-nrml.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ 2. If clauseSelector is an abrupt completion, then
+ a. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ b. Else, return Completion(clauseSelector).
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ 1. Let R be the result of evaluating CaseClause C.
+ 2. If R.[[value]] is not empty, let V = R.[[value]].
+ 3. If R is an abrupt completion, return
+ Completion(UpdateEmpty(R, V)).
+ 8. If foundInB is true, return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "a": 2; case "b": 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "a": case "b": 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { default: case "a": 7; case "b": }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-b-final.js b/js/src/tests/test262/language/statements/switch/cptn-b-final.js
new file mode 100644
index 0000000000..90b0419e13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-b-final.js
@@ -0,0 +1,80 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when the final case matches
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ 2. If clauseSelector is an abrupt completion, then
+ a. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ b. Else, return Completion(clauseSelector).
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ 1. Let R be the result of evaluating CaseClause C.
+ 2. If R.[[value]] is not empty, let V = R.[[value]].
+ 3. If R is an abrupt completion, return
+ Completion(UpdateEmpty(R, V)).
+ 8. If foundInB is true, return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "a": }'),
+ undefined,
+ 'empty StatementList (lone case)'
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: case "a": 3; }'),
+ 3,
+ 'non-empy StatementList (lone case)'
+);
+assert.sameValue(
+ eval('4; switch ("b") { default: case "a": case "b": }'),
+ undefined,
+ 'empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('5; switch ("b") { default: case "a": case "b": 6; }'),
+ 6,
+ 'non-empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('7; switch ("b") { default: case "a": 8; case "b": }'),
+ undefined,
+ 'empty StatementList (following a non-empty case)'
+);
+assert.sameValue(
+ eval('9; switch ("b") { default: case "a": 10; case "b": 11; }'),
+ 11,
+ 'non-empty StatementList (following a non-empty case)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-abrupt-empty.js
new file mode 100644
index 0000000000..fc15af1398
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-abrupt-empty.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the default case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(eval('1; switch ("a") { default: break; }'), undefined);
+assert.sameValue(eval('2; switch ("a") { default: { 3; break; } }'), 3);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { default: { continue; } } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { default: { 6; continue; } } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-b-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-abrupt-empty.js
new file mode 100644
index 0000000000..567900f159
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-abrupt-empty.js
@@ -0,0 +1,68 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the matching case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ [...]
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ a. Let R be the result of evaluating CaseClause C.
+ b. If R.[[value]] is not empty, let V = R.[[value]].
+ c. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "b": break; }'), undefined
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: case "b": { 3; break; } }'), 3
+);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { default: case "b": continue; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { default: case "b": { 6; continue; } } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..c37bd4b442
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js
@@ -0,0 +1,84 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ [...]
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ a. Let R be the result of evaluating CaseClause C.
+ b. If R.[[value]] is not empty, let V = R.[[value]].
+ c. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "b": 2; case "c": 3; break; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "b": case "c": 5; break; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { default: case "b": 7; case "c": break; }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { default: case "b": 9; case "c": 10; continue; } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { default: case "b": case "c": 12; continue; } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { default: case "b": 14; case "c": continue; } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-nrml.js
new file mode 100644
index 0000000000..1a342ccdc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-nrml.js
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ [...]
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ a. Let R be the result of evaluating CaseClause C.
+ b. If R.[[value]] is not empty, let V = R.[[value]].
+ c. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "b": 2; case "c": 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "b": case "c": 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { default: case "b": 7; case "c": }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-b-final.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-final.js
new file mode 100644
index 0000000000..a1ddd7dd7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-final.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when the final case matches
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ [...]
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ a. Let R be the result of evaluating CaseClause C.
+ b. If R.[[value]] is not empty, let V = R.[[value]].
+ c. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "b": }'),
+ undefined,
+ 'empty StatementList (lone case)'
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: case "b": 3; }'),
+ 3,
+ 'non-empy StatementList (lone case)'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "b": case "c": }'),
+ undefined,
+ 'empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('5; switch ("a") { default: case "b": case "c": 6; }'),
+ 6,
+ 'non-empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('7; switch ("a") { default: case "b": 8; case "c": }'),
+ 8,
+ 'empty StatementList (following a non-empty case)'
+);
+assert.sameValue(
+ eval('9; switch ("a") { default: case "b": 10; case "c": 11; }'),
+ 11,
+ 'non-empty StatementList (following a non-empty case)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..44d369ad25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js
@@ -0,0 +1,71 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion in the default case
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; default: 3; break; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": default: 5; break; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; default: break; }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { case "a": 9; default: 10; continue; } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { case "a": default: 12; continue; } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { case "a": 14; default: continue; } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-nrml.js
new file mode 100644
index 0000000000..42f52df835
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-nrml.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion in the default case
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ [...]
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; default: 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": default: 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; default: }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-final.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-final.js
new file mode 100644
index 0000000000..7099e69f59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-final.js
@@ -0,0 +1,70 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when the default case matches and is final
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ [...]
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: }'),
+ undefined,
+ 'empty StatementList (lone case)'
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: 3; }'),
+ 3,
+ 'non-empy StatementList (lone case)'
+);
+assert.sameValue(
+ eval('4; switch ("b") { case "a": default: }'),
+ undefined,
+ 'empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('5; switch ("b") { case "a": default: 6; }'),
+ 6,
+ 'non-empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('7; switch ("b") { case "a": 8; default: }'),
+ undefined,
+ 'empty StatementList (following a non-empty case)'
+);
+assert.sameValue(
+ eval('9; switch ("b") { case "a": 10; default: 11; }'),
+ 11,
+ 'non-empty StatementList (following a non-empty case)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-abrupt-empty.js
new file mode 100644
index 0000000000..cf640d6b90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-abrupt-empty.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the matching case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ 1. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ 2. Else, return Completion(clauseSelector).
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+---*/
+
+assert.sameValue(eval('1; switch ("a") { case "a": break; }'), undefined);
+assert.sameValue(eval('2; switch ("a") { case "a": { 3; break; } }'), 3);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { case "a": continue; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { case "a": { 6; continue; } } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..4abf4d3e8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ [...]
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; case "b": 3; break; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": case "b": 5; break; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; case "b": break; }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { case "a": 9; case "b": 10; continue; } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { case "a": case "b": 12; continue; } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { case "a": 14; case "b": continue; } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-nrml.js
new file mode 100644
index 0000000000..594945d7db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-nrml.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ [...]
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ [...]
+ 5. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; case "b": 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": case "b": 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; case "b": }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-final.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-final.js
new file mode 100644
index 0000000000..4eb34f8cae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-final.js
@@ -0,0 +1,72 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when only the final case matches
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ 1. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ 2. Else, return Completion(clauseSelector).
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+ 5. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": }'),
+ undefined,
+ 'empty StatementList (lone case)'
+);
+assert.sameValue(
+ eval('2; switch ("a") { case "a": 3; }'),
+ 3,
+ 'non-empy StatementList (lone case)'
+);
+assert.sameValue(
+ eval('4; switch ("b") { case "a": case "b": }'),
+ undefined,
+ 'empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('5; switch ("b") { case "a": case "b": 6; }'),
+ 6,
+ 'non-empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('7; switch ("b") { case "a": 8; case "b": }'),
+ undefined,
+ 'empty StatementList (following a non-empty case)'
+);
+assert.sameValue(
+ eval('9; switch ("b") { case "a": 10; case "b": 11; }'),
+ 11,
+ 'non-empty StatementList (following a non-empty case)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-no-match.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-no-match.js
new file mode 100644
index 0000000000..83ff4ad846
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-no-match.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when no cases match
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ [...]
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ [...]
+ 5. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case null: }'), undefined, 'empty StatementList'
+);
+assert.sameValue(
+ eval('2; switch ("a") { case null: 3; }'),
+ undefined,
+ 'non-empty StatementList'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-async-function.js b/js/src/tests/test262/language/statements/switch/scope-lex-async-function.js
new file mode 100644
index 0000000000..737ab103b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-async-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: async function x() {} }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-async-generator.js b/js/src/tests/test262/language/statements/switch/scope-lex-async-generator.js
new file mode 100644
index 0000000000..7b1dc835e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-async-generator.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: async function * x() {} }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-class.js b/js/src/tests/test262/language/statements/switch/scope-lex-class.js
new file mode 100644
index 0000000000..7cbf564b0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: class x {} }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-close-case.js b/js/src/tests/test262/language/statements/switch/scope-lex-close-case.js
new file mode 100644
index 0000000000..beca515ece
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-close-case.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Removal of lexical environment (from `case` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probe1, probe2;
+
+switch (null) {
+ case null:
+ let x = 'inside';
+ probe1 = function() { return x; };
+ case null:
+ probe2 = function() { return x; };
+}
+
+assert.sameValue(probe1(), 'inside', 'from first `case` clause');
+assert.sameValue(probe2(), 'inside', 'from second `case` clause');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-close-dflt.js b/js/src/tests/test262/language/statements/switch/scope-lex-close-dflt.js
new file mode 100644
index 0000000000..e46fae794e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-close-dflt.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Removal of lexical environment (from `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeDefault, probeDefaultBeforeCase, probeCase;
+
+switch (null) {
+ default:
+ let x = 'inside';
+ probeDefault = function() { return x; };
+}
+
+assert.sameValue(probeDefault(), 'inside', 'from lone `default` clause`');
+assert.sameValue(x, 'outside');
+
+switch (null) {
+ default:
+ let x = 'inside';
+ probeDefaultBeforeCase = function() { return x; };
+ case 0:
+ probeCase = function() { return x; };
+}
+
+assert.sameValue(
+ probeDefaultBeforeCase(),
+ 'inside',
+ 'from `default` clause preceding `case` clause'
+);
+assert.sameValue(
+ probeCase(), 'inside', 'from `case` clause following `default` clause'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-const.js b/js/src/tests/test262/language/statements/switch/scope-lex-const.js
new file mode 100644
index 0000000000..27a1adcc29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: const x = 1; }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-generator.js b/js/src/tests/test262/language/statements/switch/scope-lex-generator.js
new file mode 100644
index 0000000000..1e417855b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-generator.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: function * x() {} }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-let.js b/js/src/tests/test262/language/statements/switch/scope-lex-let.js
new file mode 100644
index 0000000000..791d69c4c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: /*{ body }*/ }
+f;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-open-case.js b/js/src/tests/test262/language/statements/switch/scope-lex-open-case.js
new file mode 100644
index 0000000000..e9360c40fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-open-case.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `case` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeExpr, probeSelector, probeStmt;
+
+switch (probeExpr = function() { return x; }, null) {
+ case probeSelector = function() { return x; }, null:
+ probeStmt = function() { return x; };
+ let x = 'inside';
+}
+
+assert.sameValue(probeExpr(), 'outside');
+assert.sameValue(
+ probeSelector(), 'inside', 'reference from "selector" Expression'
+);
+assert.sameValue(probeStmt(), 'inside', 'reference from Statement position');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-open-dflt.js b/js/src/tests/test262/language/statements/switch/scope-lex-open-dflt.js
new file mode 100644
index 0000000000..378dbed655
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-open-dflt.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeExpr, probeStmt;
+
+switch (probeExpr = function() { return x; }) {
+ default:
+ probeStmt = function() { return x; };
+ let x = 'inside';
+}
+
+assert.sameValue(probeExpr(), 'outside');
+assert.sameValue(probeStmt(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-var-none-case.js b/js/src/tests/test262/language/statements/switch/scope-var-none-case.js
new file mode 100644
index 0000000000..0b7767a7e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-var-none-case.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Retainment of existing variable environment (`case` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+flags: [noStrict]
+---*/
+
+var probeExpr, probeSelector, probeStmt;
+var probeBefore = function() { return x; };
+
+switch (eval('var x = 1;'), probeExpr = function() { return x; }, null) {
+ case eval('var x = 2;'), probeSelector = function() { return x; }, null:
+ probeStmt = function() { return x; };
+ var x = 3;
+}
+
+assert.sameValue(probeBefore(), 3, 'reference preceding statement');
+assert.sameValue(probeExpr(), 3, 'reference from first Expression');
+assert.sameValue(probeSelector(), 3, 'reference from "selector" Expression');
+assert.sameValue(probeStmt(), 3, 'reference from Statement position');
+assert.sameValue(x, 3, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-var-none-dflt.js b/js/src/tests/test262/language/statements/switch/scope-var-none-dflt.js
new file mode 100644
index 0000000000..06cf1f2658
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-var-none-dflt.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Retainment of existing variable environment (`default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+flags: [noStrict]
+---*/
+
+var probeExpr, probeStmt;
+var probeBefore = function() { return x; };
+
+switch (eval('var x = 1;'), probeExpr = function() { return x; }) {
+ default:
+ probeStmt = function() { return x; };
+ var x = 2;
+}
+
+assert.sameValue(probeBefore(), 2, 'reference preceding statment');
+assert.sameValue(probeExpr(), 2, 'reference from Expression position');
+assert.sameValue(probeStmt(), 2, 'reference from Statement position');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/shell.js b/js/src/tests/test262/language/statements/switch/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/switch/syntax/browser.js b/js/src/tests/test262/language/statements/switch/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/browser.js
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..3ee12c3def
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..60eec83b9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..4728da3f76
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..2289b841bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..b52c942573
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..def04c2f1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..0999405b9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..4ec45cf633
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..828b885263
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..1cac5dc1fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..6c8c86a5cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..2056071877
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..8b953d7f2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..b04bf4d0fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..4608ab9a43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..a0c1869be9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/browser.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/browser.js
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..fad2f88bb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..8d341655db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..4ad5a0ea36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..c1c93ffde9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..8c1574c04e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..dd1ec79966
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..ff7ebcca51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..bfb72715b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..ff5c0091a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..8913273ff4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..2cd4a1d34d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..72fa1dbd58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..f23baad402
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..d577f27d4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..5bac48e93a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..e3645885ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..cae926f3d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..28d3c1e581
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..1095081ff9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..8250fb9ff8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js
new file mode 100644
index 0000000000..0a56688b39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..3914f675af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..154045a3d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..6b158a101e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..04fbfaad85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..a5ecdae257
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..468c37536a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..9cbbb3f6e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..084bf41aa9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..275b18e9b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..8c4bf0e039
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..4d6112bbf3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..b5ff40d149
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..bf790d7c96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..d2ceea9121
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..2a54582b3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..43e7f084e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..67ae4d146a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..1f83668e8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..952bf84ee0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/shell.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/shell.js
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..b7e4561feb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..0671fe46ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..8b073c8ed9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..d0b77f0ca8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..ea3a499441
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..3d7a9df12d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..0eaf5ec31e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..fbfd7f52c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,18 @@
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+---*/
+
+
+switch (0) { case 1: var f; default: var f }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/syntax/shell.js b/js/src/tests/test262/language/statements/switch/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/shell.js
diff --git a/js/src/tests/test262/language/statements/switch/tco-case-body-dflt-strict.js b/js/src/tests/test262/language/statements/switch/tco-case-body-dflt-strict.js
new file mode 100644
index 0000000000..82f955351c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/tco-case-body-dflt-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ switch(0) { case 0: return f(n - 1); default: }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/tco-case-body-strict.js b/js/src/tests/test262/language/statements/switch/tco-case-body-strict.js
new file mode 100644
index 0000000000..f13097eae3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/tco-case-body-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ switch(0) { case 0: return f(n - 1); }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/tco-dftl-body-strict.js b/js/src/tests/test262/language/statements/switch/tco-dftl-body-strict.js
new file mode 100644
index 0000000000..1988f98e4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/tco-dftl-body-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ switch(0) { default: return f(n - 1); }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A1.js b/js/src/tests/test262/language/statements/throw/S12.13_A1.js
new file mode 100644
index 0000000000..0b9edf5d8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A1.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Sanity test for throw statement
+es5id: 12.13_A1
+description: Trying to throw exception with "throw"
+---*/
+
+var inCatch = false;
+
+try {
+ throw "expected_message";
+} catch (err) {
+ assert.sameValue(err, "expected_message");
+ inCatch = true;
+}
+
+assert.sameValue(inCatch, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A2_T1.js b/js/src/tests/test262/language/statements/throw/S12.13_A2_T1.js
new file mode 100644
index 0000000000..9a43599a9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A2_T1.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1
+ evaluates Expression
+es5id: 12.13_A2_T1
+description: Throwing undefined
+---*/
+
+// CHECK#1
+try{
+ throw undefined;
+}
+catch(e){
+ if (e!==undefined) throw new Test262Error('#1: Exception === undefined. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A2_T2.js b/js/src/tests/test262/language/statements/throw/S12.13_A2_T2.js
new file mode 100644
index 0000000000..61820854d1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A2_T2.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1
+ evaluates Expression
+es5id: 12.13_A2_T2
+description: Throwing null
+---*/
+
+// CHECK#1
+try{
+ throw null;
+}
+catch(e){
+ if (e!==null) throw new Test262Error('#1: Exception === null. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A2_T3.js b/js/src/tests/test262/language/statements/throw/S12.13_A2_T3.js
new file mode 100644
index 0000000000..ac443fd51f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A2_T3.js
@@ -0,0 +1,46 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1
+ evaluates Expression
+es5id: 12.13_A2_T3
+description: Throwing boolean
+---*/
+
+// CHECK#1
+try{
+ throw true;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#1: Exception ===true. Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+try{
+ throw false;
+}
+catch(e){
+ if (e!==false) throw new Test262Error('#2: Exception ===false. Actual: Exception ==='+ e );
+}
+
+// CHECK#3
+var b=false;
+try{
+ throw b;
+}
+catch(e){
+ if (e!==false) throw new Test262Error('#3: Exception ===false. Actual: Exception ==='+ e );
+}
+
+// CHECK#4
+var b=true;
+try{
+ throw b;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#4: Exception ===true. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A2_T4.js b/js/src/tests/test262/language/statements/throw/S12.13_A2_T4.js
new file mode 100644
index 0000000000..07ddadc7ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A2_T4.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1
+ evaluates Expression
+es5id: 12.13_A2_T4
+description: Throwing string
+---*/
+
+// CHECK#1
+try{
+ throw "exception #1";
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#1: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+var b="exception #1";
+try{
+ throw b;
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#2: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A2_T5.js b/js/src/tests/test262/language/statements/throw/S12.13_A2_T5.js
new file mode 100644
index 0000000000..ed30274884
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A2_T5.js
@@ -0,0 +1,77 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1
+ evaluates Expression
+es5id: 12.13_A2_T5
+description: Throwing number
+---*/
+
+// CHECK#1
+try{
+ throw 13;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#1: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+var b=13;
+try{
+ throw b;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#2: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#3
+try{
+ throw 2.13;
+}
+catch(e){
+ if (e!==2.13) throw new Test262Error('#3: Exception ===2.13. Actual: Exception ==='+ e );
+}
+
+// CHECK#4
+try{
+ throw NaN;
+}
+catch(e){
+ assert.sameValue(e, NaN, "e is NaN");
+}
+
+// CHECK#5
+try{
+ throw +Infinity;
+}
+catch(e){
+ if (e!==+Infinity) throw new Test262Error('#5: Exception ===+Infinity. Actual: Exception ==='+ e );
+}
+
+// CHECK#6
+try{
+ throw -Infinity;
+}
+catch(e){
+ if (e!==-Infinity) throw new Test262Error('#6: Exception ===-Infinity. Actual: Exception ==='+ e );
+}
+
+// CHECK#7
+try{
+ throw +0;
+}
+catch(e){
+ if (e!==+0) throw new Test262Error('#7: Exception ===+0. Actual: Exception ==='+ e );
+}
+
+// CHECK#8
+try{
+ throw -0;
+}
+catch(e){
+ assert.sameValue(e, -0);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A2_T6.js b/js/src/tests/test262/language/statements/throw/S12.13_A2_T6.js
new file mode 100644
index 0000000000..8026a54585
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A2_T6.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1
+ evaluates Expression
+es5id: 12.13_A2_T6
+description: Throwing object
+---*/
+
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';},
+ i:7
+}
+
+try{
+ throw myObj;
+}
+catch(e){
+// CHECK#1
+ if (e.p1!=="a") throw new Test262Error('#1: e.p1 === "a". Actual: e.p1 ==='+ e.p1 );
+// CHECK#2
+ if (e.value!=='myObj_value') throw new Test262Error('#2: e.p1 === \'myObj_value\'. Actual: e.p1 ==='+ e.p1 );
+// CHECK#3
+ if (e.eval()!=='obj_eval') throw new Test262Error('#3: e.p1 === \'obj_eval\'. Actual: e.p1 ==='+ e.p1 );
+}
+
+// CHECK#4
+myObj.i=6
+try{
+ throw myObj;
+}
+catch(e){}
+if (myObj.i!==6) throw new Test262Error('#4: Handling of catch must be correct');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A2_T7.js b/js/src/tests/test262/language/statements/throw/S12.13_A2_T7.js
new file mode 100644
index 0000000000..14c5459197
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A2_T7.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "throw Expression" returns (throw, GetValue(Result(1)), empty), where 1
+ evaluates Expression
+es5id: 12.13_A2_T7
+description: Throwing Array
+---*/
+
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+var mycars2 = new Array();
+mycars2[0] = "Mercedes";
+mycars2[1] = "Jeep";
+mycars2[2] = "Suzuki";
+
+// CHECK#1
+try{
+ throw mycars;
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars[i]) throw new Test262Error('#1.'+i+': Exception['+i+'] === mycars['+i+']. Actual: Exception['+i+'] ==='+ e[i] );
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A3_T1.js b/js/src/tests/test262/language/statements/throw/S12.13_A3_T1.js
new file mode 100644
index 0000000000..1e91187818
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A3_T1.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: 1. Evaluate Expression
+es5id: 12.13_A3_T1
+description: Evaluating boolean expression
+---*/
+
+// CHECK#1
+var b=true;
+try{
+ throw b&&false;
+}
+catch(e){
+ if (e!==false) throw new Test262Error('#1: Exception === false(operaton &&). Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+var b=true;
+try{
+ throw b||false;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#2: Exception === true(operaton ||). Actual: Exception ==='+ e );
+}
+
+// CHECK#3
+try{
+ throw !false;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#3: Exception === true(operaton !). Actual: Exception ==='+ e );
+}
+
+// CHECK#4
+var b=true;
+try{
+ throw !(b&&false);
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#4: Exception === true(operaton &&). Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A3_T2.js b/js/src/tests/test262/language/statements/throw/S12.13_A3_T2.js
new file mode 100644
index 0000000000..05704b43aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A3_T2.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: 1. Evaluate Expression
+es5id: 12.13_A3_T2
+description: Evaluating string expression
+---*/
+
+// CHECK#1
+try{
+ throw "exception"+" #1";
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#1: Exception === "exception #1"(operaton +). Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+var b="exception"
+var a=" #1";
+try{
+ throw b+a;
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#2: Exception === "exception #1"(operaton +). Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A3_T3.js b/js/src/tests/test262/language/statements/throw/S12.13_A3_T3.js
new file mode 100644
index 0000000000..4f08ca5a0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A3_T3.js
@@ -0,0 +1,92 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: 1. Evaluate Expression
+es5id: 12.13_A3_T3
+description: Evaluating number expression
+---*/
+
+// CHECK#1
+try{
+ throw 10+3;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#1: Exception ===13(operaton +). Actual: Exception ==='+ e);
+}
+
+// CHECK#2
+var b=10;
+var a=3;
+try{
+ throw a+b;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#2: Exception ===13(operaton +). Actual: Exception ==='+ e);
+}
+
+// CHECK#3
+try{
+ throw 3.15-1.02;
+}
+catch(e){
+ if (e!==2.13) throw new Test262Error('#3: Exception ===2.13(operaton -). Actual: Exception ==='+ e);
+}
+
+// CHECK#4
+try{
+ throw 2*2;
+}
+catch(e){
+ if (e!==4) throw new Test262Error('#4: Exception ===4(operaton *). Actual: Exception ==='+ e);
+}
+
+// CHECK#5
+try{
+ throw 1+Infinity;
+}
+catch(e){
+ if (e!==+Infinity) throw new Test262Error('#5: Exception ===+Infinity(operaton +). Actual: Exception ==='+ e);
+}
+
+// CHECK#6
+try{
+ throw 1-Infinity;
+}
+catch(e){
+ if (e!==-Infinity) throw new Test262Error('#6: Exception ===-Infinity(operaton -). Actual: Exception ==='+ e);
+}
+
+// CHECK#7
+try{
+ throw 10/5;
+}
+catch(e){
+ if (e!==2) throw new Test262Error('#7: Exception ===2(operaton /). Actual: Exception ==='+ e);
+}
+
+// CHECK#8
+try{
+ throw 8>>2;
+}
+catch(e){
+ if (e!==2) throw new Test262Error('#8: Exception ===2(operaton >>). Actual: Exception ==='+ e);
+}
+
+// CHECK#9
+try{
+ throw 2<<2;
+}
+catch(e){
+ if (e!==8) throw new Test262Error('#9: Exception ===8(operaton <<). Actual: Exception ==='+ e);
+}
+
+// CHECK#10
+try{
+ throw 123%100;
+}
+catch(e){
+ if (e!==23) throw new Test262Error('#10: Exception ===23(operaton %). Actual: Exception ==='+ e);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A3_T4.js b/js/src/tests/test262/language/statements/throw/S12.13_A3_T4.js
new file mode 100644
index 0000000000..59a3b1e9d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A3_T4.js
@@ -0,0 +1,56 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: 1. Evaluate Expression
+es5id: 12.13_A3_T4
+description: Evaluating array expression
+---*/
+
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+var mycars2 = new Array();
+mycars2[0] = "Mercedes";
+mycars2[1] = "Jeep";
+mycars2[2] = "Suzuki";
+
+// CHECK#1
+try{
+ throw mycars.concat(mycars2);
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars[i]) throw new Test262Error('#1.'+i+': Exception['+i+']===mycars['+i+'](operation .concat). Actual: Exception['+i+']==='+ e[i] );
+ }
+ for (var i=3;i<6;i++){
+ if (e[i]!==mycars2[i-3]) throw new Test262Error('#1.'+i+': Exception['+i+']===mycars2['+(i-3)+'](operation .concat). Actual: Exception['+i+']==='+ e[i] );
+ }
+}
+
+// CHECK#2
+try{
+ throw new Array("Mercedes","Jeep","Suzuki");
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars2[i]) throw new Test262Error('#2.'+i+': Exception['+i+']===mycars2['+i+'](operation new). Actual: Exception['+i+']==='+ e[i] );
+ }
+}
+
+// CHECK#3
+try{
+ throw mycars.concat(new Array("Mercedes","Jeep","Suzuki"));
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars[i]) throw new Test262Error('#3.'+i+': Exception['+i+']===mycars['+i+'](operation .concat(new)). Actual: Exception['+i+']==='+ e[i] );
+ }
+ for (var i=3;i<6;i++){
+ if (e[i]!==mycars2[i-3]) throw new Test262Error('#3.'+i+': Exception['+i+']===mycars2['+(i-3)+'](operation .concat(new)). Actual: Exception['+i+']==='+ e[i] );
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A3_T5.js b/js/src/tests/test262/language/statements/throw/S12.13_A3_T5.js
new file mode 100644
index 0000000000..eaa5b6a238
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A3_T5.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: 1. Evaluate Expression
+es5id: 12.13_A3_T5
+description: Evaluating equation expression
+---*/
+
+// CHECK#1
+var a=true;
+var b=false;
+try{
+ throw ((a&&(!b))?"exception":" #1");
+}
+catch(e){
+ if (e!=="exception") throw new Test262Error('#1: Exception ==="exception"(operaton ? , ). Actual: Exception ==='+e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/S12.13_A3_T6.js b/js/src/tests/test262/language/statements/throw/S12.13_A3_T6.js
new file mode 100644
index 0000000000..9034b80747
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/S12.13_A3_T6.js
@@ -0,0 +1,58 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: 1. Evaluate Expression
+es5id: 12.13_A3_T6
+description: Evaluating functions
+---*/
+
+// CHECK#1
+var i=0;
+function adding1(){
+ i++;
+ return 1;
+}
+try{
+ throw (adding1());
+}
+catch(e){
+ if (e!==1) throw new Test262Error('#1: Exception ===1. Actual: Exception ==='+ e);
+}
+
+// CHECK#2
+var i=0;
+function adding2(){
+ i++;
+ return i;
+}
+try{
+ throw adding2();
+}
+catch(e){}
+if (i!==1) throw new Test262Error('#2: i===1. Actual: i==='+ i);
+
+// CHECK#3
+var i=0;
+function adding3(){
+ i++;
+}
+try{
+ throw adding3();
+}
+catch(e){}
+if (i!==1) throw new Test262Error('#3: i===1. Actual: i==='+i);
+
+// CHECK#4
+function adding4(i){
+ i++;
+ return i;
+}
+try{
+ throw (adding4(1));
+}
+catch(e){
+ if (e!==2) throw new Test262Error('#4: Exception ===2. Actual: Exception ==='+ e);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/throw/browser.js b/js/src/tests/test262/language/statements/throw/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/browser.js
diff --git a/js/src/tests/test262/language/statements/throw/shell.js b/js/src/tests/test262/language/statements/throw/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/throw/shell.js
diff --git a/js/src/tests/test262/language/statements/try/12.14-10.js b/js/src/tests/test262/language/statements/try/12.14-10.js
new file mode 100644
index 0000000000..b20f4deebc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-10.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-10
+description: catch introduces scope - name lookup finds function parameter
+---*/
+
+ function f(o) {
+
+ function innerf(o, x) {
+ try {
+ throw o;
+ }
+ catch (e) {
+ return x;
+ }
+ }
+
+ return innerf(o, 42);
+ }
+
+assert.sameValue(f({}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-11.js b/js/src/tests/test262/language/statements/try/12.14-11.js
new file mode 100644
index 0000000000..cc7fa1e0aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-11.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-11
+description: catch introduces scope - name lookup finds inner variable
+---*/
+
+ function f(o) {
+
+ function innerf(o) {
+ var x = 42;
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+assert.sameValue(f({}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-12.js b/js/src/tests/test262/language/statements/try/12.14-12.js
new file mode 100644
index 0000000000..4a29c3775a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-12.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-12
+description: catch introduces scope - name lookup finds property
+---*/
+
+ function f(o) {
+
+ function innerf(o) {
+ try {
+ throw o;
+ }
+ catch (e) {
+ return e.x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+assert.sameValue(f({x:42}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-13.js b/js/src/tests/test262/language/statements/try/12.14-13.js
new file mode 100644
index 0000000000..b04aae5e59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-13.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-13
+description: catch introduces scope - updates are based on scope
+flags: [noStrict]
+---*/
+
+ var res1 = false;
+ var res2 = false;
+ var res3 = false;
+
+(function() {
+ var x_12_14_13 = 'local';
+
+ function foo() {
+ this.x_12_14_13 = 'instance';
+ }
+
+ try {
+ throw foo;
+ }
+ catch (e) {
+ res1 = (x_12_14_13 === 'local');
+ e();
+ res2 = (x_12_14_13 === 'local');
+ }
+ res3 = (x_12_14_13 === 'local');
+})();
+
+assert(res1, 'res1 !== true');
+assert(res2, 'res2 !== true');
+assert(res3, 'res3 !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-14.js b/js/src/tests/test262/language/statements/try/12.14-14.js
new file mode 100644
index 0000000000..93340a2877
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-14.js
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-14
+description: >
+ Exception object is a function, when an exception parameter is
+ called as a function in catch block, global object is passed as
+ the this value
+flags: [noStrict]
+---*/
+
+var global = this;
+var result;
+
+(function() {
+ try {
+ throw function () {
+ this._12_14_14_foo = "test";
+ };
+ } catch (e) {
+ e();
+ result = global._12_14_14_foo;
+ }
+})();
+
+assert.sameValue(result, "test", 'result');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-15.js b/js/src/tests/test262/language/statements/try/12.14-15.js
new file mode 100644
index 0000000000..b2765d3d75
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-15.js
@@ -0,0 +1,31 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-15
+description: >
+ Exception object is a function which is a property of an object,
+ when an exception parameter is called as a function in catch
+ block, global object is passed as the this value
+flags: [noStrict]
+---*/
+
+var global = this;
+var result;
+
+(function() {
+ var obj = {};
+ obj.test = function () {
+ this._12_14_15_foo = "test";
+ };
+ try {
+ throw obj.test;
+ } catch (e) {
+ e();
+ result = global._12_14_15_foo;
+ }
+})();
+
+assert.sameValue(result, "test", 'result');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-16.js b/js/src/tests/test262/language/statements/try/12.14-16.js
new file mode 100644
index 0000000000..e206deac32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-16.js
@@ -0,0 +1,34 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-16
+description: >
+ Exception object is a function which update in catch block, when
+ an exception parameter is called as a function in catch block,
+ global object is passed as the this value
+flags: [noStrict]
+---*/
+
+var global = this;
+var result;
+
+(function() {
+ try {
+ throw function () {
+ this._12_14_16_foo = "test";
+ };
+ } catch (e) {
+ var obj = {};
+ obj.test = function () {
+ this._12_14_16_foo = "test1";
+ };
+ e = obj.test;
+ e();
+ result = global._12_14_16_foo;
+ }
+})();
+
+assert.sameValue(result, "test1", 'result');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-3.js b/js/src/tests/test262/language/statements/try/12.14-3.js
new file mode 100644
index 0000000000..3e799519cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-3.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-3
+description: >
+ catch doesn't change declaration scope - var declaration are
+ visible outside when name different from catch parameter
+---*/
+
+ try {
+ throw new Error();
+ }
+ catch (e) {
+ var foo = "declaration in catch";
+ }
+
+assert.sameValue(foo, "declaration in catch");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-4.js b/js/src/tests/test262/language/statements/try/12.14-4.js
new file mode 100644
index 0000000000..0a01749a41
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-4.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-4
+description: catch introduces scope - block-local vars must shadow outer vars
+---*/
+
+ var o = { foo : 42};
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ var foo;
+ }
+
+assert.sameValue(foo, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-6.js b/js/src/tests/test262/language/statements/try/12.14-6.js
new file mode 100644
index 0000000000..95f4a8ed6e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-6.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-6
+description: >
+ catch introduces scope - block-local function expression must
+ shadow outer function expression
+---*/
+
+ var o = {foo : function () { return 42;}};
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ var foo = function () {};
+ }
+
+assert.sameValue(foo(), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-7.js b/js/src/tests/test262/language/statements/try/12.14-7.js
new file mode 100644
index 0000000000..6f444447e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-7.js
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-7
+description: catch introduces scope - scope removed when exiting catch block
+---*/
+
+ var o = {foo: 1};
+ var catchAccessed = false;
+
+ try {
+ throw o;
+ }
+ catch (expObj) {
+ catchAccessed = (expObj.foo == 1);
+ }
+ assert(catchAccessed, '(expObj.foo == 1)');
+
+
+ catchAccessed = false;
+ try {
+ expObj;
+ }
+ catch (e) {
+ catchAccessed = e instanceof ReferenceError
+ }
+ assert(catchAccessed, 'e instanceof ReferenceError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-8.js b/js/src/tests/test262/language/statements/try/12.14-8.js
new file mode 100644
index 0000000000..4eca6770db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-8.js
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ local vars must not be visible outside with block
+ local functions must not be visible outside with block
+ local function expresssions should not be visible outside with block
+ local vars must shadow outer vars
+ local functions must shadow outer functions
+ local function expresssions must shadow outer function expressions
+ eval should use the appended object to the scope chain
+es5id: 12.14-8
+description: >
+ catch introduces scope - scope removed when exiting catch block
+ (properties)
+---*/
+
+ var o = {foo: 42};
+
+ try {
+ throw o;
+ }
+ catch (e) {
+ var foo = 1;
+ }
+
+assert.sameValue(o.foo, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/12.14-9.js b/js/src/tests/test262/language/statements/try/12.14-9.js
new file mode 100644
index 0000000000..bcd2874785
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/12.14-9.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-9
+description: catch introduces scope - name lookup finds outer variable
+---*/
+
+ function f(o) {
+ var x = 42;
+
+ function innerf(o) {
+ try {
+ throw o;
+ }
+ catch (e) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+assert.sameValue(f({}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A1.js b/js/src/tests/test262/language/statements/try/S12.14_A1.js
new file mode 100644
index 0000000000..805af392cf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A1.js
@@ -0,0 +1,56 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production TryStatement : try Block Catch is evaluated as follows: 2.
+ If Result(1).type is not throw, return Result(1)
+es5id: 12.14_A1
+description: >
+ Executing TryStatement : try Block Catch. The statements doesn't
+ cause actual exceptions
+---*/
+
+// CHECK#1
+try {
+ var x=0;
+}
+catch (e) {
+ throw new Test262Error('#1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))');
+}
+
+// CHECK#2
+var c1=0;
+try{
+ var x1=1;
+}
+finally
+{
+ c1=1;
+}
+if(x1!==1){
+ throw new Test262Error('#2.1: "try" block must be evaluated. Actual: try Block has not been evaluated');
+}
+if (c1!==1){
+ throw new Test262Error('#2.2: "finally" block must be evaluated. Actual: finally Block has not been evaluated');
+}
+
+// CHECK#3
+var c2=0;
+try{
+ var x2=1;
+}
+catch(e){
+ throw new Test262Error('#3.1: If Result(1).type is not throw, return Result(1). Actual: 4 Return(Result(3))');
+}
+finally{
+ c2=1;
+}
+if(x2!==1){
+ throw new Test262Error('#3.2: "try" block must be evaluated. Actual: try Block has not been evaluated');
+}
+if (c2!==1){
+ throw new Test262Error('#3.3: "finally" block must be evaluated. Actual: finally Block has not been evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T1.js
new file mode 100644
index 0000000000..af9981bc1d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T1.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T1
+description: >
+ Throwing exception while executing iteration statement placed into
+ try Block
+---*/
+
+// CHECK#1
+var i=0;
+try{
+while(i<10){
+ if(i===5) throw i;
+ i++;
+}
+}
+catch(e){
+ if(e!==5)throw new Test262Error('#1: Exception === 5. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T2.js
new file mode 100644
index 0000000000..89b5757262
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T2.js
@@ -0,0 +1,118 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T2
+description: Try statement inside loop, where use continue loop
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+while(c1<2){
+ try{
+ c1+=1;
+ continue;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+};
+if(fin!==1){
+ throw new Test262Error('#1: "finally" block must be evaluated at "try{continue} catch finally" construction');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+while(c2<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ continue;
+ }
+ finally{
+ fin2=1;
+ }
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2: "finally" block must be evaluated at "try catch{continue} finally" construction');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+while(c3<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ continue;
+ }
+ fin3=0;
+}
+if(fin3!==1){
+ throw new Test262Error('#3: "finally" block must be evaluated at "try catch finally{continue}" construction');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+while(c4<2){
+ try{
+ c4+=1;
+ continue;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+};
+if(fin4!==1){
+ throw new Test262Error('#4: "finally" block must be evaluated at "try{continue} finally" construction');
+}
+
+// CHECK#5
+var c5=0;
+while(c5<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c5+=1;
+ continue;
+ }
+}
+if(c5!==2){
+ throw new Test262Error('#5: "try catch{continue}" must work correctly');
+}
+
+// CHECK#6
+var c6=0,fin6=0;
+while(c6<2){
+ try{
+ c6+=1;
+ throw "ex1"
+ }
+ finally{
+ fin6=1;
+ continue;
+ }
+ fin6=-1;
+}
+if(fin6!==1){
+ throw new Test262Error('#6.1: "finally" block must be evaluated');
+}
+if(c6!==2){
+ throw new Test262Error('#6.2: "try finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T3.js
new file mode 100644
index 0000000000..b52f28cd2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T3.js
@@ -0,0 +1,153 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T3
+description: Try statement inside loop, where use break
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+while(c1<2){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+ c1+=2;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==1){
+ throw new Test262Error('#1.2: "try{break}catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+while(c2<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==1){
+ throw new Test262Error('#2.2: "try catch{break} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+while(c3<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ break;
+ }
+ c3+=2;
+ fin3=0;
+}
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==1){
+ throw new Test262Error('#3.2: "try catch finally{break}" must work correctly');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+while(c4<2){
+ try{
+ c4+=1;
+ break;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+ c4+=2;
+}
+if(fin4!==1){
+ throw new Test262Error('#4.1: "finally" block must be evaluated');
+}
+if(c4!==1){
+ throw new Test262Error('#4.2: "try{break} finally" must work correctly');
+}
+
+// CHECK#5
+var c5=0;
+while(c5<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ break;
+ }
+}
+if(c5!==0){
+ throw new Test262Error('#5: "try catch{break}" must work correctly');
+}
+
+// CHECK#6
+var c6=0;
+while(c6<2){
+ try{
+ c6+=1;
+ break;
+ }
+ catch(er1){}
+ c6+=2;
+}
+if(c6!==1){
+ throw new Test262Error('#6: "try{break} catch" must work correctly');
+}
+
+// CHECK#7
+var c7=0,fin7=0;
+try{
+ while(c7<2){
+ try{
+ c7+=1;
+ throw "ex1";
+ }
+ finally{
+ fin7=1;
+ break;
+ }
+ fin7=-1;
+ c7+=2;
+ }
+}
+catch(ex1){
+ c7=10;
+}
+if(fin7!==1){
+ throw new Test262Error('#7.1: "finally" block must be evaluated');
+}
+if(c7!==1){
+ throw new Test262Error('#7.2: "try finally{break}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T4.js
new file mode 100644
index 0000000000..0d258279e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T4.js
@@ -0,0 +1,58 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T4
+description: Try statement inside loop, where combinate using break and continue
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+while(c1<2){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ continue;
+ }
+ fin=-1;
+ c1+=2;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==2){
+ throw new Test262Error('#1.2: "try{break} catch finally{continue}" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+while(c2<2){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ continue;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==2){
+ throw new Test262Error('#2.2: "try catch{break} finally{continue} must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A10_T5.js b/js/src/tests/test262/language/statements/try/S12.14_A10_T5.js
new file mode 100644
index 0000000000..12bbe9d0f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A10_T5.js
@@ -0,0 +1,41 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "while"
+ statement
+es5id: 12.14_A10_T5
+description: Throw some exceptions from different place of loop body
+---*/
+
+// CHECK#1
+var c=0, i=0;
+var fin=0;
+while(i<10){
+ i+=1;
+ try{
+ if(c===0){
+ throw "ex1";
+ throw new Test262Error('#1.1: throw "ex1" lead to throwing exception');
+ }
+ c+=2;
+ if(c===1){
+ throw "ex2";
+ throw new Test262Error('#1.2: throw "ex2" lead to throwing exception');
+ }
+ }
+ catch(er1){
+ c-=1;
+ continue;
+ throw new Test262Error('#1.3: "try catch{continue} finally" must work correctly');
+ }
+ finally{
+ fin+=1;
+ }
+}
+if(fin!==10){
+ throw new Test262Error('#1.4: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A11_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A11_T1.js
new file mode 100644
index 0000000000..95a5bec864
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A11_T1.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for"
+ statement
+es5id: 12.14_A11_T1
+description: Loop inside try Block, where throw exception
+---*/
+
+// CHECK#1
+try{
+ for(var i=0;i<10;i++){
+ if(i===5) throw i;
+ }
+}
+catch(e){
+ if(e!==5)throw new Test262Error('#1: Exception === 5. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A11_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A11_T2.js
new file mode 100644
index 0000000000..20089d9a78
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A11_T2.js
@@ -0,0 +1,125 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for"
+ statement
+es5id: 12.14_A11_T2
+description: Try statement inside loop, where use continue loop
+---*/
+
+// CHECK#1
+var fin=0;
+for(var i=0;i<5;i++){
+ try{
+ i+=1;
+ continue;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+}
+if(fin!==1){
+ throw new Test262Error('#1: "finally" block must be evaluated at "try{continue} catch finally" construction');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ continue;
+ }
+ finally{
+ fin2=1;
+ }
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==5){
+ throw new Test262Error('#2.1: "try catch{continue} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ continue;
+ }
+ fin3=0;
+}
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==5){
+ throw new Test262Error('#3.2: "try catch finally{continue}" must work correctly');
+}
+
+// CHECK#4
+var fin=0;
+for(var i=0;i<5;i++){
+ try{
+ i+=1;
+ continue;
+ }
+ finally{
+ fin=1;
+ }
+ fin=-1;
+};
+if(fin!==1){
+ throw new Test262Error('#4: "finally" block must be evaluated at "try{continue} finally" construction');
+}
+
+// CHECK#5
+var c5=0;
+for(var c5=0;c5<10;){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c5+=1;
+ continue;
+ }
+ c5+=12;
+};
+if(c5!==10){
+ throw new Test262Error('#5: "try catch{continue} must work correctly');
+}
+
+// CHECK#6
+var c6=0,fin6=0;
+for(var c6=0;c6<10;){
+ try{
+ c6+=1;
+ throw "ex1"
+ }
+ finally{
+ fin6=1;
+ continue;
+ }
+ fin6=-1;
+};
+if(fin6!==1){
+ throw new Test262Error('#6.1: "finally" block must be evaluated');
+}
+if(c6!==10){
+ throw new Test262Error('#6.2: "try finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A11_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A11_T3.js
new file mode 100644
index 0000000000..14e46c8243
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A11_T3.js
@@ -0,0 +1,152 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for"
+ statement
+es5id: 12.14_A11_T3
+description: Try statement inside loop, where use break
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+for(var i=0;i<5;i++){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+ c1+=2;
+};
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==1){
+ throw new Test262Error('#1.2: "try{break}catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ }
+ c2+=2;
+ fin2=-1;
+};
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==1){
+ throw new Test262Error('#2.2: "try catch{break} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ break;
+ }
+ c3+=2;
+ fin3=0;
+};
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==1){
+ throw new Test262Error('#3.2: "try catch finally{break}" must work correctly');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+for(var i=0;i<5;i++){
+ try{
+ c4+=1;
+ break;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+ c4+=2;
+};
+if(fin4!==1){
+ throw new Test262Error('#4.1: "finally" block must be evaluated');
+}
+if(c4!==1){
+ throw new Test262Error('#4.2: "try{break} finally" must work correctly');
+}
+
+// CHECK#5
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ break;
+ }
+};
+if(i!==0){
+ throw new Test262Error('#5: "try catch{break}" must work correctly');
+}
+
+// CHECK#6
+var c6=0;
+for(var c6=0;c6<5;){
+ try{
+ c6+=1;
+ break;
+ }
+ catch(er1){}
+ c6+=2;
+};
+if(c6!==1){
+ throw new Test262Error('#6: "try{break} catch" must work correctly');
+}
+
+// CHECK#7
+var c7=0,fin7=0;
+try{
+ for(var c7=0;c7<5;){
+ try{
+ c7+=1;
+ throw "ex1";
+ }
+ finally{
+ fin7=1;
+ break;
+ }
+ fin7=-1;
+ c7+=2;
+ }
+}
+catch(ex1){
+ c7=10;
+}
+if(fin7!==1){
+ throw new Test262Error('#7.1: "finally" block must be evaluated');
+}
+if(c7!==1){
+ throw new Test262Error('#7.2: "try finally{break}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A11_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A11_T4.js
new file mode 100644
index 0000000000..a16faad9f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A11_T4.js
@@ -0,0 +1,58 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for"
+ statement
+es5id: 12.14_A11_T4
+description: Try statement inside loop, where combinate using break and continue
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+for(var i=0;i<5;i++){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ continue;
+ }
+ fin=-1;
+ c1+=2;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==5){
+ throw new Test262Error('#1.2: "try{break} catch finally{continue}" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for(var i=0;i<5;i++){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ continue;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==5){
+ throw new Test262Error('#2.2: "try catch{break} finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A12_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A12_T1.js
new file mode 100644
index 0000000000..b46b682563
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A12_T1.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for-in"
+ statement
+es5id: 12.14_A12_T1
+description: Loop inside try Block, where throw exception
+---*/
+
+var x;
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+// CHECK#1
+try{
+ for (x in mycars){
+ if (mycars[x]==="BMW") throw "ex";
+ }
+}
+catch(e){
+ if(e!=="ex")throw new Test262Error('#1: Exception ==="ex". Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A12_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A12_T2.js
new file mode 100644
index 0000000000..8b16f4e286
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A12_T2.js
@@ -0,0 +1,134 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for-in"
+ statement
+es5id: 12.14_A12_T2
+description: Try statement inside loop, where use continue loop
+---*/
+
+var x;
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+// CHECK#1
+var fin=0;
+var i=0;
+for (x in mycars){
+ try{
+ i+=1;
+ continue;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(i!==3){
+ throw new Test262Error('#1.2: "try{continue} catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ continue;
+ }
+ finally{
+ fin2=1;
+ }
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==3){
+ throw new Test262Error('#2.1: "try catch{continue} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ continue;
+ }
+ fin3=0;
+}
+if(c3!==3){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(fin3!==1){
+ throw new Test262Error('#3.2: "try catch finally{continue}" must work correctly');
+}
+
+// CHECK#4
+var fin=0;
+for (x in mycars){
+ try{
+ continue;
+ }
+ finally{
+ fin=1;
+ }
+ fin=-1;
+}
+if(fin!==1){
+ throw new Test262Error('#4: "finally" block must be evaluated at "try{continue} finally" construction');
+}
+
+// CHECK#5
+var c5=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c5+=1;
+ continue;
+ }
+ c5+=12;
+}
+if(c5!==3){
+ throw new Test262Error('#5: "try catch{continue}" must work correctly');
+}
+
+// CHECK#6
+var c6=0,fin6=0;
+for (x in mycars){
+ try{
+ c6+=1;
+ throw "ex1";
+ }
+ finally{
+ fin6=1;
+ continue;
+ }
+ fin6=-1;
+}
+if(fin6!==1){
+ throw new Test262Error('#6.1: "finally" block must be evaluated');
+}
+if(c6!==3){
+ throw new Test262Error('#6.2: "try finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A12_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A12_T3.js
new file mode 100644
index 0000000000..515c51c836
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A12_T3.js
@@ -0,0 +1,164 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for-in"
+ statement
+es5id: 12.14_A12_T3
+description: Try statement inside loop, where use break
+---*/
+
+var x;
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+// CHECK#1
+var c1=0,fin=0;
+for (x in mycars){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){
+ c1+=1;
+ }
+ finally{
+ fin=1;
+ }
+ fin=-1;
+ c1+=2;
+};
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==1){
+ throw new Test262Error('#1.2: "try{break}catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==1){
+ throw new Test262Error('#2.2: "try catch{break} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ break;
+ }
+ c3+=2;
+ fin3=0;
+}
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==1){
+ throw new Test262Error('#3.2: "try catch finally{break}" must work correctly');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+for (x in mycars){
+ try{
+ c4+=1;
+ break;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+ c4+=2;
+}
+if(fin4!==1){
+ throw new Test262Error('#4.1: "finally" block must be evaluated');
+}
+if(c4!==1){
+ throw new Test262Error('#4.2: "try{break} finally" must work correctly');
+}
+
+// CHECK#5
+var c5=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ c5++;
+ }
+ catch(er1){
+ break;
+ c5++;
+ }
+ c5++;
+}
+if(c5!==0){
+ throw new Test262Error('#5: "try catch{break}" must work correctly');
+}
+
+// CHECK#6
+var c6=0;
+for (x in mycars){
+ try{
+ c6+=1;
+ break;
+ }
+ catch(er1){}
+ c6+=2;
+}
+if(c6!==1){
+ throw new Test262Error('#6: "try{break} catch" must work correctly');
+}
+
+// CHECK#7
+var c7=0,fin7=0;
+try{
+ for (x in mycars){
+ try{
+ c7+=1;
+ throw "ex1";
+ }
+ finally{
+ fin7=1;
+ break;
+ }
+ fin7=-1;
+ c7+=2;
+ }
+}
+catch(ex1){
+ c7=10;
+}
+if(fin7!==1){
+ throw new Test262Error('#7.1: "finally" block must be evaluated');
+}
+if(c7!==1){
+ throw new Test262Error('#7.2: "try finally{break}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A12_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A12_T4.js
new file mode 100644
index 0000000000..5fd433d0d3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A12_T4.js
@@ -0,0 +1,64 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "for-in"
+ statement
+es5id: 12.14_A12_T4
+description: Try statement inside loop, where combinate using break and continue
+---*/
+
+var x;
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+// CHECK#1
+var c1=0,fin=0;
+for (x in mycars){
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ continue;
+ }
+ fin=-1;
+ c1+=2;
+}
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==3){
+ throw new Test262Error('#1.2: "try{break} catch finally{continue}" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+for (x in mycars){
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ continue;
+ }
+ c2+=2;
+ fin2=-1;
+}
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==3){
+ throw new Test262Error('#2.2: "try catch{break} finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A13_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A13_T1.js
new file mode 100644
index 0000000000..b4178b6a4f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A13_T1.js
@@ -0,0 +1,79 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Using "try" with "catch" or "finally" statement with a "return" statement
+es5id: 12.14_A13_T1
+description: Using try/catch syntax construction
+---*/
+
+// CHECK#1
+function myFunction1(){
+ try{
+ return 1;
+ }
+ catch(err){
+ throw new Test262Error('#1.1: "return 1" inside function does not lead to throwing exception');
+ return 0;
+ }
+ return 2;
+}
+var x1=myFunction1();
+if(x1!==1){
+ throw new Test262Error('#1.2: x1===1. Actual: x1==='+x1);
+}
+
+// CHECK#2
+function myFunction2(){
+ try{
+ throw "exc";
+ return 1;
+ }catch(err){
+ return 2;
+ }
+ return 3;
+}
+var x2=myFunction2();
+if (x2!==2){
+ throw new Test262Error('#2: x2===2. Actual: x2==='+x2);
+}
+
+// CHECK#3
+function myFunction3(){
+ try{
+ return someValue;
+ }catch(err){
+ return 1;
+ }
+ return 2;
+}
+var x3=myFunction3();
+if (x3!==1){
+ throw new Test262Error('#3: x3===1. Actual: x3==='+x3);
+}
+
+// CHECK#4
+function myFunction4(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ throw "ex2"
+ return 0;
+ }
+ return 2;
+}
+try{
+ var x4=myFunction4();
+ throw new Test262Error('#4.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#4.2: Exception !=="ex1". Actual: catch previous exception');
+ }
+ if(e!=="ex2"){
+ throw new Test262Error('#4.3: Exception ==="ex2". Actual: Exception ==='+ e );
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A13_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A13_T2.js
new file mode 100644
index 0000000000..320d3f4394
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A13_T2.js
@@ -0,0 +1,182 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Using "try" with "catch" or "finally" statement with a "return" statement
+es5id: 12.14_A13_T2
+description: Using try/finally syntax construction
+---*/
+
+// CHECK#1
+var c1=0;
+function myFunction1(){
+ try{
+ return 1;
+ }finally{
+ c1=1;
+ }
+ return 2;
+}
+var x1=myFunction1();
+if(x1!==1){
+ throw new Test262Error('#1.1: x1===1. Actual: x1==='+x1);
+}
+if (c1!==1){
+ throw new Test262Error('#1.2: "finally" block must be evaluated');
+}
+
+// CHECK#2
+var c2=0;
+function myFunction2(){
+ try{
+ throw "exc";
+ return 1;
+ }finally{
+ c2=1;
+ }
+ return 2;
+}
+try{
+ var x2=myFunction2();
+ throw new Test262Error('#2.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if (c2!==1){
+ throw new Test262Error('#2.2: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#3
+var c3=0;
+function myFunction3(){
+ try{
+ return someValue;
+ }finally{
+ c3=1;
+ }
+ return 2;
+}
+try{
+ var x3=myFunction3();
+ throw new Test262Error('#3.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if (c3!==1){
+ throw new Test262Error('#3.2: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#4
+var c4=0;
+function myFunction4(){
+ try{
+ return 1;
+ }finally{
+ c4=1;
+ throw "exc";
+ return 0;
+ }
+ return 2;
+}
+try{
+ var x4=myFunction4();
+ throw new Test262Error('#4.2: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if (c4!==1){
+ throw new Test262Error('#4.3: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#5
+var c5=0;
+function myFunction5(){
+ try{
+ return 1;
+ }finally{
+ c5=1;
+ return someValue;
+ return 0;
+ }
+ return 2;
+}
+try{
+ var x5=myFunction5();
+ throw new Test262Error('#5.2: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if (c5!==1){
+ throw new Test262Error('#5.3: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#6
+var c6=0;
+function myFunction6(){
+ try{
+ throw "ex1";
+ return 1;
+ }finally{
+ c6=1;
+ throw "ex2";
+ return 2;
+ }
+ return 3;
+}
+try{
+ var x6=myFunction6();
+ throw new Test262Error('#6.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#6.2: Exception !=="ex1". Actual: catch previous exception');
+ }
+ if(e!=="ex2"){
+ throw new Test262Error('#6.3: Exception !=="ex1". Actual: '+e);
+ }
+ if (c6!==1){
+ throw new Test262Error('#6.4: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#7
+var c7=0;
+function myFunction7(){
+ try{
+ return 1;
+ }finally{
+ c7=1;
+ return 2;
+ }
+ return 3;
+}
+var x7=myFunction7();
+if(x7!==2){
+ throw new Test262Error('#7.1: "catch" block must be evaluated');
+}
+if (c7!==1){
+ throw new Test262Error('#7.2: "finally" block must be evaluated');
+}
+
+// CHECK#8
+var c8=0;
+function myFunction8(){
+ try{
+ throw "ex1";
+ }finally{
+ c8=1;
+ return 2;
+ }
+ return 3;
+}
+try{
+ var x8=myFunction8();
+}
+catch(ex1){
+ c8=10;
+}
+if (c8!==1){
+ throw new Test262Error('#8: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A13_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A13_T3.js
new file mode 100644
index 0000000000..f7b9fd39ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A13_T3.js
@@ -0,0 +1,186 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Using "try" with "catch" or "finally" statement with a "return" statement
+es5id: 12.14_A13_T3
+description: Using try/catch/finally syntax construction
+---*/
+
+// CHECK#1
+var c1=0;
+function myFunction1(){
+ try{
+ return 1;
+ }catch(err){
+ throw new Test262Error('#1.1: "return 1" inside function does not lead to throwing exception');
+ return 0;
+ }finally{
+ c1=1;
+ }
+ return 2;
+}
+var x1=myFunction1();
+if(x1!==1){
+ throw new Test262Error('#1.3: x1===1. Actual: x1==='+x1);
+}
+if (c1!==1){
+ throw new Test262Error('#1.4: "finally" block must be evaluated');
+}
+
+// CHECK#2
+var c2=0;
+function myFunction2(){
+ try{
+ throw "exc";
+ return 1;
+ }catch(err){
+ return 0;
+ }finally{
+ c2=1;
+ }
+ return 2;
+}
+var x2=myFunction2();
+if (c2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if (x2!==0){
+ throw new Test262Error('#2.2: x2===0. Actual: x2==='+x2);
+}
+
+// CHECK#3
+var c3=0;
+function myFunction3(){
+ try{
+ return someValue;
+ }catch(err){
+ return 1;
+ }finally{
+ c3=1;
+ }
+ return 2;
+}
+var x3=myFunction3();
+if (c3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if (x3!==1){
+ throw new Test262Error('#3.2: x3===1. Actual: x3==='+x3);
+}
+
+// CHECK#4
+var c4=0;
+function myFunction4(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ throw "ex2"
+ return 0;
+ }finally{
+ c4=1;
+ }
+ return 2;
+}
+try{
+ var x4=myFunction4();
+ throw new Test262Error('#4.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#4.2: Exception !== "ex1". Actual: catch previous exception');
+ }
+ if(e!=="ex2"){
+ throw new Test262Error('#4.3: Exception === "ex2". Actual: Exception ==='+ e );
+ }
+ if (c4!==1){
+ throw new Test262Error('#4.4: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#5
+var c5=0;
+function myFunction5(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ return 0;
+ }finally{
+ c5=1;
+ throw "ex2";
+ }
+ return 2;
+}
+try{
+ var x5=myFunction5();
+ throw new Test262Error('#5.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#5.2: Exception !== "ex1". Actual: catch previous exception');
+ }
+ if(e!=="ex2"){
+ throw new Test262Error('#5.3: Exception === "ex2". Actual: Exception ==='+ e );
+ }
+ if (c5!==1){
+ throw new Test262Error('#5.4: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#6
+var c6=0;
+function myFunction6(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ throw "ex2";
+ return 0;
+ }finally{
+ c6=1;
+ throw "ex3";
+ }
+ return 2;
+}
+try{
+ var x6=myFunction6();
+ throw new Test262Error('#6.1: Throwing exception inside function lead to throwing exception outside this function');
+}
+catch(e){
+ if(e==="ex1"){
+ throw new Test262Error('#6.2: Exception !== "ex1". Actual: catch previous exception');
+ }
+ if(e==="ex2"){
+ throw new Test262Error('#6.3: Exception !== "ex2". Actual: catch previous exception');
+ }
+ if(e!=="ex3"){
+ throw new Test262Error('#6.4: Exception === "ex3". Actual: Exception ==='+ e );
+ }
+ if(c6!==1) throw new Test262Error('#6.5: "finally" block must be evaluated');
+}
+
+// CHECK#7
+var c7=0;
+function myFunction7(){
+ try{
+ throw "ex1";
+ return 1;
+ }catch(err){
+ throw "ex2";
+ return 0;
+ }finally{
+ c7=1;
+ return 2;
+ }
+ return 3;
+}
+try{
+ var x7=myFunction7();
+ if(x7!==2) throw new Test262Error('#7.1: x7===2. Actual: x7==='+x7);
+}
+catch(e){}
+if(c7!==1) throw new Test262Error('#7.2: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A14.js b/js/src/tests/test262/language/statements/try/S12.14_A14.js
new file mode 100644
index 0000000000..4610f9fcc9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A14.js
@@ -0,0 +1,81 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "with"
+ statement
+es5id: 12.14_A14
+description: Using try/catch/finally in With and With in try/catch/finally
+flags: [noStrict]
+---*/
+
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+
+// CHECK#1
+try{
+ with(myObj){
+ throw "ex";
+ }
+}
+catch(e){
+ if (e!=="ex") throw new Test262Error('#1: Exception ==="ex". Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+with(myObj){
+ try{
+ throw p1;
+ }
+ catch(e){
+ if (e!=="a") throw new Test262Error('#2.1: Exception ==="a". Actual: Exception ==='+ e );
+ p1='pass';
+ }
+}
+if(myObj.p1!=='pass') throw new Test262Error('#2.2: "throw p1" lead to throwing exception');
+
+// CHECK#3
+with(myObj){
+ try{
+ p1='fail';
+ throw p2;
+ }
+ catch(e){
+ if (e!=="b") throw new Test262Error('#3.1: Exception ==="b". Actual: Exception ==='+ e );
+ p1='pass';
+ }
+ finally{
+ p2='pass';
+ }
+}
+if(myObj.p1!=='pass') throw new Test262Error('#3.2: "throw p2" lead to throwing exception');
+if(myObj.p2!=='pass') throw new Test262Error('#3.3: "finally" block must be evaluated');
+
+// CHECK#4
+myObj.p1='fail';
+try{
+ with(myObj){
+ try{
+ throw p3;
+ }
+ finally{
+ p1='pass';
+ }
+ }
+}
+catch(e){}
+if(myObj.p1!=='pass') throw new Test262Error('#4: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A15.js b/js/src/tests/test262/language/statements/try/S12.14_A15.js
new file mode 100644
index 0000000000..bc4f85154d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A15.js
@@ -0,0 +1,94 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Using "try" with "catch" or "finally" statement within/without a "switch"
+ statement
+es5id: 12.14_A15
+description: Insert try/catch/finally to switch statement
+---*/
+
+// CHECK#1
+function SwitchTest1(value){
+ var result = 0;
+ try{
+ switch(value) {
+ case 1:
+ result += 4;
+ throw result;
+ break;
+ default:
+ result += 32;
+ break;
+ case 4:
+ result += 64;
+ throw "ex";
+ }
+ return result;
+ }
+ catch(e){
+ if ((value===1)&&(e!==4)) throw new Test262Error('#1.1: Exception ===4. Actual: Exception ==='+ e );
+ if ((value===4)&&(e!=="ex")) throw new Test262Error('#1.2: Exception ==="ex". Actual: Exception ==='+ e );
+ }
+ finally{
+ return result;
+ }
+}
+if (SwitchTest1(1)!==4) throw new Test262Error('#1.3: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) );
+if (SwitchTest1(4)!==64) throw new Test262Error('#1.4: SwitchTest1(4)===64. Actual: SwitchTest1(4)==='+ SwitchTest1(4) );
+
+// CHECK#2
+var c2=0;
+function SwitchTest2(value){
+ var result = 0;
+ switch(value) {
+ case 0:
+ try{
+ result += 2;
+ break;
+ }
+ finally{
+ c2=1;
+ }
+ case 1:
+ result += 4;
+ break;
+ default:
+ result += 32;
+ break;
+ }
+ return result;
+}
+if (SwitchTest2(1)!==4) throw new Test262Error('#2.1: SwitchTest1(1)===4. Actual: SwitchTest1(1)==='+ SwitchTest1(1) );
+if (c2===1) throw new Test262Error('#2.2: Evaluate finally block');
+if (SwitchTest2(0)!==2) throw new Test262Error('#2.3: SwitchTest1(0)===2. Actual: SwitchTest1(0)==='+ SwitchTest1(0) );
+if (c2!==1) throw new Test262Error('#2.4: "finally" block must be evaluated');
+
+// CHECK#3
+function SwitchTest3(value){
+ var result = 0;
+ switch(value) {
+ case 0:
+ try{
+ result += 2;
+ throw "ex";
+ }
+ finally{
+ break;
+ }
+ default:
+ result += 32;
+ break;
+ }
+ return result;
+}
+try{
+ var x3=SwitchTest3(0);
+ if (x3!==2) throw new Test262Error('#3.1: x3===2. Actual: x3==='+x3);
+}
+catch(e){
+ throw new Test262Error('#3.2: Catching exception inside function does not lead to throwing exception outside this function');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T1.js
new file mode 100644
index 0000000000..ed248811ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T1.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T1
+description: Checking if pure "try" syntax construction passes
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T10.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T10.js
new file mode 100644
index 0000000000..f3d201e690
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T10.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T10
+description: "Catch: \"catch (Identifier ) Block\""
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{}
+catch(){}
+finally{}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T11.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T11.js
new file mode 100644
index 0000000000..a2c9400ad6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T11.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T11
+description: >
+ Catch and Finally are placed into the Block of "try" (whitle
+ expected outside)
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{
+ {
+ }
+ catch(e){}
+ finally{}
+}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T12.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T12.js
new file mode 100644
index 0000000000..8e7fb25480
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T12.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T12
+description: Embedded "try" statements followed by two "catch" statements
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try
+{
+ try
+ {
+ }
+}
+catch(e1){}
+catch(e2){}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T13.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T13.js
new file mode 100644
index 0000000000..f76eb318e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T13.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T13
+description: >
+ Catch: "catch (Identifier ) Block". Checking if execution of "22"
+ passes at the place of Identifier of "catch"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try
+{
+}
+catch("22")
+{
+}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T14.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T14.js
new file mode 100644
index 0000000000..52a69b2c49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T14.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T14
+description: Checking if passing argument to "try" statement fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try(e1){
+}
+catch(e){}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T15.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T15.js
new file mode 100644
index 0000000000..3aff065fa7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T15.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T15
+description: >
+ Finally: "finally Block". Checking if passing argument to "try"
+ statement fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{
+}
+finally(e){}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T2.js
new file mode 100644
index 0000000000..bf1414bcc4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T2.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T2
+description: Checking if execution of "catch" with no "try" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+catch
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T3.js
new file mode 100644
index 0000000000..cbfaccdcdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T3.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T3
+description: Checking if execution of "finally" with no "try" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+finally
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T5.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T5.js
new file mode 100644
index 0000000000..58a128d023
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T5.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T5
+description: >
+ Catch: "catch (Identifier ) Block". Checking if execution of
+ "catch" with no Block fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{}
+catch()
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T6.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T6.js
new file mode 100644
index 0000000000..453b77faee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T6.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T6
+description: >
+ Block: "{ StatementList }". Checking if execution of "try{
+ catch{}{}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{
+catch(){}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T7.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T7.js
new file mode 100644
index 0000000000..ca04f6ea89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T7.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T7
+description: >
+ Block: "{ StatementList }". Checking if execution of "try{}
+ catch(){" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{}
+catch(){
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T8.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T8.js
new file mode 100644
index 0000000000..f4ca2f9242
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T8.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T8
+description: >
+ Block: "{ StatementList }". Catch: "catch (Identifier ) Block".
+ Checking if execution of "try{} catch(){finally{}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+try{}
+catch(){
+finally{}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A16_T9.js b/js/src/tests/test262/language/statements/try/S12.14_A16_T9.js
new file mode 100644
index 0000000000..43466a669d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A16_T9.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ TryStatement: "try Block Catch" or "try Block Finally" or "try Block
+ Catch Finally"
+es5id: 12.14_A16_T9
+description: Checking if execution of "catch(){} finally{}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+// CHECK#1
+catch(){}
+finally{}
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A17.js b/js/src/tests/test262/language/statements/try/S12.14_A17.js
new file mode 100644
index 0000000000..8f55f74ebf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A17.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Using "try" with "catch" or "finally" statement in a constructor
+es5id: 12.14_A17
+description: Creating exceptions within constructor
+---*/
+
+var i=1;
+function Integer( value, exception ) {
+ try{
+ this.value = checkValue( value );
+ if(exception) throw new Test262Error('#'+i+'.1: Must be exception');
+ }
+ catch(e){
+ this.value = e.toString();
+ if(!exception) throw new Test262Error('#'+i+'.2: Don`t must be exception');
+ }
+ i++;
+}
+
+function checkValue(value){
+ if(Math.floor(value)!=value||isNaN(value)){
+ throw (INVALID_INTEGER_VALUE +": " + value);
+ }
+ else{
+ return value;
+ }
+}
+
+// CHECK#1
+new Integer(13, false);
+// CHECK#2
+new Integer(NaN, true);
+// CHECK#3
+new Integer(0, false);
+// CHECK#4
+new Integer(Infinity, false);
+// CHECK#5
+new Integer(-1.23, true);
+// CHECK#6
+new Integer(Math.LN2, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T1.js
new file mode 100644
index 0000000000..c9e098fba3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T1.js
@@ -0,0 +1,18 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T1
+description: Catching undefined
+---*/
+
+// CHECK#1
+try{
+ throw undefined;
+}
+catch(e){
+ if (e!==undefined) throw new Test262Error('#1: Exception === undefined. Actual: '+e);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T2.js
new file mode 100644
index 0000000000..144a7dc7c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T2.js
@@ -0,0 +1,18 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T2
+description: Catching null
+---*/
+
+// CHECK#1
+try{
+ throw null;
+}
+catch(e){
+ if (e!==null) throw new Test262Error('#1: Exception ===null. Actual: '+e);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T3.js
new file mode 100644
index 0000000000..988ba55ec9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T3.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T3
+description: Catching boolean
+---*/
+
+// CHECK#1
+try{
+ throw true;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#1: Exception ===true. Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+try{
+ throw false;
+}
+catch(e){
+ if (e!==false) throw new Test262Error('#2: Exception ===false. Actual: Exception ==='+ e );
+}
+
+// CHECK#3
+var b=false;
+try{
+ throw b;
+}
+catch(e){
+ if (e!==false) throw new Test262Error('#3: Exception ===false. Actual: Exception ==='+ e );
+}
+
+// CHECK#4
+var b=true;
+try{
+ throw b;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#4: Exception ===true. Actual: Exception ==='+ e );
+}
+
+// CHECK#5
+var b=true;
+try{
+ throw b&&false;
+}
+catch(e){
+ if (e!==false) throw new Test262Error('#5: Exception ===false. Actual: Exception ==='+ e );
+}
+
+// CHECK#5
+var b=true;
+try{
+ throw b||false;
+}
+catch(e){
+ if (e!==true) throw new Test262Error('#6: Exception ===true. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T4.js
new file mode 100644
index 0000000000..20e6a62645
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T4.js
@@ -0,0 +1,45 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T4
+description: Catching string
+---*/
+
+// CHECK#1
+try{
+ throw "exception #1";
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#1: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+try{
+ throw "exception"+" #1";
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#2: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+// CHECK#3
+var b="exception #1";
+try{
+ throw b;
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#3: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+// CHECK#4
+var a="exception";
+var b=" #1";
+try{
+ throw a+b;
+}
+catch(e){
+ if (e!=="exception #1") throw new Test262Error('#4: Exception ==="exception #1". Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T5.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T5.js
new file mode 100644
index 0000000000..ac92d818d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T5.js
@@ -0,0 +1,102 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T5
+description: Catching Number
+---*/
+
+// CHECK#1
+try{
+ throw 13;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#1: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#2
+try{
+ throw 10+3;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#2: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#3
+var b=13;
+try{
+ throw b;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#3: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#4
+var a=3;
+var b=10;
+try{
+ throw a+b;
+}
+catch(e){
+ if (e!==13) throw new Test262Error('#4: Exception ===13. Actual: Exception ==='+ e );
+}
+
+// CHECK#5
+try{
+ throw 2.13;
+}
+catch(e){
+ if (e!==2.13) throw new Test262Error('#5: Exception ===2.13. Actual: Exception ==='+ e );
+}
+
+// CHECK#6
+var ex=2/3;
+try{
+ throw 2/3;
+}
+catch(e){
+ if (e!==ex) throw new Test262Error('#6: Exception ===2/3. Actual: Exception ==='+ e );
+}
+
+// CHECK#7
+try{
+ throw NaN;
+}
+catch(e){
+ assert.sameValue(e, NaN, "e is NaN");
+}
+
+// CHECK#8
+try{
+ throw +Infinity;
+}
+catch(e){
+ if (e!==+Infinity) throw new Test262Error('#8: Exception ===+Infinity. Actual: Exception ==='+ e );
+}
+
+// CHECK#9
+try{
+ throw -Infinity;
+}
+catch(e){
+ if (e!==-Infinity) throw new Test262Error('#9: Exception ===-Infinity. Actual: Exception ==='+ e );
+}
+
+// CHECK#10
+try{
+ throw +0;
+}
+catch(e){
+ if (e!==+0) throw new Test262Error('#10: Exception ===+0. Actual: Exception ==='+ e );
+}
+
+// CHECK#11
+try{
+ throw -0;
+}
+catch(e){
+ assert.sameValue(e, -0);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T6.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T6.js
new file mode 100644
index 0000000000..1a4ba300cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T6.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T6
+description: Catching Object
+---*/
+
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';},
+ i:7,
+}
+
+try{
+ throw myObj;
+}
+catch(e){
+// CHECK#1
+ if (e.p1!=="a") throw new Test262Error('#1: e.p1==="a". Actual: e.p1==='+ e.p1 );
+// CHECK#2
+ if (e.value!=='myObj_value') throw new Test262Error('#2: e.value===\'myObj_value\'. Actual: e.value==='+ e.value );
+// CHECK#3
+ if (e.eval()!=='obj_eval') throw new Test262Error('#3: e.eval()===\'obj_eval\'. Actual: e.eval()==='+ e.eval() );
+}
+
+// CHECK#4
+myObj.i=6;
+try{
+ throw myObj;
+}
+catch(e){}
+if (myObj.i!==6) throw new Test262Error('#4: Handling of catch must be correct');
+
+// CHECK#5
+myObj.i=6;
+try{
+ throw myObj;
+}
+catch(e){
+ e.i=10;
+}
+if (myObj.i!==10) throw new Test262Error('#5: Handling of catch must be correct');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A18_T7.js b/js/src/tests/test262/language/statements/try/S12.14_A18_T7.js
new file mode 100644
index 0000000000..c4408e8c5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A18_T7.js
@@ -0,0 +1,66 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching objects with try/catch/finally statement
+es5id: 12.14_A18_T7
+description: Catching Array
+---*/
+
+var mycars = new Array();
+mycars[0] = "Saab";
+mycars[1] = "Volvo";
+mycars[2] = "BMW";
+
+var mycars2 = new Array();
+mycars2[0] = "Mercedes";
+mycars2[1] = "Jeep";
+mycars2[2] = "Suzuki";
+
+// CHECK#1
+try{
+ throw mycars;
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars[i]) throw new Test262Error('#1.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] );
+ }
+}
+
+// CHECK#2
+try{
+ throw mycars.concat(mycars2);
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars[i]) throw new Test262Error('#2.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] );
+ }
+ for (var i=3;i<6;i++){
+ if (e[i]!==mycars2[i-3]) throw new Test262Error('#2.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i] );
+ }
+}
+
+// CHECK#3
+try{
+ throw new Array("Mercedes","Jeep","Suzuki");
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars2[i]) throw new Test262Error('#3.'+i+': Exception['+i+']===mycars2['+i+']. Actual: Exception['+i+']==='+ e[i]);
+ }
+}
+
+// CHECK#4
+try{
+ throw mycars.concat(new Array("Mercedes","Jeep","Suzuki"));
+}
+catch(e){
+ for (var i=0;i<3;i++){
+ if (e[i]!==mycars[i]) throw new Test262Error('#4.'+i+': Exception['+i+']===mycars['+i+']. Actual: Exception['+i+']==='+ e[i] );
+ }
+ for (var i=3;i<6;i++){
+ if (e[i]!==mycars2[i-3]) throw new Test262Error('#4.'+i+': Exception['+i+']===mycars2['+(i-3)+']. Actual: Exception['+i+']==='+ e[i]);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A19_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A19_T1.js
new file mode 100644
index 0000000000..3411c326a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A19_T1.js
@@ -0,0 +1,68 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching system exceptions of different types with try statement
+es5id: 12.14_A19_T1
+description: Testing try/catch syntax construction
+---*/
+
+// CHECK#1
+try{
+ throw (Error("hello"));
+}
+catch(e){
+ if (e.toString()!=="Error: hello") throw new Test262Error('#1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
+}
+
+// CHECK#2
+try{
+ throw (new Error("hello"));
+}
+catch(e){
+ if (e.toString()!=="Error: hello") throw new Test262Error('#2: Exception.toString()==="Error: hello". Actual: Exception is '+e);
+}
+
+// CHECK#3
+var c3=0;
+try{
+ throw EvalError(1);
+}
+catch(e){
+ if (e.toString()!=="EvalError: 1") throw new Test262Error('#3: Exception.toString()==="EvalError: 1". Actual: Exception is '+e);
+}
+
+// CHECK#4
+try{
+ throw RangeError(1);
+}
+catch(e){
+ if (e.toString()!=="RangeError: 1") throw new Test262Error('#4: Exception.toString()==="RangeError: 1". Actual: Exception is '+e);
+}
+
+// CHECK#5
+try{
+ throw ReferenceError(1);
+}
+catch(e){
+ if (e.toString()!=="ReferenceError: 1") throw new Test262Error('#5: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e);
+}
+
+// CHECK#6
+var c6=0;
+try{
+ throw TypeError(1);
+}
+catch(e){
+ if (e.toString()!=="TypeError: 1") throw new Test262Error('#6: Exception.toString()==="TypeError: 1". Actual: Exception is '+e);
+}
+
+// CHECK#7
+try{
+ throw URIError("message", "fileName", "1");
+}
+catch(e){
+ if (e.toString()!=="URIError: message") throw new Test262Error('#7: Exception.toString()==="URIError: message". Actual: Exception is '+e);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A19_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A19_T2.js
new file mode 100644
index 0000000000..e68f4e7651
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A19_T2.js
@@ -0,0 +1,102 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching system exceptions of different types with try statement
+es5id: 12.14_A19_T2
+description: Testing try/catch/finally syntax construction
+---*/
+
+var fin=0;
+// CHECK#1
+try{
+ throw (Error("hello"));
+}
+catch(e){
+ if (e.toString()!=="Error: hello") throw new Test262Error('#1.1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#1.2: "finally" block must be evaluated');
+
+// CHECK#2
+fin=0;
+try{
+ throw (new Error("hello"));
+}
+catch(e){
+ if (e.toString()!=="Error: hello") throw new Test262Error('#2.1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#2.2: "finally" block must be evaluated');
+
+// CHECK#3
+fin=0;
+var c3=0;
+try{
+ throw EvalError(1);
+}
+catch(e){
+ if (e.toString()!=="EvalError: 1") throw new Test262Error('#3.1: Exception.toString()==="EvalError: 1". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#3.2: "finally" block must be evaluated');
+
+// CHECK#4
+fin=0;
+try{
+ throw RangeError(1);
+}
+catch(e){
+ if (e.toString()!=="RangeError: 1") throw new Test262Error('#4.1: Exception.toString()==="RangeError: 1". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#4.2: "finally" block must be evaluated');
+
+// CHECK#5
+fin=0;
+try{
+ throw ReferenceError(1);
+}
+catch(e){
+ if (e.toString()!=="ReferenceError: 1") throw new Test262Error('#5.1: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#5.2: "finally" block must be evaluated');
+
+// CHECK#6
+fin=0;
+try{
+ throw TypeError(1);
+}
+catch(e){
+ if (e.toString()!=="TypeError: 1") throw new Test262Error('#6.1: Exception.toString()==="TypeError: 1". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#6.2: "finally" block must be evaluated');
+
+// CHECK#7
+fin=0;
+try{
+ throw URIError("message", "fileName", "1");
+}
+catch(e){
+ if (e.toString()!=="URIError: message") throw new Test262Error('#7.1: Exception.toString()==="URIError: message". Actual: Exception is '+e);
+}
+finally{
+ fin=1;
+}
+if (fin!==1) throw new Test262Error('#7.2: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A2.js b/js/src/tests/test262/language/statements/try/S12.14_A2.js
new file mode 100644
index 0000000000..fdb077f90b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A2.js
@@ -0,0 +1,54 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Throwing exception with "throw" and catching it with "try" statement
+es5id: 12.14_A2
+description: >
+ Checking if execution of "catch" catches an exception thrown with
+ "throw"
+---*/
+
+// CHECK#1
+try {
+ throw "catchme";
+ throw new Test262Error('#1: throw "catchme" lead to throwing exception');
+}
+catch(e){}
+
+// CHECK#2
+var c2=0;
+try{
+ try{
+ throw "exc";
+ throw new Test262Error('#2.1: throw "exc" lead to throwing exception');
+ }finally{
+ c2=1;
+ }
+}
+catch(e){
+ if (c2!==1){
+ throw new Test262Error('#2.2: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#3
+var c3=0;
+try{
+ throw "exc";
+ throw new Test262Error('#3.1: throw "exc" lead to throwing exception');
+}
+catch(err){
+ var x3=1;
+}
+finally{
+ c3=1;
+}
+if (x3!==1){
+ throw new Test262Error('#3.2: "catch" block must be evaluated');
+}
+if (c3!==1){
+ throw new Test262Error('#3.3: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A3.js b/js/src/tests/test262/language/statements/try/S12.14_A3.js
new file mode 100644
index 0000000000..264b44084e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A3.js
@@ -0,0 +1,53 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Catching system exception with "try" statement
+es5id: 12.14_A3
+description: Checking if execution of "catch" catches system exceptions
+---*/
+
+// CHECK#1
+try{
+ y;
+ throw new Test262Error('#1: "y" lead to throwing exception');
+}
+catch(e){}
+
+// CHECK#2
+var c2=0;
+try{
+ try{
+ someValue;
+ throw new Test262Error('#3.1: "someValues" lead to throwing exception');
+ }
+ finally{
+ c2=1;
+ }
+}
+catch(e){
+ if (c2!==1){
+ throw new Test262Error('#3.2: "finally" block must be evaluated');
+ }
+}
+
+// CHECK#3
+var c3=0,x3=0;
+try{
+ x3=someValue;
+ throw new Test262Error('#3.1: "x3=someValues" lead to throwing exception');
+}
+catch(err){
+ x3=1;
+}
+finally{
+ c3=1;
+}
+if (x3!==1){
+ throw new Test262Error('#3.2: "catch" block must be evaluated');
+}
+if (c3!==1){
+ throw new Test262Error('#3.3: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A4.js b/js/src/tests/test262/language/statements/try/S12.14_A4.js
new file mode 100644
index 0000000000..9e03cf1989
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A4.js
@@ -0,0 +1,37 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Sanity test for "catch(Indetifier) statement"
+es5id: 12.14_A4
+description: Checking if deleting an exception fails
+flags: [noStrict]
+---*/
+
+// CHECK#1
+try {
+ throw "catchme";
+ throw new Test262Error('#1.1: throw "catchme" lead to throwing exception');
+}
+catch (e) {
+ if (delete e){
+ throw new Test262Error('#1.2: Exception has DontDelete property');
+ }
+ if (e!=="catchme") {
+ throw new Test262Error('#1.3: Exception === "catchme". Actual: Exception ==='+ e );
+ }
+}
+
+// CHECK#2
+try {
+ throw "catchme";
+ throw new Test262Error('#2.1: throw "catchme" lead to throwing exception');
+}
+catch(e){}
+try{
+ e;
+ throw new Test262Error('#2.2: Deleting catching exception after ending "catch" block');
+}
+catch(err){}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A5.js b/js/src/tests/test262/language/statements/try/S12.14_A5.js
new file mode 100644
index 0000000000..f03fd6652a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A5.js
@@ -0,0 +1,53 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production TryStatement: "try Block Finally" and the production
+ TryStatement: "try Block Catch Finally"
+es5id: 12.14_A5
+description: Checking "catch" catches the Identifier in appropriate way
+---*/
+
+// CHECK#1
+try {
+ throw "catchme";
+ throw "dontcatchme";
+ throw new Test262Error('#1.1: throw "catchme" lead to throwing exception');
+}
+catch (e) {
+ if(e==="dontcatchme"){
+ throw new Test262Error('#1.2: Exception !== "dontcatchme"');
+ }
+ if (e!=="catchme") {
+ throw new Test262Error('#1.3: Exception === "catchme". Actual: Exception ==='+ e );
+ }
+}
+
+// CHECK#2
+function SwitchTest1(value){
+ var result = 0;
+ try{
+ switch(value) {
+ case 1:
+ result += 4;
+ throw result;
+ break;
+ case 4:
+ result += 64;
+ throw "ex";
+ }
+ return result;
+ }
+ catch(e){
+ if ((value===1)&&(e!==4)) throw new Test262Error('#2.1: Exception === 4. Actual: '+e);
+ if ((value===4)&&(e!=="ex"))throw new Test262Error('#2.2: Exception === "ex". Actual: '+e);
+ }
+ finally{
+ return result;
+ }
+}
+if (SwitchTest1(1)!==4) throw new Test262Error('#2.3: "finally" block must be evaluated');
+if (SwitchTest1(4)!==64)throw new Test262Error('#2.4: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A6.js b/js/src/tests/test262/language/statements/try/S12.14_A6.js
new file mode 100644
index 0000000000..78423b7946
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A6.js
@@ -0,0 +1,69 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "The production TryStatement: \"try Block Catch Finally\""
+es5id: 12.14_A6
+description: >
+ Executing sequence of "try" statements, using counters with
+ varying values within
+---*/
+
+// CHECK#1
+var c1=0;
+try {
+ c1+=1;
+ y;
+ throw new Test262Error('#1.1: "y" lead to throwing exception');
+}
+catch (e) {
+ c1*=2;
+}
+if (c1!==2){
+ throw new Test262Error('#1.2: Sequence evaluation of commands try/catch is 1. try, 2. catch');
+}
+
+// CHECK#2
+var c2=0;
+try{
+ c2+=1;
+}
+finally{
+ c2*=2;
+}
+if (c2!==2){
+ throw new Test262Error('#2: Sequence evaluation of commands try/finally is 1. try, 2. finally');
+}
+
+// CHECK#3
+var c3=0;
+try{
+ c3=1;
+ z;
+}
+catch(err){
+ c3*=2;
+}
+finally{
+ c3+=1;
+}
+if (c3!==3){
+ throw new Test262Error('#3: Sequence evaluation of commands try/catch/finally(with exception) is 1. try, 2. catch, 3. finally');
+}
+
+// CHECK#4
+var c4=0;
+try{
+ c4=1;
+}
+catch(err){
+ c4*=3;
+}
+finally{
+ c4+=1;
+}
+if (c4!==2){
+ throw new Test262Error('#4: Sequence evaluation of commands try/catch/finally(without exception) is 1. try, 2. finally');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A7_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A7_T1.js
new file mode 100644
index 0000000000..8f3071f5f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A7_T1.js
@@ -0,0 +1,140 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Evaluating the nested productions TryStatement
+es5id: 12.14_A7_T1
+description: >
+ Checking if the production of nested TryStatement statements
+ evaluates correct
+---*/
+
+// CHECK#1
+try{
+ try{
+ throw "ex2";
+ }
+ catch(er2){
+ if (er2!=="ex2")
+ throw new Test262Error('#1.1: Exception === "ex2". Actual: Exception ==='+ e );
+ throw "ex1";
+ }
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#1.2: Exception === "ex1". Actual: '+er1);
+ if (er1==="ex2") throw new Test262Error('#1.3: Exception !== "ex2". Actual: catch previous embedded exception');
+}
+
+// CHECK#2
+try{
+ throw "ex1";
+}
+catch(er1){
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#2.1: Exception !== "ex1". Actual: catch previous catching exception');
+ if (er1!=="ex2") throw new Test262Error('#2.2: Exception === "ex2". Actual: Exception ==='+ er1 );
+ }
+ if (er1!=="ex1") throw new Test262Error('#2.3: Exception === "ex1". Actual: Exception ==='+ er1 );
+ if (er1==="ex2") throw new Test262Error('#2.4: Exception !== "ex2". Actual: catch previous catching exception');
+}
+
+// CHECK#3
+try{
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#3.1: Exception ==="ex1". Actual: Exception ==='+ er1 );
+}
+finally{
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#3.2: Exception !=="ex1". Actual: catch previous embedded exception');
+ if (er1!=="ex2") throw new Test262Error('#3.3: Exception ==="ex2". Actual: Exception ==='+ er1 );
+ }
+}
+
+// CHECK#4
+var c4=0;
+try{
+ throw "ex1";
+}
+catch(er1){
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#4.1: Exception !=="ex1". Actual: catch previous catching exception');
+ if (er1!=="ex2") throw new Test262Error('#4.2: Exception ==="ex2". Actual: Exception ==='+ er1 );
+ }
+ if (er1!=="ex1") throw new Test262Error('#4.3: Exception ==="ex1". Actual: Exception ==='+ er1 );
+ if (er1==="ex2") throw new Test262Error('#4.4: Exception !=="ex2". Actual: Catch previous embedded exception');
+}
+finally{
+ c4=1;
+}
+if (c4!==1) throw new Test262Error('#4.5: "finally" block must be evaluated');
+
+// CHECK#5
+var c5=0;
+try{
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#5.1: Exception ==="ex2". Actual: Exception ==='+ er1 );
+ }
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#5.2: Exception ==="ex1". Actual: Exception ==='+ er1 );
+ if (er1==="ex2") throw new Test262Error('#5.3: Exception !=="ex2". Actual: catch previous embedded exception');
+}
+finally{
+ c5=1;
+}
+if (c5!==1) throw new Test262Error('#5.4: "finally" block must be evaluated');
+
+// CHECK#6
+var c6=0;
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#6.1: Exception ==="ex1". Actual: Exception ==='+ er1 );
+ }
+}
+finally{
+ c6=1;
+}
+if (c6!==1) throw new Test262Error('#6.2: "finally" block must be evaluated');
+
+// CHECK#7
+var c7=0;
+try{
+ try{
+ throw "ex1";
+ }
+ finally{
+ try{
+ c7=1;
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#7.1: Exception ==="ex2". Actual: Exception ==='+ er1 );
+ if (er1==="ex1") throw new Test262Error('#7.2: Exception !=="ex1". Actual: catch previous embedded exception');
+ c7++;
+ }
+ }
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#7.3: Exception ==="ex1". Actual: Exception ==='+ er1 );
+}
+if (c7!==2) throw new Test262Error('#7.4: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A7_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A7_T2.js
new file mode 100644
index 0000000000..d821ca61fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A7_T2.js
@@ -0,0 +1,154 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Evaluating the nested productions TryStatement
+es5id: 12.14_A7_T2
+description: >
+ Checking if the production of nested TryStatement statements
+ evaluates correct
+---*/
+
+// CHECK#1
+try{
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex1";
+ }
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#1.2: Exception === "ex1". Actual: Exception ==='+er1 );
+ if (er1==="ex2") throw new Test262Error('#1.3: Exception !== "ex2". Actual: catch previous embedded exception');
+}
+
+// CHECK#2
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#2.1: Exception === "ex1". Actual: Exception ==='+er1 );
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex3";
+ }
+ throw new Test262Error('#2.2: throw "ex1" lead to throwing exception');
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#2.3: Exception === "ex3". Actual: Exception ==='+er1 );
+}
+
+// CHECK#3
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#3.1: Exception === "ex1". Actual: Exception ==='+er1 );
+ }
+ finally{
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex3";
+ }
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#3.2: Exception === "ex3". Actual: Exception ==='+er1 );
+}
+
+// CHECK#4
+var c4=0;
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#4.1: Exception === "ex1". Actual: Exception ==='+er1 );
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex3";
+ }
+ }
+ finally{
+ c4=1;
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#4.2: Exception === "ex3". Actual: Exception ==='+er1 );
+}
+if (c4!==1) throw new Test262Error('#4.3: "finally" block must be evaluated');
+
+// CHECK#5
+var c5=0;
+try{
+ try{
+ throw "ex2";
+ }
+ finally{
+ throw "ex3";
+ }
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#5.1: Exception === "ex3". Actual: Exception ==='+er1 );
+ if (er1==="ex2") throw new Test262Error('#5.2: Exception !== "ex2". Actual: catch previous embedded exception');
+ if (er1==="ex1") throw new Test262Error('#5.3: Exception !=="ex1". Actual: catch previous embedded exception');
+}
+finally{
+ c5=1;
+}
+if (c5!==1) throw new Test262Error('#5.4: "finally" block must be evaluated');
+
+// CHECK#6
+var c6=0;
+try{
+ try{
+ try{
+ throw "ex1";
+ }
+ finally{
+ throw "ex2";
+ }
+ }
+ finally{
+ c6=1;
+ }
+}
+catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#6.1: Exception === "ex2". Actual: Exception ==='+er1 );
+}
+if (c6!==1) throw new Test262Error('#6.2: "finally" block must be evaluated');
+
+// CHECK#7
+var c7=0;
+try{
+ try{
+ throw "ex1";
+ }
+ finally{
+ try{
+ c7=1;
+ throw "ex2";
+ }
+ finally{
+ c7++;
+ throw "ex3";
+ }
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#7.1: Exception === "ex3". Actual: Exception ==='+er1 );
+}
+if (c7!==2) throw new Test262Error('#7.2: Embedded "try/finally" blocks must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A7_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A7_T3.js
new file mode 100644
index 0000000000..1ce40acb3a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A7_T3.js
@@ -0,0 +1,171 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Evaluating the nested productions TryStatement
+es5id: 12.14_A7_T3
+description: >
+ Checking if the production of nested TryStatement statements
+ evaluates correct
+---*/
+
+// CHECK#1
+try{
+ try{
+ throw "ex2";
+ }
+ catch(er2){
+ if (er2!=="ex2") throw new Test262Error('#1.1: Exception === "ex2". Actual: Exception ==='+er2);
+ throw "ex1";
+ }
+ finally{
+ throw "ex3";
+ }
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#1.2: Exception === "ex3". Actual: Exception ==='+er1);
+ if (er1==="ex2") throw new Test262Error('#1.3: Exception !=="ex2". Actual: catch previous catched exception');
+ if (er1==="ex1") throw new Test262Error('#1.4: Exception !=="ex1". Actual: catch previous embedded exception');
+}
+
+// CHECK#2
+var c2=0;
+try{
+ throw "ex1";
+}
+catch(er1){
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#2.1: Exception !=="ex1". Actual: catch previous catched exception');
+ if (er1!=="ex2") throw new Test262Error('#2.2: Exception === "ex2". Actual: Exception ==='+er1);
+ }
+ finally{
+ c2=1;
+ }
+ if (er1!=="ex1") throw new Test262Error('#2.3: Exception === "ex1". Actual: Exception ==='+er1);
+ if (er1==="ex2") throw new Test262Error('#2.4: Exception !== "ex2". Actual: catch previous embedded exception');
+}
+if (c2!==1) throw new Test262Error('#2.5: "finally" block must be evaluated');
+
+// CHECK#3
+var c3=0;
+try{
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#3.1: Exception === "ex1". Actual: Exception ==='+er1);
+}
+finally{
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#3.2: Exception !=="ex1". Actual: catch previous catched exception');
+ if (er1!=="ex2") throw new Test262Error('#3.3: Exception === "ex2". Actual: Exception ==='+er1);
+ }
+ finally{
+ c3=1;
+ }
+}
+if (c3!==1) throw new Test262Error('#3.4: "finally" block must be evaluated');
+
+// CHECK#4
+var c4=0;
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1==="ex1") throw new Test262Error('#4.1: Exception !=="ex2". Actual: catch previous catched exception');
+ if (er1!=="ex2") throw new Test262Error('#4.2: Exception === "ex2". Actual: Exception ==='+er1);
+ }
+ finally{
+ c4=2;
+ throw "ex3";
+ }
+ if (er1!=="ex1") throw new Test262Error('#4.3: Exception === "ex2". Actual: Exception ==='+er1);
+ if (er1==="ex2") throw new Test262Error('#4.4: Exception !=="ex2". Actual: catch previous catched exception');
+ if (er1==="ex3") throw new Test262Error('#4.5: Exception !=="ex3". Actual: Catch previous embedded exception');
+ }
+ finally{
+ c4*=2;
+ }
+}
+catch(er1){}
+if (c4!==4) throw new Test262Error('#4.6: "finally" block must be evaluated');
+
+// CHECK#5
+var c5=0;
+try{
+ try{
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#5.1: Exception === "ex2". Actual: Exception ==='+er1);
+ }
+ finally{
+ throw "ex3";
+ }
+ throw "ex1";
+}
+catch(er1){
+ if (er1!=="ex3") throw new Test262Error('#5.2: Exception === "ex3". Actual: Exception ==='+er1);
+ if (er1==="ex2") throw new Test262Error('#5.3: Exception !=="ex2". Actual: catch previous catched exception');
+ if (er1==="ex1") throw new Test262Error('#5.4: Exception !=="ex1". Actual: catch previous embedded exception');
+}
+finally{
+ c5=1;
+}
+if (c5!==1) throw new Test262Error('#5.5: "finally" block must be evaluated');
+
+// CHECK#6
+var c6=0;
+try{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#6.1: Exception === "ex1". Actual: Exception ==='+er1);
+ }
+ finally{
+ c6=2;
+ }
+}
+finally{
+ c6*=2;
+}
+if (c6!==4) throw new Test262Error('#6.2: "finally" block must be evaluated');
+
+// CHECK#7
+var c7=0;
+try{
+ try{
+ throw "ex1";
+ }
+ finally{
+ try{
+ c7=1;
+ throw "ex2";
+ }
+ catch(er1){
+ if (er1!=="ex2") throw new Test262Error('#7.1: Exception === "ex2". Actual: Exception ==='+er1);
+ if (er1==="ex1") throw new Test262Error('#7.2: Exception !=="ex2". Actual: catch previous catched exception');
+ c7++;
+ }
+ finally{
+ c7*=2;
+ }
+ }
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#7.3: Exception === "ex1". Actual: Exception ==='+er1);
+}
+if (c7!==4) throw new Test262Error('#7.4: "finally" block must be evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A8.js b/js/src/tests/test262/language/statements/try/S12.14_A8.js
new file mode 100644
index 0000000000..4c171ea2cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A8.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"try\" with \"catch\" or \"finally\" statement within/without an \"if\" statement"
+es5id: 12.14_A8
+description: Throwing exception within an "if" statement
+---*/
+
+// CHECK#1
+var c1=1;
+try{
+ if(c1===1){
+ throw "ex1";
+ throw new Test262Error('#1.1: throw "ex1" lead to throwing exception');
+ }
+ throw new Test262Error('#1.2: throw "ex1" inside the "if" statement lead to throwing exception');
+}
+catch(er1){
+ if (er1!=="ex1") throw new Test262Error('#1.3: Exception ==="ex1". Actual: Exception ==='+er1);
+}
+
+// CHECK#2
+var c2=1;
+if(c2===1){
+ try{
+ throw "ex1";
+ throw new Test262Error('#2.1: throw "ex1" lead to throwing exception');
+ }
+ catch(er1){
+ if(er1!="ex1") throw new Test262Error('#2.2: Exception ==="ex1". Actual: Exception ==='+er1);
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T1.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T1.js
new file mode 100644
index 0000000000..20ca431d8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T1.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T1
+description: Loop within a "try" Block, from where exception is thrown
+---*/
+
+// CHECK#1
+var i=0;
+try{
+ do{
+ if(i===5) throw i;
+ i++;
+ }
+ while(i<10);
+}
+catch(e){
+ if(e!==5)throw new Test262Error('#1: Exception ===5. Actual: Exception ==='+ e );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T2.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T2.js
new file mode 100644
index 0000000000..0b2b895887
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T2.js
@@ -0,0 +1,126 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T2
+description: >
+ "try" statement within a loop, the statement contains "continue"
+ statement
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+do{
+ try{
+ c1+=1;
+ continue;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+}
+while(c1<2);
+if(fin!==1){
+ throw new Test262Error('#1: "finally" block must be evaluated at "try{continue} catch finally" construction');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ continue;
+ }
+ finally{
+ fin2=1;
+ }
+ fin2=-1;
+}
+while(c2<2);
+if(fin2!==1){
+ throw new Test262Error('#2: "finally" block must be evaluated at "try catch{continue} finally" construction');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ continue;
+ }
+ fin3=0;
+}
+while(c3<2);
+if(fin3!==1){
+ throw new Test262Error('#3: "finally" block must be evaluated at "try catch finally{continue}" construction');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+do{
+ try{
+ c4+=1;
+ continue;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+}
+while(c4<2);
+if(fin4!==1){
+ throw new Test262Error('#4: "finally" block must be evaluated at "try{continue} finally" construction');
+}
+
+// CHECK#5
+var c5=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c5+=1;
+ continue;
+ }
+}
+while(c5<2);
+if(c5!==2){
+ throw new Test262Error('#5: "try catch{continue}" must work correctly');
+}
+
+// CHECK#6
+var c6=0,fin6=0;
+do{
+ try{
+ c6+=1;
+ throw "ex1"
+ }
+ finally{
+ fin6=1;
+ continue;
+ }
+ fin6=-1;
+}
+while(c6<2);
+if(fin6!==1){
+ throw new Test262Error('#6.1: "finally" block must be evaluated');
+}
+if(c6!==2){
+ throw new Test262Error('#6.2: "try finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T3.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T3.js
new file mode 100644
index 0000000000..2489cebd21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T3.js
@@ -0,0 +1,162 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T3
+description: >
+ "try" statement within a loop, the statement contains "break"
+ statement
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+do{
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ }
+ fin=-1;
+ c1+=2;
+}
+while(c1<2);
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==1){
+ throw new Test262Error('#1.2: "try{break}catch finally" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ }
+ c2+=2;
+ fin2=-1;
+}
+while(c2<2);
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==1){
+ throw new Test262Error('#2.2: "try catch{break} finally" must work correctly');
+}
+
+// CHECK#3
+var c3=0,fin3=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c3+=1;
+ }
+ finally{
+ fin3=1;
+ break;
+ }
+ c3+=2;
+ fin3=0;
+}
+while(c3<2);
+if(fin3!==1){
+ throw new Test262Error('#3.1: "finally" block must be evaluated');
+}
+if(c3!==1){
+ throw new Test262Error('#3.2: "try catch finally{break}" must work correctly');
+}
+
+// CHECK#4
+var c4=0,fin4=0;
+do{
+ try{
+ c4+=1;
+ break;
+ }
+ finally{
+ fin4=1;
+ }
+ fin4=-1;
+ c4+=2;
+}
+while(c4<2);
+if(fin4!==1){
+ throw new Test262Error('#4.1: "finally" block must be evaluated');
+}
+if(c4!==1){
+ throw new Test262Error('#4.2: "try{break} finally" must work correctly');
+}
+
+// CHECK#5
+var c5=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ break;
+ }
+}
+while(c5<2);
+if(c5!==0){
+ throw new Test262Error('#5: "try catch{break}" must work correctly');
+}
+
+// CHECK#6
+var c6=0;
+do{
+ try{
+ c6+=1;
+ break;
+ }
+ catch(er1){}
+ c6+=2;
+}
+while(c6<2);
+if(c6!==1){
+ throw new Test262Error('#6: "try{break} catch" must work correctly');
+}
+
+// CHECK#7
+var c7=0,fin7=0;
+try{
+ do{
+ try{
+ c7+=1;
+ throw "ex1";
+ }
+ finally{
+ fin7=1;
+ break;
+ }
+ fin7=-1;
+ c7+=2;
+ }
+ while(c7<2);
+}
+catch(ex1){
+ c7=10;
+}
+if(fin7!==1){
+ throw new Test262Error('#7.1: "finally" block must be evaluated');
+}
+if(c7!==1){
+ throw new Test262Error('#7.2: try finally{break} error');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T4.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T4.js
new file mode 100644
index 0000000000..44f4a4d9db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T4.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T4
+description: >
+ "try" statement within a loop, the statement contains "continue"
+ and "break" statements
+---*/
+
+// CHECK#1
+var c1=0,fin=0;
+do{
+ try{
+ c1+=1;
+ break;
+ }
+ catch(er1){}
+ finally{
+ fin=1;
+ continue;
+ }
+ fin=-1;
+ c1+=2;
+}
+while(c1<2);
+if(fin!==1){
+ throw new Test262Error('#1.1: "finally" block must be evaluated');
+}
+if(c1!==2){
+ throw new Test262Error('#1.2: "try{break} catch finally{continue}" must work correctly');
+}
+
+// CHECK#2
+var c2=0,fin2=0;
+do{
+ try{
+ throw "ex1";
+ }
+ catch(er1){
+ c2+=1;
+ break;
+ }
+ finally{
+ fin2=1;
+ continue;
+ }
+ c2+=2;
+ fin2=-1;
+}
+while(c2<2);
+if(fin2!==1){
+ throw new Test262Error('#2.1: "finally" block must be evaluated');
+}
+if(c2!==2){
+ throw new Test262Error('#2.2: "try catch{break} finally{continue}" must work correctly');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/S12.14_A9_T5.js b/js/src/tests/test262/language/statements/try/S12.14_A9_T5.js
new file mode 100644
index 0000000000..96d0bafdb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/S12.14_A9_T5.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "try" with "catch" or "finally" statement within/without an "do while"
+ statement
+es5id: 12.14_A9_T5
+description: >
+ Checking if exceptions are thrown correctly from wherever of loop
+ body
+---*/
+
+// CHECK#1
+var c=0, i=0;
+var fin=0;
+do{
+ i+=1;
+ try{
+ if(c===0){
+ throw "ex1";
+ throw new Test262Error('#1.1: throw "ex1" lead to throwing exception');
+ }
+ c+=2;
+ if(c===1){
+ throw "ex2";
+ throw new Test262Error('#1.2: throw "ex2" lead to throwing exception');
+ }
+ }
+ catch(er1){
+ c-=1;
+ continue;
+ throw new Test262Error('#1.3: "try catch{continue} finally" must work correctly');
+ }
+ finally{
+ fin+=1;
+ }
+}
+while(i<10);
+if(fin!==10){
+ throw new Test262Error('#1.4: "finally" block must be evaluated');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/browser.js b/js/src/tests/test262/language/statements/try/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/browser.js
diff --git a/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws-strict.js b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws-strict.js
new file mode 100644
index 0000000000..816ae2e2f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-eval-throws-strict.js
@@ -0,0 +1,16 @@
+'use strict';
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+ It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+flags: [onlyStrict]
+---*/
+
+assert.throws(SyntaxError, function() {
+ eval("try {} catch (arguments) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early-strict.js b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early-strict.js
new file mode 100644
index 0000000000..6b2338904e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+ It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (arguments) { }
diff --git a/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws-strict.js b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws-strict.js
new file mode 100644
index 0000000000..4fd4fbb3a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-eval-throws-strict.js
@@ -0,0 +1,16 @@
+'use strict';
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+ It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+flags: [onlyStrict]
+---*/
+
+assert.throws(SyntaxError, function() {
+ eval("try {} catch (eval) { }");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early-strict.js b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early-strict.js
new file mode 100644
index 0000000000..8823cc1e28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-strict-mode-of-ecmascript
+description: >
+ It is a SyntaxError if a CatchParameter occurs within strict mode code and BoundNames of CatchParameter contains either eval or arguments (13.15.1).
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (eval) { }
diff --git a/js/src/tests/test262/language/statements/try/completion-values-fn-finally-abrupt.js b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-abrupt.js
new file mode 100644
index 0000000000..b81cbb7f71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-abrupt.js
@@ -0,0 +1,81 @@
+// Copyright (C) 2020 Salesforce.com. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: >
+ Returns the correct completion values of try-catch-finally(Abrupt) in functions
+info: |
+ TryStatement : try Block Catch Finally
+
+ Let B be the result of evaluating Block.
+ If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with argument B.[[Value]].
+ Else, let C be B.
+ Let F be the result of evaluating Finally.
+ If F.[[Type]] is normal, set F to C.
+ Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+var fn, count = {};
+
+// 1: try Abrupt, catch Abrupt, finally Abrupt; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ throw 'catch';
+ } finally {
+ count.finally += 1;
+ throw new Test262Error('finally'); // If F.[[Type]] is normal, set F to C.
+ }
+ return 'wat';
+};
+
+assert.throws(Test262Error, fn, '1: try Abrupt, catch Abrupt, finally Abrupt; Completion: finally');
+assert.sameValue(count.catch, 1, '1: catch count');
+assert.sameValue(count.finally, 1, '1: finally count');
+
+// 2: try Abrupt, catch Return, finally Abrupt; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ throw new Test262Error('finally'); // If F.[[Type]] is normal, set F to C.
+ }
+ return 'wat';
+};
+
+assert.throws(Test262Error, fn, '2: try Abrupt, catch Return, finally Abrupt; Completion: finally');
+assert.sameValue(count.catch, 1, '2: catch count');
+assert.sameValue(count.finally, 1, '2: fiinally count');
+
+// 3: try Return, catch Return, finally Abrupt; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ return 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ throw new Test262Error('finally'); // If F.[[Type]] is normal, set F to C.
+ }
+ return 'wat';
+};
+
+assert.throws(Test262Error, fn, '3: try Normal, catch Normal, finally Abrupt; Completion: finally');
+assert.sameValue(count.catch, 0, '3: catch count');
+assert.sameValue(count.finally, 1, '3: fiinally count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/completion-values-fn-finally-normal.js b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-normal.js
new file mode 100644
index 0000000000..f341a0ff32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-normal.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2020 Salesforce.com. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: >
+ Returns the correct completion values of try-catch-finally(Normal) in functions
+info: |
+ TryStatement : try Block Catch Finally
+
+ Let B be the result of evaluating Block.
+ If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with argument B.[[Value]].
+ Else, let C be B.
+ Let F be the result of evaluating Finally.
+ If F.[[Type]] is normal, set F to C.
+ Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// 1: try Return, catch Return, finally Normal; Completion: try
+var count = {
+ catch: 0,
+ finally: 0
+};
+
+var fn = function() {
+ try {
+ return 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ 'normal';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'try', '1: try Return, catch Return, finally Normal; Completion: try');
+assert.sameValue(count.catch, 0, '1');
+assert.sameValue(count.finally, 1, '1');
+
+// 2: try Abrupt, catch Return, finally Normal; Completion: catch
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ 'finally';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'catch', '2: try Abrupt, catch Return, finally Normal; Completion: catch');
+assert.sameValue(count.catch, 1, '2: catch count');
+assert.sameValue(count.finally, 1, '2: fiinally count');
+
+// 3: try Abrupt, catch Abrupt, finally Normal; Completion: catch
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ throw new Test262Error('catch');
+ } finally {
+ count.finally += 1;
+ 'finally';
+ }
+ return 'wat';
+};
+
+assert.throws(Test262Error, fn, '3: try Abrupt, catch Abrupt, finally Normal; Completion: catch');
+assert.sameValue(count.catch, 1, '3: catch count');
+assert.sameValue(count.finally, 1, '3: fiinally count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/completion-values-fn-finally-return.js b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-return.js
new file mode 100644
index 0000000000..2c80bbff1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/completion-values-fn-finally-return.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2020 Salesforce.com. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: >
+ Returns the correct completion values of try-catch-finally(Return) in functions
+info: |
+ TryStatement : try Block Catch Finally
+
+ Let B be the result of evaluating Block.
+ If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with argument B.[[Value]].
+ Else, let C be B.
+ Let F be the result of evaluating Finally.
+ If F.[[Type]] is normal, set F to C.
+ Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// 1: try Return, catch Return, finally Return; Completion: finally
+var count = {
+ catch: 0,
+ finally: 0
+};
+
+var fn = function() {
+ try {
+ return 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ return 'finally';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'finally', '1: try Return, catch Return, finally Return; Completion: finally');
+assert.sameValue(count.catch, 0, '1');
+assert.sameValue(count.finally, 1, '1');
+
+// 2: try Abrupt, catch Return, finally Return; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ return 'catch';
+ } finally {
+ count.finally += 1;
+ return 'finally';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'finally', '2: try Abrupt, catch Return, finally Return; Completion: finally');
+assert.sameValue(count.catch, 1, '2: catch count');
+assert.sameValue(count.finally, 1, '2: fiinally count');
+
+// 3: try Abrupt, catch Abrupt, finally Normal; Completion: finally
+count.catch = 0;
+count.finally = 0;
+fn = function() {
+ try {
+ throw 'try';
+ } catch(e) {
+ count.catch += 1;
+ throw 'catch';
+ } finally {
+ count.finally += 1;
+ return 'finally';
+ }
+ return 'wat';
+};
+
+assert.sameValue(fn(), 'finally', fn, '3: try Abrupt, catch Abrupt, finally Normal; Completion: finally');
+assert.sameValue(count.catch, 1, '3: catch count');
+assert.sameValue(count.finally, 1, '3: fiinally count');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/completion-values.js b/js/src/tests/test262/language/statements/try/completion-values.js
new file mode 100644
index 0000000000..2959b82189
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/completion-values.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: >
+ Direct eval try/catch/finally for completion value
+info: |
+ TryStatement : try Block Catch Finally
+
+ Let B be the result of evaluating Block.
+ If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with argument B.[[Value]].
+ Else, let C be B.
+ Let F be the result of evaluating Finally.
+ If F.[[Type]] is normal, set F to C.
+ Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; break; -2 }; } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { 42; break; -3 }; } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { break; -2 }; } while (false);'),
+ undefined
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { break; -3 }; } while (false);'),
+ undefined
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; break; -3 }; -77 } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { 42; break; -3 }; -77 } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { break; -3 }; -77 } while (false);'),
+ undefined
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { break; -3 }; -77 } while (false);'),
+ undefined
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; continue; -3 }; } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { 42; continue; -3 }; } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; continue; -3 }; -77 } while (false);'),
+ 42
+);
+assert.sameValue(
+ eval('99; do { -99; try { [].x.x } catch (e) { -1 } finally { 42; continue; -3 }; -77 } while (false);'),
+ 42
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch-empty-break.js b/js/src/tests/test262/language/statements/try/cptn-catch-empty-break.js
new file mode 100644
index 0000000000..6023c27da7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch-empty-break.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from catch block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Catch
+ ...
+ 2. If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with parameter B.[[Value]].
+ ...
+ 4. Return Completion(UpdateEmpty(C, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try { throw null; } catch (e) { break; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch-empty-continue.js b/js/src/tests/test262/language/statements/try/cptn-catch-empty-continue.js
new file mode 100644
index 0000000000..74c60141f7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch-empty-continue.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from catch block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Catch
+ ...
+ 2. If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with parameter B.[[Value]].
+ ...
+ 4. Return Completion(UpdateEmpty(C, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try { throw null; } catch (e) { continue; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-break.js b/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-break.js
new file mode 100644
index 0000000000..b666c9435d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-break.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from finally block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Catch Finally
+ ...
+ 4. Let F be the result of evaluating Finally.
+ ...
+ 6. Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try { throw null; } catch (e) {} finally { break; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-continue.js b/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-continue.js
new file mode 100644
index 0000000000..e4b4856ee7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch-finally-empty-continue.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from finally block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Catch Finally
+ ...
+ 4. Let F be the result of evaluating Finally.
+ ...
+ 6. Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try { throw null; } catch (e) {} finally { continue; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-catch.js b/js/src/tests/test262/language/statements/try/cptn-catch.js
new file mode 100644
index 0000000000..464e8942b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-catch.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: Completion value from `catch` clause of a try..catch statement
+info: |
+ TryStatement : try Block Catch
+
+ 1. Let B be the result of evaluating Block.
+ 2. If B.[[type]] is throw, then
+ a. Let C be CatchClauseEvaluation of Catch with parameter B.[[value]].
+ 3. Else B.[[type]] is not throw,
+ [...]
+ 4. If C.[[type]] is return, or C.[[type]] is throw, return Completion(C).
+ 5. If C.[[value]] is not empty, return Completion(C).
+ 6. Return Completion{[[type]]: C.[[type]], [[value]]: undefined,
+ [[target]]: C.[[target]]}.
+
+ 13.15.7 Runtime Semantics: CatchClauseEvaluation
+
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 7. Let B be the result of evaluating Block.
+ 8. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 9. Return Completion(B).
+---*/
+
+assert.sameValue(eval('1; try { throw null; } catch (err) { }'), undefined);
+assert.sameValue(eval('2; try { throw null; } catch (err) { 3; }'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-empty-break.js b/js/src/tests/test262/language/statements/try/cptn-finally-empty-break.js
new file mode 100644
index 0000000000..ce20a53a84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-empty-break.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from finally block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Finally
+ ...
+ 2. Let F be the result of evaluating Finally.
+ ...
+ 4. Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try {} finally { break; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-empty-continue.js b/js/src/tests/test262/language/statements/try/cptn-finally-empty-continue.js
new file mode 100644
index 0000000000..8a1e408116
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-empty-continue.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-runtime-semantics-evaluation
+description: Abrupt completion from finally block calls UpdatEmpty()
+info: |
+ 13.15.8 Runtime Semantics: Evaluation
+ TryStatement : try Block Finally
+ ...
+ 2. Let F be the result of evaluating Finally.
+ ...
+ 4. Return Completion(UpdateEmpty(F, undefined)).
+---*/
+
+// Ensure the completion value from the first iteration ('bad completion') is not returned.
+var completion = eval("for (var i = 0; i < 2; ++i) { if (i) { try {} finally { continue; } } 'bad completion'; }");
+assert.sameValue(completion, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-from-catch.js b/js/src/tests/test262/language/statements/try/cptn-finally-from-catch.js
new file mode 100644
index 0000000000..ef997301b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-from-catch.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: >
+ Completion value from `finally` clause of a try..catch..finally statement
+ (following execution of `catch` block)
+info: |
+ TryStatement : try Block Catch Finally
+
+ 1. Let B be the result of evaluating Block.
+ 2. If B.[[type]] is throw, then
+ a. Let C be CatchClauseEvaluation of Catch with parameter B.[[value]].
+ [...]
+ 4. Let F be the result of evaluating Finally.
+ 5. If F.[[type]] is normal, let F be C.
+ 6. If F.[[type]] is return, or F.[[type]] is throw, return Completion(F).
+ 7. If F.[[value]] is not empty, return NormalCompletion(F.[[value]]).
+ 8. Return Completion{[[type]]: F.[[type]], [[value]]: undefined,
+ [[target]]: F.[[target]]}.
+
+ 13.15.7 Runtime Semantics: CatchClauseEvaluation
+
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 7. Let B be the result of evaluating Block.
+ 8. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 9. Return Completion(B).
+---*/
+
+assert.sameValue(
+ eval('1; try { throw null; } catch (err) { } finally { }'), undefined
+);
+assert.sameValue(
+ eval('2; try { throw null; } catch (err) { 3; } finally { }'), 3
+);
+assert.sameValue(
+ eval('4; try { throw null; } catch (err) { } finally { 5; }'), undefined
+);
+assert.sameValue(
+ eval('6; try { throw null; } catch (err) { 7; } finally { 8; }'), 7
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-skip-catch.js b/js/src/tests/test262/language/statements/try/cptn-finally-skip-catch.js
new file mode 100644
index 0000000000..3fac6eaa32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-skip-catch.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: >
+ Completion value from `finally` clause of a try..catch..finally statement
+ (when `catch` block is not executed)
+info: |
+ TryStatement : try Block Catch Finally
+
+ 1. Let B be the result of evaluating Block.
+ 2. If B.[[type]] is throw, then
+ [...]
+ 3. Else B.[[type]] is not throw, let C be B.
+ 4. Let F be the result of evaluating Finally.
+ 5. If F.[[type]] is normal, let F be C.
+ 6. If F.[[type]] is return, or F.[[type]] is throw, return Completion(F).
+ 7. If F.[[value]] is not empty, return NormalCompletion(F.[[value]]).
+ 8. Return Completion{[[type]]: F.[[type]], [[value]]: undefined,
+ [[target]]: F.[[target]]}.
+---*/
+
+assert.sameValue(eval('1; try { } catch (err) { } finally { }'), undefined);
+assert.sameValue(eval('2; try { } catch (err) { 3; } finally { }'), undefined);
+assert.sameValue(eval('4; try { } catch (err) { } finally { 5; }'), undefined);
+assert.sameValue(eval('6; try { } catch (err) { 7; } finally { 8; }'), undefined);
+assert.sameValue(eval('9; try { 10; } catch (err) { } finally { }'), 10);
+assert.sameValue(eval('11; try { 12; } catch (err) { 13; } finally { }'), 12);
+assert.sameValue(eval('14; try { 15; } catch (err) { } finally { 16; }'), 15);
+assert.sameValue(eval('17; try { 18; } catch (err) { 19; } finally { 20; }'), 18);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-finally-wo-catch.js b/js/src/tests/test262/language/statements/try/cptn-finally-wo-catch.js
new file mode 100644
index 0000000000..3cf191337a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-finally-wo-catch.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: Completion value from `finally` clause of a try..finally statement
+info: |
+ TryStatement : try Block Finally
+
+ 1. Let B be the result of evaluating Block.
+ 2. Let F be the result of evaluating Finally.
+ 3. If F.[[type]] is normal, let F be B.
+ 4. If F.[[type]] is return, or F.[[type]] is throw, return Completion(F).
+ 5. If F.[[value]] is not empty, return Completion(F).
+ 6. Return Completion{[[type]]: F.[[type]], [[value]]: undefined,
+ [[target]]: F.[[target]]}.
+---*/
+
+
+assert.sameValue(eval('1; try { } finally { }'), undefined);
+assert.sameValue(eval('2; try { 3; } finally { }'), 3);
+assert.sameValue(eval('4; try { } finally { 5; }'), undefined);
+assert.sameValue(eval('6; try { 7; } finally { 8; }'), 7);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/cptn-try.js b/js/src/tests/test262/language/statements/try/cptn-try.js
new file mode 100644
index 0000000000..50b5ac4828
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/cptn-try.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.15.8
+description: Completion value from `try` clause of a try..catch statement
+info: |
+ TryStatement : try Block Catch
+
+ 1. Let B be the result of evaluating Block.
+ 2. If B.[[type]] is throw, then
+ [...]
+ 3. Else B.[[type]] is not throw,
+ a. Let C be B.
+ 4. If C.[[type]] is return, or C.[[type]] is throw, return Completion(C).
+ 5. If C.[[value]] is not empty, return Completion(C).
+ 6. Return Completion{[[type]]: C.[[type]], [[value]]: undefined,
+ [[target]]: C.[[target]]}.
+---*/
+
+assert.sameValue(eval('1; try { } catch (err) { }'), undefined);
+assert.sameValue(eval('2; try { 3; } catch (err) { }'), 3);
+assert.sameValue(eval('4; try { } catch (err) { 5; }'), undefined);
+assert.sameValue(eval('6; try { 7; } catch (err) { 8; }'), 7);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-close.js
new file mode 100644
index 0000000000..d41ab2cdac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-close.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw iter;
+} catch ([x]) {
+ assert.sameValue(doneCallCount, 1);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..f01ceecb54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Abrupt completion returned by GetIterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ try {
+ throw [1, 2, 3];
+ } catch ([x, y, z]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err.js
new file mode 100644
index 0000000000..015d7ce02d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-get-err.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Abrupt completion returned by GetIterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-no-close.js
new file mode 100644
index 0000000000..df581d9257
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-init-iter-no-close.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw iter;
+} catch ([x]) {
+ assert.sameValue(doneCallCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/statements/try/dstr/ary-name-iter-val.js
new file mode 100644
index 0000000000..230c622325
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-name-iter-val.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding with normal value iteration (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..7efdc12521
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..5c19e09ec1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [[7, 8, 9]];
+} catch ([[x, y, z] = [4, 5, 6]]) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, 8);
+ assert.sameValue(z, 9);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..d351df4dc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([[,] = g()]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..1d7f26c237
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [[]];
+} catch ([[,] = g()]) {
+ assert.sameValue(callCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..088fb1a245
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([[] = function() { initCount += 1; return iter; }()]) {
+ assert.sameValue(initCount, 1);
+ assert.sameValue(iterCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..cd1142a4ab
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [[23]];
+} catch ([[] = function() { initCount += 1; }()]) {
+ assert.sameValue(initCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..48aac25420
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([[...x] = 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);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..d33a10a266
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [values];
+} catch ([[...x] = function() { initCount += 1; }()]) {
+ 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);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..0e6088e9ec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Nested array destructuring with a null value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw [null];
+ } catch ([[x]]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..34684ab78b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer with an exhausted iterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([x = 23]) {
+ assert.sameValue(x, 23);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..99a386d1fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,43 @@
+// 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/try.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([arrow = () => {}]) {
+ assert.sameValue(arrow.name, 'arrow');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..6f54b97552
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,45 @@
+// 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/try.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..6eee0b0d32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,44 @@
+// 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/try.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([cover = (function () {}), xCover = (0, function() {})]) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..9a0f13ea57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,44 @@
+// 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/try.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([fn = function () {}, xFn = function x() {}]) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..78de727bfc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,45 @@
+// 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/try.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([gen = function* () {}, xGen = function* x() {}]) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..643280c006
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer with a "hole" (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [,];
+} catch ([x = 23]) {
+ assert.sameValue(x, 23);
+ // another statement
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..6893e38431
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [null, 0, false, ''];
+} catch ([w = counter(), x = counter(), y = counter(), z = counter()]) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..081ab2d6d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Destructuring initializer returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ try {
+ throw [undefined];
+ } catch ([x = (function() { throw new Test262Error(); })()]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..1deb600a64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer with an undefined value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [undefined];
+} catch ([x = 23]) {
+ assert.sameValue(x, 23);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..88352786b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Destructuring initializer is an unresolvable reference (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ try {
+ throw [];
+ } catch ([ x = unresolvableReference ]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..418607b613
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding when value iteration completes (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([x]) {
+ assert.sameValue(x, undefined);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..41eb272e1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([_, x]) {
+ assert.sameValue(x, undefined);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..2d71680d83
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ try {
+ throw g;
+ } catch ([x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..c9479ccf14
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 42);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..6ce13a0da7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,54 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ try {
+ throw g;
+ } catch ([x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..8b1848d36e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([x, y, z]) {
+ assert.sameValue(x, 1);
+ assert.sameValue(y, 2);
+ assert.sameValue(z, 3);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..094218a510
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 44);
+ assert.sameValue(y, 55);
+ assert.sameValue(z, 66);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..fd578d90a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-id.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [{ x: 11, y: 22, z: 33 }];
+} catch ([{ x, y, z } = { x: 44, y: 55, z: 66 }]) {
+ assert.sameValue(x, 11);
+ assert.sameValue(y, 22);
+ assert.sameValue(z, 33);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..8ff30194e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [];
+} catch ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..2d87609e0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [{ u: 777, w: 888, y: 999 }];
+} catch ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) {
+ 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;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..a31061b40a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Nested object destructuring with a null value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw [null];
+ } catch ([{ x }]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..cb201ef7a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Nested object destructuring with a value of `undefined` (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw [];
+ } catch ([{ x }]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..548c23271b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-exhausted.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Elision accepts exhausted iterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw iter;
+} catch ([,]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..61b2b4a2fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision-step-err.js
@@ -0,0 +1,50 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([,]) {}
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision.js
new file mode 100644
index 0000000000..9d4a12470e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-elision.js
@@ -0,0 +1,57 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Elision advances iterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw g();
+} catch ([,]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-empty.js
new file mode 100644
index 0000000000..21ffbd3fd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-empty.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/try.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var ranCatch = false;
+
+try {
+ throw iter;
+} catch ([]) {
+ assert.sameValue(iterations, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..fbba3cbe50
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an array BindingElementList pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [3, 4, 5];
+} catch ([...[x, y, z]]) {
+ assert.sameValue(x, 3);
+ assert.sameValue(y, 4);
+ assert.sameValue(z, 5);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..7f7162bc84
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an elision (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw g();
+} catch ([...[,]]) {
+ assert.sameValue(first, 1);
+ assert.sameValue(second, 1);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..c193f1b75c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an "empty" array pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw iter;
+} catch ([...[]]) {
+ assert.sameValue(iterations, 1);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..c7516b95bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing a rest element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw values;
+} catch ([...[...x]]) {
+ 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);
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..af9ad6c4f6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-direct.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Lone rest element (direct binding) (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var ranCatch = false;
+
+try {
+ throw [1];
+} catch ([...x]) {
+ assert(Array.isArray(x));
+ assert.compareArray(x, [1]);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..21f0a58f66
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Rest element following elision elements (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([, ...x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..be5b0791a4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-elision.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element following elision elements (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw values;
+} catch ([ , , ...x]) {
+ 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);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..5bf9eef652
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/try.template
+/*---
+description: RestElement applied to an exhausted iterator (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [1, 2];
+} catch ([, , ...x]) {
+ assert(Array.isArray(x));
+ assert.sameValue(x.length, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..2bbd1c296d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([...x]) {}
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..dca33915de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ try {
+ throw iter;
+ } catch ([...x]) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..bf01791203
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-id.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Lone rest element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw values;
+} catch ([...x]) {
+ 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);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..dd1b187d98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-ary.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([...[ x ] = []]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..c61b65927f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-id.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (identifier) does not support initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([...x = []]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..cea566a275
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-init-obj.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [];
+} catch ([...{ x } = []]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..a056a5472f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([...[x], y]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..54763c08e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (identifier) may not be followed by any element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([...x, y]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..179a4cfbd7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,38 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([...{ x }, y]) {
+
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..bc04d33472
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-id.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an object binding pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw [1, 2, 3];
+} catch ([...{ length }]) {
+ assert.sameValue(length, 3);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..6e2d42230a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest element containing an object binding pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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.
+ [...]
+---*/
+let length = "outer";
+
+var ranCatch = false;
+
+try {
+ throw [7, 8, 9];
+} catch ([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) {
+ assert.sameValue(v, 7);
+ assert.sameValue(w, 8);
+ assert.sameValue(x, 9);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 3);
+
+ assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/browser.js b/js/src/tests/test262/language/statements/try/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-init-null.js b/js/src/tests/test262/language/statements/try/dstr/obj-init-null.js
new file mode 100644
index 0000000000..291971cbd0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-init-null.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw null;
+ } catch ({}) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-init-undefined.js b/js/src/tests/test262/language/statements/try/dstr/obj-init-undefined.js
new file mode 100644
index 0000000000..6eec2d6a48
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-init-undefined.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw undefined;
+ } catch ({}) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-empty.js
new file mode 100644
index 0000000000..549b80531b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-empty.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/try.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var ranCatch = false;
+
+try {
+ throw obj;
+} catch ({}) {
+ assert.sameValue(accessCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..a3b7d820f5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-get-value-err.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ try {
+ throw poisonedProperty;
+ } catch ({ poisoned }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..cfc6fbee3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw {};
+} catch ({ arrow = () => {} }) {
+ assert.sameValue(arrow.name, 'arrow');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..ea50c490a5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw {};
+} catch ({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) {
+ assert.sameValue(cls.name, 'cls');
+ assert.notSameValue(xCls.name, 'xCls');
+ assert.notSameValue(xCls2.name, 'xCls2');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..51fe56bc2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw {};
+} catch ({ cover = (function () {}), xCover = (0, function() {}) }) {
+ assert.sameValue(cover.name, 'cover');
+ assert.notSameValue(xCover.name, 'xCover');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..a80ed00fb0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw {};
+} catch ({ fn = function () {}, xFn = function x() {} }) {
+ assert.sameValue(fn.name, 'fn');
+ assert.notSameValue(xFn.name, 'xFn');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..97103ccdb4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/try.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw {};
+} catch ({ gen = function* () {}, xGen = function* x() {} }) {
+ assert.sameValue(gen.name, 'gen');
+ assert.notSameValue(xGen.name, 'xGen');
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..e4282b7dcf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-skipped.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw { w: null, x: 0, y: false, z: '' };
+} catch ({ w = counter(), x = counter(), y = counter(), z = counter() }) {
+ assert.sameValue(w, null);
+ assert.sameValue(x, 0);
+ assert.sameValue(y, false);
+ assert.sameValue(z, '');
+ assert.sameValue(initCount, 0);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..11930c89eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-throws.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error thrown when evaluating the initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ try {
+ throw {};
+ } catch ({ x = thrower() }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..b078767f64
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Destructuring initializer is an unresolvable reference (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ try {
+ throw {};
+ } catch ({ x = unresolvableReference }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..b8ab86d372
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { x: 23 };
+} catch ({ x, }) {
+ assert.sameValue(x, 23);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-list-err.js
new file mode 100644
index 0000000000..560b49bc04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-list-err.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ try {
+ throw {};
+ } catch ({ a, b = thrower(), c = ++initCount }) {}
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..988cec6e7f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-init.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw {};
+} catch ({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..4407d98762
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { x: [45] };
+} catch ({ x: [y], }) {
+ assert.sameValue(y,45);
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..6161491155
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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.
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw { w: null };
+ } catch ({ w: [x, y, z] = [4, 5, 6] }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..0d2d737803
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-ary.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw { w: [7, undefined, ] };
+} catch ({ w: [x, y, z] = [4, 5, 6] }) {
+ assert.sameValue(x, 7);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, undefined);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..714a3e2343
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-eval-err.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Evaluation of property name returns an abrupt completion (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ try {
+ throw {};
+ } catch ({ [thrower()]: x }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..c02a9aaa45
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ try {
+ throw poisonedProperty;
+ } catch ({ poisoned: x = ++initEvalCount }) {}
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..93a7e09e5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw { s: null, u: 0, w: false, y: '' };
+} catch ({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) {
+ 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;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..dfa4fd11c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Error thrown when evaluating the initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ try {
+ throw {};
+ } catch ({ x: y = thrower() }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..6edb704086
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Destructuring initializer is an unresolvable reference (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ try {
+ throw {};
+ } catch ({ x: y = unresolvableReference }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..c4e9d47964
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-init.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { };
+} catch ({ x: y = 33 }) {
+ assert.sameValue(y, 33);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..6d64a66c42
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { x: 23 };
+} catch ({ x: y, }) {
+ assert.sameValue(y, 23);
+
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..827f3a3699
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-id.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Binding as specified via property name and identifier (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var ranCatch = false;
+
+try {
+ throw { x: 23 };
+} catch ({ x: y }) {
+ assert.sameValue(y, 23);
+ assert.throws(ReferenceError, function() {
+ x;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..4730f557ae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-init.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw { w: undefined };
+} catch ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, 4);
+ assert.sameValue(y, 5);
+ assert.sameValue(z, 6);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..2bc8fd29d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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.
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw { w: null };
+ } catch ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..5e368068f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/try.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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.
+---*/
+
+assert.throws(TypeError, function() {
+ try {
+ throw { };
+ } catch ({ w: { x, y, z } = undefined }) {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..538a5a8137
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-prop-obj.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv 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 ranCatch = false;
+
+try {
+ throw { w: { x: undefined, z: 7 } };
+} catch ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {
+ assert.sameValue(x, undefined);
+ assert.sameValue(y, undefined);
+ assert.sameValue(z, 7);
+
+ assert.throws(ReferenceError, function() {
+ w;
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..1ea2ac5a86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-getter.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+---*/
+var count = 0;
+
+var ranCatch = false;
+
+try {
+ throw { get v() { count++; return 2; } };
+} catch ({...x}) {
+ assert.sameValue(count, 1);
+
+ verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..c9fd0c7f96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var ranCatch = false;
+
+try {
+ throw o;
+} catch ({...rest}) {
+ assert.sameValue(rest.x, undefined);
+
+ verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+ });
+
+ verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..c5390b4a2c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/obj-ptrn-rest-val-obj.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/try.template
+/*---
+description: Rest object contains just unextracted data (try statement)
+esid: sec-runtime-semantics-catchclauseevaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ Catch : catch ( CatchParameter ) Block
+
+ [...]
+ 5. Let status be the result of performing BindingInitialization for
+ CatchParameter passing thrownValue and catchEnv as arguments.
+ [...]
+---*/
+
+var ranCatch = false;
+
+try {
+ throw {x: 1, y: 2, a: 5, b: 3};
+} catch ({a, b, ...rest}) {
+ assert.sameValue(rest.a, undefined);
+ assert.sameValue(rest.b, undefined);
+
+ verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+ });
+
+ verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+ });
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/dstr/shell.js b/js/src/tests/test262/language/statements/try/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/try/early-catch-duplicates.js b/js/src/tests/test262/language/statements/try/early-catch-duplicates.js
new file mode 100644
index 0000000000..0a89fa78ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/early-catch-duplicates.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-try-statement-static-semantics-early-errors
+es6id: 13.15.1
+description: >
+ It is a Syntax Error if BoundNames of CatchParameter contains any duplicate
+ elements.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch ([x, x]) {}
diff --git a/js/src/tests/test262/language/statements/try/early-catch-function.js b/js/src/tests/test262/language/statements/try/early-catch-function.js
new file mode 100644
index 0000000000..30e53c80b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/early-catch-function.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-try-statement-static-semantics-early-errors
+description: >
+ Redeclaration of CatchParameter with directly nested FunctionDeclaration in function context.
+info: |
+ 13.15.1 Static Semantics: Early Errors
+
+ It is a Syntax Error if any element of the BoundNames of CatchParameter also
+ occurs in the LexicallyDeclaredNames of Block.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ try {
+ } catch (e) {
+ function e(){}
+ }
+}
diff --git a/js/src/tests/test262/language/statements/try/early-catch-lex.js b/js/src/tests/test262/language/statements/try/early-catch-lex.js
new file mode 100644
index 0000000000..1ba4a3c6b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/early-catch-lex.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-try-statement-static-semantics-early-errors
+es6id: 13.15.1
+description: >
+ It is a Syntax Error if any element of the BoundNames of CatchParameter
+ also occurs in the LexicallyDeclaredNames of Block.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [let]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (x) { let x; }
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding-finally.js b/js/src/tests/test262/language/statements/try/optional-catch-binding-finally.js
new file mode 100644
index 0000000000..9d0dbb43fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding-finally.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: try/catch/finally syntax with omission of the catch binding
+features: [optional-catch-binding]
+info: |
+ Optional Catch Binding
+
+ Catch[Yield, Await, Return]:
+ (...)
+ catch Block[?Yield, ?Await, ?Return]
+---*/
+
+try {} catch {} finally {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding-lexical.js b/js/src/tests/test262/language/statements/try/optional-catch-binding-lexical.js
new file mode 100644
index 0000000000..a9d9f55ae5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding-lexical.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: lexical environment runtime semantics for optional catch binding
+features: [optional-catch-binding]
+info: |
+ Runtime Semantics: CatchClauseEvaluation
+
+ Catch : catch Block
+ Let oldEnv be the running execution context's LexicalEnvironment.
+ Let catchEnv be NewDeclarativeEnvironment(oldEnv).
+ Set the running execution context's LexicalEnvironment to catchEnv.
+ (...)
+ Set the running execution context's LexicalEnvironment to oldEnv.
+ Return Completion(B).
+---*/
+
+let x = 1;
+let ranCatch = false;
+
+try {
+ x = 2;
+ throw new Error();
+} catch {
+ let x = 3;
+ let y = true;
+ ranCatch = true;
+}
+
+assert(ranCatch, 'executed `catch` block');
+assert.sameValue(x, 2);
+
+assert.throws(ReferenceError, function() {
+ y;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding-parens.js b/js/src/tests/test262/language/statements/try/optional-catch-binding-parens.js
new file mode 100644
index 0000000000..75ad4bf1fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding-parens.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: >
+ It is a SyntaxError to have a try/catch statement with an empty CatchParameter
+features: [optional-catch-binding]
+info: |
+ Catch[Yield, Await, Return]:
+ catch ( CatchParameter[?Yield, ?Await] ) Block[?Yield, ?Await, ?Return]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+try {} catch () {}
+
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding-throws.js b/js/src/tests/test262/language/statements/try/optional-catch-binding-throws.js
new file mode 100644
index 0000000000..f9e5976c4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding-throws.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: errors can be thrown from catch clause without binding
+features: [optional-catch-binding]
+info: |
+ Runtime Semantics: CatchClauseEvaluation
+
+ Catch : catch Block
+ (...)
+ Let B be the result of evaluating Block.
+ (...)
+ Return Completion(B).
+---*/
+
+assert.throws(Test262Error, function() {
+ try {
+ throw new Error();
+ } catch {
+ throw new Test262Error();
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/optional-catch-binding.js b/js/src/tests/test262/language/statements/try/optional-catch-binding.js
new file mode 100644
index 0000000000..d405f720d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/optional-catch-binding.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Lucas Azzola. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Lucas Azzola
+esid: pending
+description: try/catch syntax with omission of the catch binding
+features: [optional-catch-binding]
+info: |
+ Optional Catch Binding
+
+ Catch[Yield, Await, Return]:
+ (...)
+ catch Block[?Yield, ?Await, ?Return]
+---*/
+
+try {} catch {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-block-lex-close.js b/js/src/tests/test262/language/statements/try/scope-catch-block-lex-close.js
new file mode 100644
index 0000000000..b106e19733
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-block-lex-close.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Removal of lexical environment for `catch` block
+info: |
+ [...]
+ 8. Let B be the result of evaluating Block.
+ [...]
+features: [let]
+---*/
+
+var probe, x;
+
+try {
+ throw null;
+} catch (_) {
+ let x = 'inside';
+ probe = function() { return x; };
+}
+x = 'outside';
+
+assert.sameValue(x, 'outside');
+assert.sameValue(probe(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-block-lex-open.js b/js/src/tests/test262/language/statements/try/scope-catch-block-lex-open.js
new file mode 100644
index 0000000000..576833a663
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-block-lex-open.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Creation of new lexical environment for `catch` block
+info: |
+ [...]
+ 8. Let B be the result of evaluating Block.
+ [...]
+features: [let]
+---*/
+
+var probeParam, probeBlock;
+let x = 'outside';
+
+try {
+ throw [];
+} catch ([_ = probeParam = function() { return x; }]) {
+ probeBlock = function() { return x; };
+ let x = 'inside';
+}
+
+assert.sameValue(probeParam(), 'outside');
+assert.sameValue(probeBlock(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-block-var-none.js b/js/src/tests/test262/language/statements/try/scope-catch-block-var-none.js
new file mode 100644
index 0000000000..1a2f6017bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-block-var-none.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Retainment of existing variable environment for `catch` block
+info: |
+ [...]
+ 8. Let B be the result of evaluating Block.
+ [...]
+---*/
+
+var x = 1;
+var probeBefore = function() { return x; };
+var probeInside;
+
+try {
+ throw null;
+} catch (_) {
+ var x = 2;
+ probeInside = function() { return x; };
+}
+
+assert.sameValue(probeBefore(), 2, 'reference preceding statement');
+assert.sameValue(probeInside(), 2, 'reference within statement');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-param-lex-close.js b/js/src/tests/test262/language/statements/try/scope-catch-param-lex-close.js
new file mode 100644
index 0000000000..c7023236df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-param-lex-close.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Removal of lexical environment for `catch` parameter
+---*/
+
+var probe, x;
+
+try {
+ throw 'inside';
+} catch (x) {
+ probe = function() { return x; };
+}
+x = 'outside';
+
+assert.sameValue(x, 'outside');
+assert.sameValue(probe(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-param-lex-open.js b/js/src/tests/test262/language/statements/try/scope-catch-param-lex-open.js
new file mode 100644
index 0000000000..aefc3603a6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-param-lex-open.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Creation of new lexical environment for `catch` parameter
+---*/
+
+var probeBefore = function() { return x; };
+var probeTry, probeParam;
+var x = 'outside';
+
+try {
+ probeTry = function() { return x; };
+
+ throw ['inside'];
+} catch ([x, _ = probeParam = function() { return x; }]) {}
+
+assert.sameValue(probeBefore(), 'outside');
+assert.sameValue(probeTry(), 'outside');
+assert.sameValue(probeParam(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/scope-catch-param-var-none.js b/js/src/tests/test262/language/statements/try/scope-catch-param-var-none.js
new file mode 100644
index 0000000000..ef674c8d1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/scope-catch-param-var-none.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-runtime-semantics-catchclauseevaluation
+description: Retainment of existing variable environment for `catch` parameter
+flags: [noStrict]
+---*/
+
+var x = 1;
+var probeBefore = function() { return x; };
+var probeTry, probeParam, probeBlock;
+
+try {
+ var x = 2;
+ probeTry = function() { return x; };
+ throw [];
+} catch ([_ = (eval('var x = 3;'), probeParam = function() { return x; })]) {
+ var x = 4;
+ probeBlock = function() { return x; };
+}
+
+assert.sameValue(probeBefore(), 4, 'reference preceding statement');
+assert.sameValue(probeTry(), 4, 'reference from `try` block');
+assert.sameValue(probeParam(), 4, 'reference within CatchParameter');
+assert.sameValue(probeBlock(), 4, 'reference from `catch` block');
+assert.sameValue(x, 4, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/shell.js b/js/src/tests/test262/language/statements/try/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/try/static-init-await-binding-invalid.js b/js/src/tests/test262/language/statements/try/static-init-await-binding-invalid.js
new file mode 100644
index 0000000000..49e4dc764b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/static-init-await-binding-invalid.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: BindingIdentifier may not be `await` within class static blocks
+info: |
+ BindingIdentifier : Identifier
+
+ [...]
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ try {} catch (await) {}
+ }
+}
diff --git a/js/src/tests/test262/language/statements/try/static-init-await-binding-valid.js b/js/src/tests/test262/language/statements/try/static-init-await-binding-valid.js
new file mode 100644
index 0000000000..a16094d374
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/static-init-await-binding-valid.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The `await` keyword is interpreted as an identifier within arrow function bodies
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ [...]
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+features: [class-static-block]
+---*/
+
+class C {
+ static {
+ (() => { try {} catch (await) {} });
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/tco-catch-finally-strict.js b/js/src/tests/test262/language/statements/try/tco-catch-finally-strict.js
new file mode 100644
index 0000000000..3366875c07
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/tco-catch-finally-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ try { } catch (err) { } finally {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/tco-catch-strict.js b/js/src/tests/test262/language/statements/try/tco-catch-strict.js
new file mode 100644
index 0000000000..63523c0f8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/tco-catch-strict.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ try {
+ throw null;
+ } catch (err) {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/try/tco-finally-strict.js b/js/src/tests/test262/language/statements/try/tco-finally-strict.js
new file mode 100644
index 0000000000..125d808f71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/try/tco-finally-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ try { } finally {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-10-s.js b/js/src/tests/test262/language/statements/variable/12.2.1-10-s.js
new file mode 100644
index 0000000000..54d933fcbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-10-s.js
@@ -0,0 +1,12 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-10-s
+description: "Strict Mode: an indirect eval assigning into 'eval' does not throw"
+---*/
+
+ var s = eval;
+ s('eval = 42;');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-11.js b/js/src/tests/test262/language/statements/variable/12.2.1-11.js
new file mode 100644
index 0000000000..854980d2b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-11.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-11
+description: arguments as var identifier in eval code is allowed
+flags: [noStrict]
+---*/
+
+function testcase() {
+ eval("var arguments;");
+ }
+testcase();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-16-s.js b/js/src/tests/test262/language/statements/variable/12.2.1-16-s.js
new file mode 100644
index 0000000000..1b75fdb127
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-16-s.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-16-s
+description: >
+ A Function constructor (called as a function) declaring a var
+ named 'arguments' does not throw a SyntaxError
+---*/
+
+ Function('var arguments;');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-17-s-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-17-s-strict.js
new file mode 100644
index 0000000000..edaf94bdd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-17-s-strict.js
@@ -0,0 +1,17 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-17-s
+description: >
+ A Function constructor (called as a function) assigning into
+ 'arguments' will not throw any error if contained within strict
+ mode and its body does not start with strict mode
+flags: [onlyStrict]
+---*/
+
+ var f = Function('arguments = 42;');
+ f();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-18-s-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-18-s-strict.js
new file mode 100644
index 0000000000..4334110e71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-18-s-strict.js
@@ -0,0 +1,18 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-18-s
+description: >
+ A direct eval declaring a var named 'arguments' throws SyntaxError
+ in strict mode
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval('var arguments;');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-19-s-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-19-s-strict.js
new file mode 100644
index 0000000000..4706b20390
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-19-s-strict.js
@@ -0,0 +1,18 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-19-s
+description: >
+ A direct eval assigning into 'arguments' throws SyntaxError in
+ strict mode
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval('arguments = 42;');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-1gs-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-1gs-strict.js
new file mode 100644
index 0000000000..fff81efffc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-1gs-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-1gs
+description: >
+ Strict Mode - SyntaxError is thrown if a VariableDeclaration
+ occurs within strict code and its Identifier is eval
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+for (var eval in arrObj) { }
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-2-s-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-2-s-strict.js
new file mode 100644
index 0000000000..7f6f843434
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-2-s-strict.js
@@ -0,0 +1,18 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-2-s
+description: >
+ eval - a function assigning into 'eval' throws SyntaxError in
+ strict mode
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval('function foo() { eval = 42; }; foo()');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-20-s.js b/js/src/tests/test262/language/statements/variable/12.2.1-20-s.js
new file mode 100644
index 0000000000..4e1e663afb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-20-s.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-20-s
+description: >
+ Strict Mode: an indirect eval declaring a var named 'arguments'
+ does not throw
+---*/
+
+ var s = eval;
+ s('var arguments;');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-21-s.js b/js/src/tests/test262/language/statements/variable/12.2.1-21-s.js
new file mode 100644
index 0000000000..db5f1411ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-21-s.js
@@ -0,0 +1,14 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-21-s
+description: >
+ Strict Mode: an indirect eval assigning into 'arguments' does not
+ throw
+---*/
+
+ var s = eval;
+ s('arguments = 42;');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-22-s.js b/js/src/tests/test262/language/statements/variable/12.2.1-22-s.js
new file mode 100644
index 0000000000..13b0d1863c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-22-s.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-22-s
+description: >
+ arguments as global var identifier throws SyntaxError in strict
+ mode
+---*/
+
+ var indirectEval = eval;
+assert.throws(SyntaxError, function() {
+ indirectEval("'use strict'; var arguments;");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-3-s-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-3-s-strict.js
new file mode 100644
index 0000000000..190e43d150
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-3-s-strict.js
@@ -0,0 +1,18 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-3-s
+description: >
+ eval - a function expr declaring a var named 'eval' throws
+ SyntaxError in strict mode
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval('(function () { var eval; })');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-4-s-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-4-s-strict.js
new file mode 100644
index 0000000000..bd27ca01f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-4-s-strict.js
@@ -0,0 +1,18 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-4-s
+description: >
+ eval - a function expr assigning into 'eval' throws a SyntaxError
+ in strict mode
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval('(function () { eval = 42; })()');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-4gs-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-4gs-strict.js
new file mode 100644
index 0000000000..ce102473c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-4gs-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-4gs
+description: >
+ Strict Mode - SyntaxError is thrown if a VariableDeclarationNoIn
+ occurs within strict code and its Identifier is arguments
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+var arguments;
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-5-s.js b/js/src/tests/test262/language/statements/variable/12.2.1-5-s.js
new file mode 100644
index 0000000000..385e85d2fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-5-s.js
@@ -0,0 +1,12 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-5-s
+description: >
+ a Function declaring var named 'eval' does not throw SyntaxError
+---*/
+
+ Function('var eval;');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-6-s-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-6-s-strict.js
new file mode 100644
index 0000000000..03dfd7037b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-6-s-strict.js
@@ -0,0 +1,17 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-6-s
+description: >
+ eval - a Function assigning into 'eval' will not throw any error
+ if contained within strict mode and its body does not start with
+ strict mode
+flags: [onlyStrict]
+---*/
+
+ var f = Function('eval = 42;');
+ f();
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-7-s-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-7-s-strict.js
new file mode 100644
index 0000000000..9fd17ec4d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-7-s-strict.js
@@ -0,0 +1,18 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-7-s
+description: >
+ eval - a direct eval declaring a var named 'eval' throws
+ SyntaxError in strict mode
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval('var eval;');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-8-s-strict.js b/js/src/tests/test262/language/statements/variable/12.2.1-8-s-strict.js
new file mode 100644
index 0000000000..1bd90d77dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-8-s-strict.js
@@ -0,0 +1,18 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-8-s
+description: >
+ eval - a direct eval assigning into 'eval' throws SyntaxError in
+ strict mode
+flags: [onlyStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval('eval = 42;');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/12.2.1-9-s.js b/js/src/tests/test262/language/statements/variable/12.2.1-9-s.js
new file mode 100644
index 0000000000..d055dfb118
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/12.2.1-9-s.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-9-s
+description: >
+ an indirect eval declaring a var named 'eval' does not throw
+---*/
+
+ var s = eval;
+ s('var eval;');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A1.js b/js/src/tests/test262/language/statements/variable/S12.2_A1.js
new file mode 100644
index 0000000000..42c92a7ead
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A1.js
@@ -0,0 +1,51 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Variables are created when the program is entered. Variables are initialised to "undefined"
+ when created. A variable with an Initialiser is assigned the value of its AssignmentExpression when the
+ VariableStatement is executed, not when the variable is created
+es5id: 12.2_A1
+description: Creating variables after entering the execution scope
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ __x = __x;
+ __y = __x ? "good fellow" : "liar"; // __y assigned to "liar" since __x undefined
+ __z = __z === __x ? 1 : 0; // __z assigned to 1 since both __x and __z are undefined
+} catch (e) {
+ throw new Test262Error('#1: Using declarated variable before it declaration is admitted');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+assert.throws(ReferenceError, function() {
+ __something__undefined = __something__undefined;
+});
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if ((__y !== "liar")&(__z !== 1)) {
+ throw new Test262Error('#3: (__y === "liar") and (__z === 1). Actual: __y ==='+__y+' and __z ==='+__z );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __x, __y = true, __z = __y ? "smeagol" : "golum";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (!__y&!(__z = "smeagol")) {
+ throw new Test262Error('#4: A variable with an Initialiser is assigned the value of its AssignmentExpression when the VariableStatement is executed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A10.js b/js/src/tests/test262/language/statements/variable/S12.2_A10.js
new file mode 100644
index 0000000000..a3545227ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A10.js
@@ -0,0 +1,24 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"var\" statement within \"for\" statement is allowed"
+es5id: 12.2_A10
+description: Declaring variable within a "for" IterationStatement
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ __ind=__ind;
+} catch (e) {
+ throw new Test262Error('#1: var inside "for" is admitted '+e.message);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+for (var __ind;;){
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A11.js b/js/src/tests/test262/language/statements/variable/S12.2_A11.js
new file mode 100644
index 0000000000..430e588523
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A11.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: When using property attributes, {ReadOnly} is not used
+es5id: 12.2_A11
+description: Changing variable value using property attributes
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+this['__declared__var'] = "baloon";
+if (this['__declared__var'] !== "baloon") {
+ throw new Test262Error('#1: this[\'__declared__var\'] === "baloon". Actual: this[\'__declared__var\'] ==='+ this['__declared__var'] );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__declared__var !== "baloon") {
+ throw new Test262Error('#2: __declared__var === "baloon". Actual: __declared__var ==='+ __declared__var );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __declared__var;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A12.js b/js/src/tests/test262/language/statements/variable/S12.2_A12.js
new file mode 100644
index 0000000000..7c4357d3bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A12.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: VariableDeclaration within "do-while" loop is allowed
+es5id: 12.2_A12
+description: Declaring variable within "do-while" statement
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ x=x;
+} catch (e) {
+ throw new Test262Error('#1: Declaration variable inside "do-while" statement is admitted');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+do var x; while (false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A2.js b/js/src/tests/test262/language/statements/variable/S12.2_A2.js
new file mode 100644
index 0000000000..be9496eba0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A2.js
@@ -0,0 +1,52 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Variables are defined with global scope (that is, they are created as
+ members of the global object, as described in 10.1.3) using property
+ attributes { DontDelete}
+es5id: 12.2_A2
+description: >
+ Checking if deleting global variables that have the attributes
+ {DontDelete} fails
+flags: [noStrict]
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (delete(__variable)) {
+ throw new Test262Error('#1: delete(__variable)===false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (delete(this["__variable"])) {
+ throw new Test262Error('#2: delete(this["__variable"])===false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+var __variable;
+var __variable = "defined";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (delete(__variable) | delete(this["__variable"])) {
+ throw new Test262Error('#3: (delete(__variable) | delete(this["__variable"]))===false' );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if ((__variable !== "defined")|(this["__variable"] !=="defined")) {
+ throw new Test262Error('#4: __variable === "defined" and this["__variable"] ==="defined"');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A3.js b/js/src/tests/test262/language/statements/variable/S12.2_A3.js
new file mode 100644
index 0000000000..d60312ae65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A3.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionDeclaration produces a new scope
+es5id: 12.2_A3
+description: Using Global scope and Function scope together
+---*/
+
+var __var = "OUT";
+
+(function(){
+ var __var ="IN";
+ (function(){__var = "INNER_SPACE";})();
+ (function(){var __var = "INNER_SUN";})();
+ //////////////////////////////////////////////////////////////////////////////
+ //CHECK#1
+ if (__var !== "INNER_SPACE") {
+ throw new Test262Error('#1: __var === "INNER_SPACE". Actual: __var ==='+ __var );
+ }
+ //
+ //////////////////////////////////////////////////////////////////////////////
+})();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__var !== "OUT") {
+ throw new Test262Error('#2: __var === "OUT". Actual: __var ==='+ __var );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+(function(){
+ __var ="IN";
+ (function(){__var = "INNERED"})();
+ (function(){var __var = "INNAGER"})();
+ //////////////////////////////////////////////////////////////////////////////
+ //CHECK#3
+ if (__var!=="INNERED") {
+ throw new Test262Error('#3: __var==="INNERED". Actual: __var==='+ __var );
+ }
+ //
+ //////////////////////////////////////////////////////////////////////////////
+})();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (__var!=="INNERED") {
+ throw new Test262Error('#4: __var==="INNERED". Actual: __var==='+ __var );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A4.js b/js/src/tests/test262/language/statements/variable/S12.2_A4.js
new file mode 100644
index 0000000000..e77f51d29f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A4.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Unicode characters in variable Identifier are allowed
+es5id: 12.2_A4
+description: Create and use unicode characters in variable Identifier
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ __var=__var;
+} catch (e) {
+ throw new Test262Error('#1: Unicode characters in variable Identifier allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var \u005f\u005f\u0076\u0061\u0072 = 1;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__var !== 1) {
+ throw new Test262Error('#2: __var === 1. Actual: __var ==='+ __var );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A5.js b/js/src/tests/test262/language/statements/variable/S12.2_A5.js
new file mode 100644
index 0000000000..0c1c374efb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A5.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ VariableDeclaration within Eval statement is initialized as the program
+ reaches the eval statement
+es5id: 12.2_A5
+description: Executing eval("var x")
+flags: [noStrict]
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+assert.throws(ReferenceError, function() {
+ x=x;
+});
+//
+//////////////////////////////////////////////////////////////////////////////
+
+eval("var x");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try{
+ x=x;
+}catch(e){
+ throw new Test262Error('#2: VariableDeclaration inside Eval statement is initialized when program reaches the eval statement '+e.message);
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A6_T1.js b/js/src/tests/test262/language/statements/variable/S12.2_A6_T1.js
new file mode 100644
index 0000000000..6daa61bb21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A6_T1.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: VariableDeclaration within "try-catch" statement is allowed
+es5id: 12.2_A6_T1
+description: Declaring variable within "try-catch" statement
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ intry__var=intry__var;
+}catch(e){
+ throw new Test262Error('#1: Variable declaration inside "try" block is admitted');
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+try{
+ incatch__var=incatch__var;
+}catch(e){
+ throw new Test262Error('#2: Variable declaration inside "catch" block is admitted');
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+try{
+ var intry__var;
+}catch(e){
+ var incatch__var;
+};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A6_T2.js b/js/src/tests/test262/language/statements/variable/S12.2_A6_T2.js
new file mode 100644
index 0000000000..563ce40c32
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A6_T2.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: VariableDeclaration within "try-catch" statement is allowed
+es5id: 12.2_A6_T2
+description: Declaring variables within "try-catch" statement
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ intry__intry__var=intry__intry__var;
+ intry__incatch__var=intry__incatch__var;
+ incatch__intry__var=incatch__intry__var;
+ incatch__incatch__var=incatch__incatch__var;
+}catch(e){
+ throw new Test262Error('#1: Variable declaration inside "try-catch" block is admitted');
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+try{
+ try {
+ var intry__intry__var;
+ } catch (e) {
+ var intry__incatch__var;
+ }
+}catch(e){
+ try {
+ var incatch__intry__var;
+ } catch (e) {
+ var incatch__incatch__var;
+ }
+
+};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A7.js b/js/src/tests/test262/language/statements/variable/S12.2_A7.js
new file mode 100644
index 0000000000..6e58224dd6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A7.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: VariableDeclaration within "for" statement is allowed
+es5id: 12.2_A7
+description: Declaring variable within "for" statement
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+ infor_var = infor_var;
+}catch(e){
+ throw new Test262Error('#1: Variable declaration inside "for" loop is admitted');
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+for (;;){
+ break;
+ var infor_var;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A8_T1.js b/js/src/tests/test262/language/statements/variable/S12.2_A8_T1.js
new file mode 100644
index 0000000000..569fd0b3b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A8_T1.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only AssignmentExpression is admitted when variable is initialized
+es5id: 12.2_A8_T1
+description: Checking if execution of "var x += 1" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x += 1;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A8_T2.js b/js/src/tests/test262/language/statements/variable/S12.2_A8_T2.js
new file mode 100644
index 0000000000..7fbb78a499
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A8_T2.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only AssignmentExpression is admitted when variable is initialized
+es5id: 12.2_A8_T2
+description: Checking if execution of "var x | true" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x | true;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A8_T3.js b/js/src/tests/test262/language/statements/variable/S12.2_A8_T3.js
new file mode 100644
index 0000000000..c0502a0959
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A8_T3.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only AssignmentExpression is admitted when variable is initialized
+es5id: 12.2_A8_T3
+description: Checking if execution of "var x && 1" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x && 1;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A8_T4.js b/js/src/tests/test262/language/statements/variable/S12.2_A8_T4.js
new file mode 100644
index 0000000000..e2712ad4c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A8_T4.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only AssignmentExpression is admitted when variable is initialized
+es5id: 12.2_A8_T4
+description: Checking if execution of "var x++" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x++;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A8_T5.js b/js/src/tests/test262/language/statements/variable/S12.2_A8_T5.js
new file mode 100644
index 0000000000..1c641b49e3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A8_T5.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only AssignmentExpression is admitted when variable is initialized
+es5id: 12.2_A8_T5
+description: Checking if execution of "var --x" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var --x;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A8_T6.js b/js/src/tests/test262/language/statements/variable/S12.2_A8_T6.js
new file mode 100644
index 0000000000..c45cbe2dc0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A8_T6.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only AssignmentExpression is admitted when variable is initialized
+es5id: 12.2_A8_T6
+description: Checking if execution of "var x*1" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x*1;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A8_T7.js b/js/src/tests/test262/language/statements/variable/S12.2_A8_T7.js
new file mode 100644
index 0000000000..46d51448c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A8_T7.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only AssignmentExpression is admitted when variable is initialized
+es5id: 12.2_A8_T7
+description: Checking if execution of "var x>>1" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x>>1;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A8_T8.js b/js/src/tests/test262/language/statements/variable/S12.2_A8_T8.js
new file mode 100644
index 0000000000..f83d7bc49a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A8_T8.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Only AssignmentExpression is admitted when variable is initialized
+es5id: 12.2_A8_T8
+description: Checking if execution of "var x in __arr" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+__arr = [];
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x in __arr;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/variable/S12.2_A9.js b/js/src/tests/test262/language/statements/variable/S12.2_A9.js
new file mode 100644
index 0000000000..ff67277bc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S12.2_A9.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: When using property attributes, {DontEnum} is not used
+es5id: 12.2_A9
+description: >
+ Enumerating property attributes of "this" and then searching for
+ the declared variable
+---*/
+
+var enumed;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for (var __prop in this){
+ if (__prop === "__declared__var")
+ enumed=true;
+}
+if (!(enumed)) {
+ throw new Test262Error('#1: When using property attributes, {DontEnum} not used');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __declared__var;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/S14_A1.js b/js/src/tests/test262/language/statements/variable/S14_A1.js
new file mode 100644
index 0000000000..0e1c7c67de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/S14_A1.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression must be localed in a reacheable fragment of the program
+es5id: 14_A1
+description: Declaring a function within an "if" Expression
+---*/
+
+var THERE = "I'm there";
+var HERE = "I'm here";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ( __func !== undefined) {
+ throw new Test262Error('#1: __func === undefined. Actual: __func ==='+ __func );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+if (true){
+ var __func = function(){return HERE;};
+} else {
+ var __func = function (){return THERE;};
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__func() !== HERE) {
+ throw new Test262Error('#2: __func() === HERE. Actual: __func() ==='+ __func() );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-non-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-non-strict.js
new file mode 100644
index 0000000000..0b4f69396a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-non-strict.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-12
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier is allowed within a function declaration
+flags: [noStrict]
+---*/
+
+function f() {
+ var arguments;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-final-init-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-final-init-strict.js
new file mode 100644
index 0000000000..85c424a3ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-final-init-strict.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-28-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier assigned to throws SyntaxError
+ in strict mode within a function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ var a, arguments = 42;
+}
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-final-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-final-strict.js
new file mode 100644
index 0000000000..673f75871b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-final-strict.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-30-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier throws SyntaxError in strict mode within a
+ function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ var a = 42, arguments;
+}
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-first-init-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-first-init-strict.js
new file mode 100644
index 0000000000..4edda98e1a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-first-init-strict.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier throws SyntaxError in strict mode within a
+ function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ var arguments = 42, a;
+}
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-first-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-first-strict.js
new file mode 100644
index 0000000000..92eaa10feb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-first-strict.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-25-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier throws SyntaxError in strict mode within a
+ function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ var arguments, a;
+}
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-middle-init-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-middle-init-strict.js
new file mode 100644
index 0000000000..2145140e71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-middle-init-strict.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier throws SyntaxError in strict mode within a
+ function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ var a, arguments = 42, b;
+}
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-middle-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-middle-strict.js
new file mode 100644
index 0000000000..8304db3dca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-middle-strict.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-33-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier throws SyntaxError in strict mode within a
+ function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ var a, arguments, b;
+}
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-repeated-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-repeated-strict.js
new file mode 100644
index 0000000000..9120c2cb89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-list-repeated-strict.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-32-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier defined twice and assigned once
+ throws SyntaxError in strict mode within a function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ var arguments, arguments = 42;
+}
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-strict-single-init-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-single-init-strict.js
new file mode 100644
index 0000000000..9876d1b3c9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-single-init-strict.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-23-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier assigned to throws SyntaxError
+ in strict mode within a function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ var arguments = 42;
+}
diff --git a/js/src/tests/test262/language/statements/variable/arguments-fn-strict-single-strict.js b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-single-strict.js
new file mode 100644
index 0000000000..7249d3898a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-fn-strict-single-strict.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-12-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier throws SyntaxError in strict mode within a
+ function declaration
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ var arguments;
+}
diff --git a/js/src/tests/test262/language/statements/variable/arguments-non-strict.js b/js/src/tests/test262/language/statements/variable/arguments-non-strict.js
new file mode 100644
index 0000000000..040ef95026
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-non-strict.js
@@ -0,0 +1,13 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-12
+esid: sec-variable-statement
+description: arguments as local var identifier is allowed
+flags: [noStrict]
+---*/
+
+var arguments;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/arguments-strict-list-final-init-strict.js b/js/src/tests/test262/language/statements/variable/arguments-strict-list-final-init-strict.js
new file mode 100644
index 0000000000..007685d2d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-strict-list-final-init-strict.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-28-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier assigned to throws SyntaxError
+ in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var a, arguments = 42;
diff --git a/js/src/tests/test262/language/statements/variable/arguments-strict-list-final-strict.js b/js/src/tests/test262/language/statements/variable/arguments-strict-list-final-strict.js
new file mode 100644
index 0000000000..d094fab1b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-strict-list-final-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-30-s
+esid: sec-variable-statement
+description: arguments as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var a = 42, arguments;
diff --git a/js/src/tests/test262/language/statements/variable/arguments-strict-list-first-init-strict.js b/js/src/tests/test262/language/statements/variable/arguments-strict-list-first-init-strict.js
new file mode 100644
index 0000000000..3f4901e41a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-strict-list-first-init-strict.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-variable-statement
+description: arguments as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arguments = 42, a;
diff --git a/js/src/tests/test262/language/statements/variable/arguments-strict-list-first-strict.js b/js/src/tests/test262/language/statements/variable/arguments-strict-list-first-strict.js
new file mode 100644
index 0000000000..e1c050e1e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-strict-list-first-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-25-s
+esid: sec-variable-statement
+description: arguments as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arguments, a;
diff --git a/js/src/tests/test262/language/statements/variable/arguments-strict-list-middle-init-strict.js b/js/src/tests/test262/language/statements/variable/arguments-strict-list-middle-init-strict.js
new file mode 100644
index 0000000000..ee3de5a5af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-strict-list-middle-init-strict.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-variable-statement
+description: arguments as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var a, arguments = 42, b;
diff --git a/js/src/tests/test262/language/statements/variable/arguments-strict-list-middle-strict.js b/js/src/tests/test262/language/statements/variable/arguments-strict-list-middle-strict.js
new file mode 100644
index 0000000000..c993698fdd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-strict-list-middle-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-33-s
+esid: sec-variable-statement
+description: arguments as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var a, arguments, b;
diff --git a/js/src/tests/test262/language/statements/variable/arguments-strict-list-repeated-strict.js b/js/src/tests/test262/language/statements/variable/arguments-strict-list-repeated-strict.js
new file mode 100644
index 0000000000..ca6f305efb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-strict-list-repeated-strict.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-32-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier defined twice and assigned once
+ throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arguments, arguments = 42;
diff --git a/js/src/tests/test262/language/statements/variable/arguments-strict-single-init-strict.js b/js/src/tests/test262/language/statements/variable/arguments-strict-single-init-strict.js
new file mode 100644
index 0000000000..a6b3d082bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-strict-single-init-strict.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-23-s
+esid: sec-variable-statement
+description: >
+ arguments as local var identifier assigned to throws SyntaxError
+ in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arguments = 42;
diff --git a/js/src/tests/test262/language/statements/variable/arguments-strict-single-strict.js b/js/src/tests/test262/language/statements/variable/arguments-strict-single-strict.js
new file mode 100644
index 0000000000..c7165638db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/arguments-strict-single-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-12-s
+esid: sec-variable-statement
+description: arguments as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var arguments;
diff --git a/js/src/tests/test262/language/statements/variable/binding-resolution.js b/js/src/tests/test262/language/statements/variable/binding-resolution.js
new file mode 100644
index 0000000000..ca201de00a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/binding-resolution.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-variable-statement-runtime-semantics-evaluation
+es6id: 13.3.2.4
+description: Binding is resolve prior to evaluation of Initializer
+info: |
+ VariableDeclaration : BindingIdentifier Initializer
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId).
+ 3. Let rhs be the result of evaluating Initializer.
+ [...]
+flags: [noStrict]
+---*/
+
+var obj = { test262id: 1 };
+
+with (obj) {
+ var test262id = delete obj.test262id;
+}
+
+assert.sameValue(obj.test262id, true);
+assert.sameValue(test262id, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/browser.js b/js/src/tests/test262/language/statements/variable/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/browser.js
diff --git a/js/src/tests/test262/language/statements/variable/cptn-value.js b/js/src/tests/test262/language/statements/variable/cptn-value.js
new file mode 100644
index 0000000000..89df566e72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/cptn-value.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-variable-statement-runtime-semantics-evaluation
+es6id: 13.3.2.4
+description: Returns an empty completion
+info: |
+ VariableStatement : var VariableDeclarationList ;
+
+ 1. Let next be the result of evaluating VariableDeclarationList.
+ 2. ReturnIfAbrupt(next).
+ 3. Return NormalCompletion(empty).
+---*/
+
+assert.sameValue(
+ eval('var test262id1;'), undefined, 'Single declaration without initializer'
+);
+assert.sameValue(
+ eval('var test262id2 = 2;'),
+ undefined,
+ 'Single declaration bearing initializer'
+);
+assert.sameValue(
+ eval('var test262id3 = 3, test262id4;'),
+ undefined,
+ 'Multiple declarations, final without initializer'
+);
+assert.sameValue(
+ eval('var test262id5, test262id6 = 6;'),
+ undefined,
+ 'Multiple declarations, final bearing initializer'
+);
+
+assert.sameValue(eval('7; var test262id8;'), 7);
+assert.sameValue(eval('9; var test262id10 = 10;'), 9);
+assert.sameValue(eval('11; var test262id12 = 12, test262id13;'), 11);
+assert.sameValue(eval('14; var test262id15, test262id16 = 16;'), 14);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-close.js
new file mode 100644
index 0000000000..cf9c4b2b06
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-close.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [x] = iter;
+
+assert.sameValue(doneCallCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..2c7460a7a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-get-err-array-prototype.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Abrupt completion returned by GetIterator (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iteratorRecord be ? GetIterator(value).
+
+ GetIterator ( obj [ , hint [ , method ] ] )
+
+ [...]
+ 4. Let iterator be ? Call(method, obj).
+
+ Call ( F, V [ , argumentsList ] )
+
+ [...]
+ 2. If IsCallable(F) is false, throw a TypeError exception.
+
+---*/
+delete Array.prototype[Symbol.iterator];
+
+assert.throws(TypeError, function() {
+ var [x, y, z] = [1, 2, 3];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-get-err.js
new file mode 100644
index 0000000000..1ec614b85b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-get-err.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-get-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Abrupt completion returned by GetIterator (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+
+---*/
+var iter = {};
+iter[Symbol.iterator] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ var [x] = iter;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-no-close.js
new file mode 100644
index 0000000000..9f6b250cac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-init-iter-no-close.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [x] = iter;
+
+assert.sameValue(doneCallCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/statements/variable/dstr/ary-name-iter-val.js
new file mode 100644
index 0000000000..f51338da5f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-name-iter-val.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: SingleNameBinding with normal value iteration (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [x, y, z] = [1, 2, 3];
+
+assert.sameValue(x, 1);
+assert.sameValue(y, 2);
+assert.sameValue(z, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..e81012a038
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [[x, y, z] = [4, 5, 6]] = [];
+
+assert.sameValue(x, 4);
+assert.sameValue(y, 5);
+assert.sameValue(z, 6);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..a60ce48e79
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [[x, y, z] = [4, 5, 6]] = [[7, 8, 9]];
+
+assert.sameValue(x, 7);
+assert.sameValue(y, 8);
+assert.sameValue(z, 9);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..0bffceb663
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [[,] = g()] = [];
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..22ea483fc2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [[,] = g()] = [[]];
+
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..cf21fbc8df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [[] = function() { initCount += 1; return iter; }()] = [];
+
+assert.sameValue(initCount, 1);
+assert.sameValue(iterCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..1e435ee936
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [[] = function() { initCount += 1; }()] = [[23]];
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..12ab532187
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [[...x] = 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..9fdc221cb6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,44 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [[...x] = function() { initCount += 1; }()] = [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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..c0962ac95d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-ary-val-null.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Nested array destructuring with a null value (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ArrayBindingPattern
+
+ 1. Let iterator be GetIterator(value).
+ 2. ReturnIfAbrupt(iterator).
+---*/
+
+assert.throws(TypeError, function() {
+ var [[x]] = [null];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..63848c4c36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [x = 23] = [];
+
+assert.sameValue(x, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..7f21576544
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,37 @@
+// 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/var-stmt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [arrow = () => {}] = [];
+
+assert.sameValue(arrow.name, 'arrow');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..c67cda8537
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,39 @@
+// 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/var-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = [];
+
+assert.sameValue(cls.name, 'cls');
+assert.notSameValue(xCls.name, 'xCls');
+assert.notSameValue(xCls2.name, 'xCls2');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..89af1c63e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,38 @@
+// 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/var-stmt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [cover = (function () {}), xCover = (0, function() {})] = [];
+
+assert.sameValue(cover.name, 'cover');
+assert.notSameValue(xCover.name, 'xCover');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..bdfd33ae9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,38 @@
+// 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/var-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [fn = function () {}, xFn = function x() {}] = [];
+
+assert.sameValue(fn.name, 'fn');
+assert.notSameValue(xFn.name, 'xFn');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..a8cda1b7c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,39 @@
+// 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/var-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [gen = function* () {}, xGen = function* x() {}] = [];
+
+assert.sameValue(gen.name, 'gen');
+assert.notSameValue(xGen.name, 'xGen');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..28f5879d11
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Destructuring initializer with a "hole" (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [x = 23] = [,];
+
+assert.sameValue(x, 23);
+// another statement
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..3203ba5cf4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,41 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, ''];
+
+assert.sameValue(w, null);
+assert.sameValue(x, 0);
+assert.sameValue(y, false);
+assert.sameValue(z, '');
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..46caa22350
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-throws.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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).
+---*/
+
+assert.throws(Test262Error, function() {
+ var [x = (function() { throw new Test262Error(); })()] = [undefined];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..2684c5c25e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Destructuring initializer with an undefined value (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [x = 23] = [undefined];
+
+assert.sameValue(x, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..7cceead4cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-init-unresolvable.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ var [ x = unresolvableReference ] = [];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..e25ae048fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: SingleNameBinding when value iteration completes (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [x] = [];
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..f85d3838ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [_, x] = [];
+
+assert.sameValue(x, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..1686e71f20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-step-err.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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).
+
+---*/
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ throw new Test262Error();
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ var [x] = g;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..9b90489faf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,55 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializer_opt
+
+ 1. Let bindingId be StringValue of BindingIdentifier.
+ 2. Let lhs be ? ResolveBinding(bindingId, environment).
+ 3. If iteratorRecord.[[Done]] is false, then
+ a. Let next be IteratorStep(iteratorRecord).
+ 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).
+ [...]
+ 7. Return InitializeReferencedBinding(lhs, v).
+
+---*/
+Array.prototype[Symbol.iterator] = function* () {
+ if (this.length > 0) {
+ yield this[0];
+ }
+ if (this.length > 1) {
+ yield this[1];
+ }
+ if (this.length > 2) {
+ yield 42;
+ }
+};
+
+var [x, y, z] = [1, 2, 3];
+
+assert.sameValue(x, 1);
+assert.sameValue(y, 2);
+assert.sameValue(z, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..1fa5565afb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val-err.js
@@ -0,0 +1,53 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var g = {};
+g[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ var [x] = g;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..d10c641887
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,45 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [x, y, z] = [1, 2, 3];
+
+assert.sameValue(x, 1);
+assert.sameValue(y, 2);
+assert.sameValue(z, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-invalid.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-invalid.js
new file mode 100644
index 0000000000..2362980f23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-invalid.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: BindingIdentifier may not be `await` within class static blocks
+info: |
+ BindingIdentifier : Identifier
+
+ [...]
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ var [await] = [];
+ }
+}
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-valid.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-valid.js
new file mode 100644
index 0000000000..05c40ef15a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-id-static-init-await-valid.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The `await` keyword is interpreted as an identifier within arrow function bodies
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ [...]
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+features: [class-static-block]
+---*/
+
+class C {
+ static {
+ (() => { var [await] = []; });
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..65a6ee4fcc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [{ x, y, z } = { x: 44, y: 55, z: 66 }] = [];
+
+assert.sameValue(x, 44);
+assert.sameValue(y, 55);
+assert.sameValue(z, 66);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..105f30859f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-id.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }];
+
+assert.sameValue(x, 11);
+assert.sameValue(y, 22);
+assert.sameValue(z, 33);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..087bbe1145
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [];
+
+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;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..8e8894f6fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ 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;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..bd61c18cf5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-val-null.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Nested object destructuring with a null value (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ var [{ x }] = [null];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..3adf77242e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elem-obj-val-undef.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. If iteratorRecord.[[done]] is false, then
+ [...]
+ e. Else
+ i. Let v be IteratorValue(next).
+ [...]
+ 4. Return the result of performing BindingInitialization of BindingPattern
+ with v and environment as the arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPattern : ObjectBindingPattern
+
+ 1. Let valid be RequireObjectCoercible(value).
+ 2. ReturnIfAbrupt(valid).
+---*/
+
+assert.throws(TypeError, function() {
+ var [{ x }] = [];
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..f4437dca24
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision-exhausted.js
@@ -0,0 +1,42 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Elision accepts exhausted iterator (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [,] = iter;
+
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..bef65b3a13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision-step-err.js
@@ -0,0 +1,49 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-step-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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).
+
+---*/
+var following = 0;
+var iter =function* () {
+ throw new Test262Error();
+ following += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ var [,] = iter;
+});
+
+iter.next();
+assert.sameValue(following, 0, 'Iterator was properly closed.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision.js
new file mode 100644
index 0000000000..886aaecabc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-elision.js
@@ -0,0 +1,51 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Elision advances iterator (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [,] = g();
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-empty.js
new file mode 100644
index 0000000000..be2d1e3025
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-empty.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+
+ ArrayBindingPattern : [ ]
+
+ 1. Return NormalCompletion(empty).
+
+---*/
+var iterations = 0;
+var iter = function*() {
+ iterations += 1;
+}();
+
+var [] = iter;
+
+assert.sameValue(iterations, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..cacb6f1b6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [...[x, y, z]] = [3, 4, 5];
+
+assert.sameValue(x, 3);
+assert.sameValue(y, 4);
+assert.sameValue(z, 5);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..1db09b4cfa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element containing an elision (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [...[,]] = g();
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..124aff3c68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,47 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element containing an "empty" array pattern (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [...[]] = iter;
+
+assert.sameValue(iterations, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..75dbabe464
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element containing a rest element (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [...[...x]] = 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);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..4ed7fcc21f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-direct.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Lone rest element (direct binding) (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Runtime Semantics: IteratorBindingInitialization
+
+ BindingRestElement : ... BindingIdentifier
+
+ [...]
+ 2. Let A be ! ArrayCreate(0).
+ 3. Let n be 0.
+ 4. Repeat,
+ [...]
+ f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
+ g. Set n to n + 1.
+
+---*/
+
+var [...x] = [1];
+
+assert(Array.isArray(x));
+assert.compareArray(x, [1]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..a0cfb5a60d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-elision-next-err.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Rest element following elision elements (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 iter = (function*() { throw new Test262Error(); })();
+
+assert.throws(Test262Error, function() {
+ var [, ...x] = iter;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..c862c524e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-elision.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element following elision elements (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [ , , ...x] = 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..574e98191f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: RestElement applied to an exhausted iterator (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [, , ...x] = [1, 2];
+
+assert(Array.isArray(x));
+assert.sameValue(x.length, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..a2ef82b2f2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-iter-step-err.js
@@ -0,0 +1,46 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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,
+ a. If iteratorRecord.[[done]] is false,
+ i. Let next be IteratorStep(iteratorRecord.[[iterator]]).
+ ii. If next is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ iii. ReturnIfAbrupt(next).
+
+---*/
+var first = 0;
+var second = 0;
+var iter = function*() {
+ first += 1;
+ throw new Test262Error();
+ second += 1;
+}();
+
+assert.throws(Test262Error, function() {
+ var [...x] = iter;
+});
+
+iter.next();
+assert.sameValue(first, 1);
+assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..bd0305efc1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id-iter-val-err.js
@@ -0,0 +1,48 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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,
+ [...]
+ c. Let nextValue be IteratorValue(next).
+ d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
+ true.
+ e. ReturnIfAbrupt(nextValue).
+
+---*/
+var poisonedValue = Object.defineProperty({}, 'value', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+var iter = {};
+iter[Symbol.iterator] = function() {
+ return {
+ next: function() {
+ return poisonedValue;
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ var [...x] = iter;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..f07bfa71dd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-id.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Lone rest element (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [...x] = 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..6ee1d80bf9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-ary.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var [...[ x ] = []] = [];
+
+
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..f768852992
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-id.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element (identifier) does not support initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var [...x = []] = [];
+
+
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..644192fab8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-init-obj.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var [...{ x } = []] = [];
+
+
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..6fea1f9691
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-ary.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var [...[x], y] = [1, 2, 3];
+
+
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..bb5d22cbf6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-id.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var [...x, y] = [1, 2, 3];
+
+
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..1e707c59ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-not-final-obj.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+ ArrayBindingPattern[Yield] :
+ [ Elisionopt BindingRestElement[?Yield]opt ]
+ [ BindingElementList[?Yield] ]
+ [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
+---*/
+$DONOTEVALUATE();
+
+var [...{ x }, y] = [1, 2, 3];
+
+
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..fb98d127db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-obj-id.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element containing an object binding pattern (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 [...{ length }] = [1, 2, 3];
+
+assert.sameValue(length, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..f166ee12c2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,43 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest element containing an object binding pattern (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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.
+ [...]
+---*/
+let length = "outer";
+
+var [...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9];
+
+assert.sameValue(v, 7);
+assert.sameValue(w, 8);
+assert.sameValue(x, 9);
+assert.sameValue(y, undefined);
+assert.sameValue(z, 3);
+
+assert.sameValue(length, "outer", "the length prop is not set as a binding name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/browser.js b/js/src/tests/test262/language/statements/variable/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/browser.js
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-init-null.js b/js/src/tests/test262/language/statements/variable/dstr/obj-init-null.js
new file mode 100644
index 0000000000..25807416d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-init-null.js
@@ -0,0 +1,29 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-null.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ var {} = null;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-init-undefined.js b/js/src/tests/test262/language/statements/variable/dstr/obj-init-undefined.js
new file mode 100644
index 0000000000..bbe2086fe2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-init-undefined.js
@@ -0,0 +1,29 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-init-undefined.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+
+assert.throws(TypeError, function() {
+ var {} = undefined;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-invalid.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-invalid.js
new file mode 100644
index 0000000000..0f2f432521
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-invalid.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: BindingIdentifier may not be `await` within class static blocks
+info: |
+ BindingIdentifier : Identifier
+
+ [...]
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ var {await} = {};
+ }
+}
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-valid.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-valid.js
new file mode 100644
index 0000000000..2e66d5e15c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-elem-id-static-init-await-valid.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The `await` keyword is interpreted as an identifier within arrow function bodies
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ [...]
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+features: [class-static-block]
+---*/
+
+class C {
+ static {
+ (() => { var {await} = {}; });
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-empty.js
new file mode 100644
index 0000000000..ab3b84007e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-empty.js
@@ -0,0 +1,35 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ Runtime Semantics: BindingInitialization
+
+ ObjectBindingPattern : { }
+
+ 1. Return NormalCompletion(empty).
+---*/
+var accessCount = 0;
+var obj = Object.defineProperty({}, 'attr', {
+ get: function() {
+ accessCount += 1;
+ }
+});
+
+var {} = obj;
+
+assert.sameValue(accessCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..aefb5610ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-get-value-err.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-get-value-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 4. Let v be GetV(value, propertyName).
+ 5. ReturnIfAbrupt(v).
+---*/
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ var { poisoned } = poisonedProperty;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..0eba33a0ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { arrow = () => {} } = {};
+
+assert.sameValue(arrow.name, 'arrow');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..f8ea6ddbbc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {};
+
+assert.sameValue(cls.name, 'cls');
+assert.notSameValue(xCls.name, 'xCls');
+assert.notSameValue(xCls2.name, 'xCls2');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..68ca9796cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { cover = (function () {}), xCover = (0, function() {}) } = {};
+
+assert.sameValue(cover.name, 'cover');
+assert.notSameValue(xCover.name, 'xCover');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..8d8f6947db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { fn = function () {}, xFn = function x() {} } = {};
+
+assert.sameValue(fn.name, 'fn');
+assert.notSameValue(xFn.name, 'xFn');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..30d95a4af9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { gen = function* () {}, xGen = function* x() {} } = {};
+
+assert.sameValue(gen.name, 'gen');
+assert.notSameValue(xGen.name, 'xGen');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..d1baeb3bdc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-skipped.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { w = counter(), x = counter(), y = counter(), z = counter() } = { 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);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..1e75ef8341
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-throws.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-throws.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Error thrown when evaluating the initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ var { x = thrower() } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..d54db87ace
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-init-unresolvable.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ var { x = unresolvableReference } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..ddac1252fd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var { x, } = { x: 23 };
+
+assert.sameValue(x, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-list-err.js
new file mode 100644
index 0000000000..921006037e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-list-err.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-list-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingPropertyList : BindingPropertyList , BindingProperty
+
+ 1. Let status be the result of performing BindingInitialization for
+ BindingPropertyList using value and environment as arguments.
+ 2. ReturnIfAbrupt(status).
+---*/
+var initCount = 0;
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ var { a, b = thrower(), c = ++initCount } = {};
+});
+
+assert.sameValue(initCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..b025997d29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-init.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { w: [x, y, z] = [4, 5, 6] } = {};
+
+assert.sameValue(x, 4);
+assert.sameValue(y, 5);
+assert.sameValue(z, 6);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..b4d3eaf82a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,30 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var { x: [y], } = { x: [45] };
+
+assert.sameValue(y,45);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..5168246598
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary-value-null.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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.
+---*/
+
+assert.throws(TypeError, function() {
+ var { w: [x, y, z] = [4, 5, 6] } = { w: null };
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..a23101d21e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-ary.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] };
+
+assert.sameValue(x, 7);
+assert.sameValue(y, undefined);
+assert.sameValue(z, undefined);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..3b6551747c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-eval-err.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-eval-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.5 Runtime Semantics: BindingInitialization
+
+ BindingProperty : PropertyName : BindingElement
+
+ 1. Let P be the result of evaluating PropertyName
+ 2. ReturnIfAbrupt(P).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ var { [thrower()]: x } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..911f8e11d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-get-value-err.js
@@ -0,0 +1,38 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ 1. Let v be GetV(value, propertyName).
+ 2. ReturnIfAbrupt(v).
+---*/
+var initEvalCount = 0;
+var poisonedProperty = Object.defineProperty({}, 'poisoned', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ var { poisoned: x = ++initEvalCount } = poisonedProperty;
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..8824ad0256
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,52 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { 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;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..71fadba268
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-throws.js
@@ -0,0 +1,36 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Error thrown when evaluating the initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+---*/
+function thrower() {
+ throw new Test262Error();
+}
+
+assert.throws(Test262Error, function() {
+ var { x: y = thrower() } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..a8af3edb85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init-unresolvable.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ BindingElement : BindingPattern Initializeropt
+
+ [...]
+ 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).
+
+ 6.2.3.1 GetValue (V)
+
+ 1. ReturnIfAbrupt(V).
+ 2. If Type(V) is not Reference, return V.
+ 3. Let base be GetBase(V).
+ 4. If IsUnresolvableReference(V), throw a ReferenceError exception.
+---*/
+
+assert.throws(ReferenceError, function() {
+ var { x: y = unresolvableReference } = {};
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..1b161593d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-init.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var { x: y = 33 } = { };
+
+assert.sameValue(y, 33);
+assert.throws(ReferenceError, function() {
+ x;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..dbf92f8fe9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,34 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3 Destructuring Binding Patterns
+
+ ObjectBindingPattern[Yield] :
+ { }
+ { BindingPropertyList[?Yield] }
+ { BindingPropertyList[?Yield] , }
+---*/
+
+var { x: y, } = { x: 23 };
+
+assert.sameValue(y, 23);
+
+assert.throws(ReferenceError, function() {
+ x;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..dc38848835
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-id.js
@@ -0,0 +1,33 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Binding as specified via property name and identifier (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+
+ 13.3.3.7 Runtime Semantics: KeyedBindingInitialization
+
+ SingleNameBinding : BindingIdentifier Initializeropt
+
+ [...]
+ 8. Return InitializeReferencedBinding(lhs, v).
+---*/
+
+var { x: y } = { x: 23 };
+
+assert.sameValue(y, 23);
+assert.throws(ReferenceError, function() {
+ x;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..8ce671f1ee
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-init.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined };
+
+assert.sameValue(x, 4);
+assert.sameValue(y, 5);
+assert.sameValue(z, 6);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..c3092c3865
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-value-null.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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.
+---*/
+
+assert.throws(TypeError, function() {
+ var { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null };
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..18fc35e28e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj-value-undef.js
@@ -0,0 +1,31 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case
+// - src/dstr-binding/error/var-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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.
+---*/
+
+assert.throws(TypeError, function() {
+ var { w: { x, y, z } = undefined } = { };
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..db807ea7e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-prop-obj.js
@@ -0,0 +1,37 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined 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 { w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } };
+
+assert.sameValue(x, undefined);
+assert.sameValue(y, undefined);
+assert.sameValue(z, 7);
+
+assert.throws(ReferenceError, function() {
+ w;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..2bb84a29b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-getter.js
@@ -0,0 +1,32 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+---*/
+var count = 0;
+
+var {...x} = { get v() { count++; return 2; } };
+
+assert.sameValue(count, 1);
+
+verifyProperty(x, "v", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..0a6c4cd5ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,40 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+---*/
+var o = {a: 3, b: 4};
+Object.defineProperty(o, "x", { value: 4, enumerable: false });
+
+var {...rest} = o;
+
+assert.sameValue(rest.x, undefined);
+
+verifyProperty(rest, "a", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 3
+});
+
+verifyProperty(rest, "b", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 4
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..32d5f0c7c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/obj-ptrn-rest-val-obj.js
@@ -0,0 +1,39 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/var-stmt.template
+/*---
+description: Rest object contains just unextracted data (`var` statement)
+esid: sec-variable-statement-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ VariableDeclaration : BindingPattern Initializer
+
+ 1. Let rhs be the result of evaluating Initializer.
+ 2. Let rval be GetValue(rhs).
+ 3. ReturnIfAbrupt(rval).
+ 4. Return the result of performing BindingInitialization for
+ BindingPattern passing rval and undefined as arguments.
+---*/
+
+var {a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3};
+
+assert.sameValue(rest.a, undefined);
+assert.sameValue(rest.b, undefined);
+
+verifyProperty(rest, "x", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 1
+});
+
+verifyProperty(rest, "y", {
+ enumerable: true,
+ writable: true,
+ configurable: true,
+ value: 2
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/dstr/shell.js b/js/src/tests/test262/language/statements/variable/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/dstr/shell.js
diff --git a/js/src/tests/test262/language/statements/variable/eval-non-strict.js b/js/src/tests/test262/language/statements/variable/eval-non-strict.js
new file mode 100644
index 0000000000..c3e99ebd70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-non-strict.js
@@ -0,0 +1,12 @@
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-variable-statement
+description: arguments as local var identifier is allowed
+flags: [noStrict]
+---*/
+
+var eval;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/eval-strict-list-final-init-strict.js b/js/src/tests/test262/language/statements/variable/eval-strict-list-final-init-strict.js
new file mode 100644
index 0000000000..9b503bab34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-strict-list-final-init-strict.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-variable-statement
+description: eval as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var a, eval = 42;
diff --git a/js/src/tests/test262/language/statements/variable/eval-strict-list-final-strict.js b/js/src/tests/test262/language/statements/variable/eval-strict-list-final-strict.js
new file mode 100644
index 0000000000..fc204f752c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-strict-list-final-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-26-s
+esid: sec-variable-statement
+description: eval as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var a, eval;
diff --git a/js/src/tests/test262/language/statements/variable/eval-strict-list-first-init-strict.js b/js/src/tests/test262/language/statements/variable/eval-strict-list-first-init-strict.js
new file mode 100644
index 0000000000..509d23641a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-strict-list-first-init-strict.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-27-s
+esid: sec-variable-statement
+description: >
+ eval as local var identifier assigned to throws SyntaxError in
+ strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var eval = 42, a;
diff --git a/js/src/tests/test262/language/statements/variable/eval-strict-list-first-strict.js b/js/src/tests/test262/language/statements/variable/eval-strict-list-first-strict.js
new file mode 100644
index 0000000000..1536764666
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-strict-list-first-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-29-s
+esid: sec-variable-statement
+description: eval as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var eval, a = 42;
diff --git a/js/src/tests/test262/language/statements/variable/eval-strict-list-middle-init-strict.js b/js/src/tests/test262/language/statements/variable/eval-strict-list-middle-init-strict.js
new file mode 100644
index 0000000000..e06213ec85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-strict-list-middle-init-strict.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-variable-statement
+description: arguments as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var a, eval = 42, b;
diff --git a/js/src/tests/test262/language/statements/variable/eval-strict-list-middle-strict.js b/js/src/tests/test262/language/statements/variable/eval-strict-list-middle-strict.js
new file mode 100644
index 0000000000..167771c72d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-strict-list-middle-strict.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2018 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-variable-statement
+description: arguments as local var identifier throws SyntaxError in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var a, eval, b;
diff --git a/js/src/tests/test262/language/statements/variable/eval-strict-list-repeated-strict.js b/js/src/tests/test262/language/statements/variable/eval-strict-list-repeated-strict.js
new file mode 100644
index 0000000000..fd344ee621
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-strict-list-repeated-strict.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-31-s
+esid: sec-variable-statement
+description: >
+ eval as local var identifier defined twice throws SyntaxError in
+ strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var eval, eval;
diff --git a/js/src/tests/test262/language/statements/variable/eval-strict-single-init-strict.js b/js/src/tests/test262/language/statements/variable/eval-strict-single-init-strict.js
new file mode 100644
index 0000000000..f39ce6c73d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-strict-single-init-strict.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-24-s
+esid: sec-variable-statement
+description: >
+ eval as local var identifier assigned to throws SyntaxError in
+ strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var eval = 42;
diff --git a/js/src/tests/test262/language/statements/variable/eval-strict-single-strict.js b/js/src/tests/test262/language/statements/variable/eval-strict-single-strict.js
new file mode 100644
index 0000000000..80cd179894
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/eval-strict-single-strict.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.2.1-1-s
+esid: sec-variable-statement
+description: >
+ eval - a function declaring a var named 'eval' throws SyntaxError
+ in strict mode
+flags: [onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var eval;
diff --git a/js/src/tests/test262/language/statements/variable/fn-name-arrow.js b/js/src/tests/test262/language/statements/variable/fn-name-arrow.js
new file mode 100644
index 0000000000..871c30ecec
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/fn-name-arrow.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.2.4
+description: Assignment of function `name` attribute (ArrowFunction)
+info: |
+ VariableDeclaration : BindingIdentifier Initializer
+
+ [...]
+ 7. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+---*/
+
+var arrow = () => {};
+
+assert.sameValue(arrow.name, 'arrow');
+verifyNotEnumerable(arrow, 'name');
+verifyNotWritable(arrow, 'name');
+verifyConfigurable(arrow, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/fn-name-class.js b/js/src/tests/test262/language/statements/variable/fn-name-class.js
new file mode 100644
index 0000000000..5b8086b264
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/fn-name-class.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.2.4
+description: Assignment of function `name` attribute (ClassExpression)
+info: |
+ VariableDeclaration : BindingIdentifier Initializer
+
+ [...]
+ 7. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+features: [class]
+---*/
+
+var xCls = class x {};
+var cls = class {};
+var xCls2 = class { static name() {} };
+
+assert.notSameValue(xCls.name, 'xCls');
+assert.notSameValue(xCls2.name, 'xCls2');
+
+assert.sameValue(cls.name, 'cls');
+verifyNotEnumerable(cls, 'name');
+verifyNotWritable(cls, 'name');
+verifyConfigurable(cls, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/fn-name-cover.js b/js/src/tests/test262/language/statements/variable/fn-name-cover.js
new file mode 100644
index 0000000000..a7751c981e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/fn-name-cover.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.2.4
+description: >
+ Assignment of function `name` attribute (CoverParenthesizedExpression)
+info: |
+ VariableDeclaration : BindingIdentifier Initializer
+
+ [...]
+ 7. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+---*/
+
+var xCover = (0, function() {});
+var cover = (function() {});
+
+assert(xCover.name !== 'xCover');
+
+assert.sameValue(cover.name, 'cover');
+verifyNotEnumerable(cover, 'name');
+verifyNotWritable(cover, 'name');
+verifyConfigurable(cover, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/fn-name-fn.js b/js/src/tests/test262/language/statements/variable/fn-name-fn.js
new file mode 100644
index 0000000000..06c0f4c0dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/fn-name-fn.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.2.4
+description: Assignment of function `name` attribute (FunctionExpression)
+info: |
+ VariableDeclaration : BindingIdentifier Initializer
+
+ [...]
+ 7. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+---*/
+
+var xFn = function x() {};
+var fn = function() {};
+
+assert(xFn.name !== 'xFn');
+
+assert.sameValue(fn.name, 'fn');
+verifyNotEnumerable(fn, 'name');
+verifyNotWritable(fn, 'name');
+verifyConfigurable(fn, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/fn-name-gen.js b/js/src/tests/test262/language/statements/variable/fn-name-gen.js
new file mode 100644
index 0000000000..dc3eba1c17
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/fn-name-gen.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 13.3.2.4
+description: Assignment of function `name` attribute (GeneratorExpression)
+info: |
+ VariableDeclaration : BindingIdentifier Initializer
+
+ [...]
+ 7. If IsAnonymousFunctionDefinition(Initializer) is true, then
+ a. Let hasNameProperty be HasOwnProperty(value, "name").
+ b. ReturnIfAbrupt(hasNameProperty).
+ c. If hasNameProperty is false, perform SetFunctionName(value,
+ bindingId).
+includes: [propertyHelper.js]
+features: [generators]
+---*/
+
+var xGen = function* x() {};
+var gen = function*() {};
+
+assert(xGen.name !== 'xGen');
+
+assert.sameValue(gen.name, 'gen');
+verifyNotEnumerable(gen, 'name');
+verifyNotWritable(gen, 'name');
+verifyConfigurable(gen, 'name');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/variable/id-arguments-strict-strict.js b/js/src/tests/test262/language/statements/variable/id-arguments-strict-strict.js
new file mode 100644
index 0000000000..961c69423c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/id-arguments-strict-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es5id: 11.13.1-4-28-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'arguments' appears
+ as the LeftHandSideExpression of simple assignment(=) under strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+var arguments;
diff --git a/js/src/tests/test262/language/statements/variable/id-eval-strict-strict.js b/js/src/tests/test262/language/statements/variable/id-eval-strict-strict.js
new file mode 100644
index 0000000000..01069c6963
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/id-eval-strict-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es5id: 11.13.1-4-28-s
+description: >
+ Strict Mode - SyntaxError is thrown if the identifier 'eval' appears as the
+ LeftHandSideExpression of simple assignment(=) under strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+var eval;
diff --git a/js/src/tests/test262/language/statements/variable/shell.js b/js/src/tests/test262/language/statements/variable/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/shell.js
diff --git a/js/src/tests/test262/language/statements/variable/static-init-await-binding-invalid.js b/js/src/tests/test262/language/statements/variable/static-init-await-binding-invalid.js
new file mode 100644
index 0000000000..25951f4372
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/static-init-await-binding-invalid.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: BindingIdentifier may not be `await` within class static blocks
+info: |
+ BindingIdentifier : Identifier
+
+ [...]
+ - It is a Syntax Error if the code matched by this production is nested,
+ directly or indirectly (but not crossing function or static initialization
+ block boundaries), within a ClassStaticBlock and the StringValue of
+ Identifier is "await".
+negative:
+ phase: parse
+ type: SyntaxError
+features: [class-static-block]
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ static {
+ var await;
+ }
+}
diff --git a/js/src/tests/test262/language/statements/variable/static-init-await-binding-valid.js b/js/src/tests/test262/language/statements/variable/static-init-await-binding-valid.js
new file mode 100644
index 0000000000..31835e0d9a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/variable/static-init-await-binding-valid.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+description: The `await` keyword is interpreted as an identifier within arrow function bodies
+info: |
+ ClassStaticBlockBody : ClassStaticBlockStatementList
+
+ [...]
+ - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true.
+features: [class-static-block]
+---*/
+
+class C {
+ static {
+ (() => { var await; });
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A1.js b/js/src/tests/test262/language/statements/while/S12.6.2_A1.js
new file mode 100644
index 0000000000..2400c75215
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A1.js
@@ -0,0 +1,65 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Expression from "while" IterationStatement is evaluated first; "false",
+ "0", "null", "undefined" and "empty" strings used as the Expression are
+ evaluated to "false"
+es5id: 12.6.2_A1
+description: Evaluating various Expressions
+---*/
+
+var __in__do;
+
+while ( false ) __in__do=1;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do !== undefined) {
+ throw new Test262Error('#1: false evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+while ( 0 ) __in__do=2;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__in__do !== undefined) {
+ throw new Test262Error('#2: 0 evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+while ( "" ) __in__do=3;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__in__do !== undefined) {
+ throw new Test262Error('#3: empty string evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+while ( null ) __in__do=4;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if (__in__do !== undefined) {
+ throw new Test262Error('#4: null evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+while ( undefined ) __in__do=35;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#5
+if (__in__do !== undefined) {
+ throw new Test262Error('#5: undefined evaluates to false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A10.js b/js/src/tests/test262/language/statements/while/S12.6.2_A10.js
new file mode 100644
index 0000000000..2f68c564e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A10.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ FunctionExpression within a "while" IterationStatement is allowed, but no
+ function with the given name will appear in the global context
+es5id: 12.6.2_A10
+description: Testing FunctionExpression too
+---*/
+
+var check=0;
+while(function f(){}){
+ if(typeof(f) === "function") {
+ check = -1;
+ break;
+ } else {
+ check = 1;
+ break;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (check !== 1) {
+ throw new Test262Error('#1: FunctionExpression inside while construction expression allowed but function not declare');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A11.js b/js/src/tests/test262/language/statements/while/S12.6.2_A11.js
new file mode 100644
index 0000000000..abd33a0511
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A11.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"{}\" Block within a \"while\" Expression is evaluated to true"
+es5id: 12.6.2_A11
+description: Checking if execution of "while({}){}" passes
+---*/
+
+while({}){
+ var __in__do=1;
+ if(__in__do)break;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do !== 1) {
+ throw new Test262Error('#1: "{}" in while expression evaluates to true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A14_T1.js b/js/src/tests/test262/language/statements/while/S12.6.2_A14_T1.js
new file mode 100644
index 0000000000..369d1ddf21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A14_T1.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression within a "while" Expression is allowed
+es5id: 12.6.2_A14_T1
+description: Using "function __func(){return 0;}" as an Expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+while(function __func(){return 0;}){
+ var __reached = 1;
+ break;
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__reached !== 1) {
+ throw new Test262Error('#2: function expression inside of while expression is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A14_T2.js b/js/src/tests/test262/language/statements/while/S12.6.2_A14_T2.js
new file mode 100644
index 0000000000..96c3befa0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A14_T2.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: FunctionExpression within a "while" Expression is allowed
+es5id: 12.6.2_A14_T2
+description: Using function call as an Expression
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+while(function __func(){return 1;}()){
+ var __reached = 1;
+ break;
+};
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__reached !== 1) {
+ throw new Test262Error('#2: function expression inside of while expression is allowed');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A15.js b/js/src/tests/test262/language/statements/while/S12.6.2_A15.js
new file mode 100644
index 0000000000..eede00a012
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A15.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Block within a "while" Expression is not allowed
+es5id: 12.6.2_A15
+description: Expression is "{0}"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+while({1}){
+ break ;
+};
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A2.js b/js/src/tests/test262/language/statements/while/S12.6.2_A2.js
new file mode 100644
index 0000000000..c33562daac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A2.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ While evaluating The production IterationStatement: "while ( Expression )
+ Statement", Expression is evaluated first
+es5id: 12.6.2_A2
+description: Evaluating Statement with error Expression
+---*/
+
+try {
+ while ((function(){throw 1})()) __in__while = "reached";
+ throw new Test262Error('#1: \'while ((function(){throw 1})()) __in__while = "reached"\' lead to throwing exception');
+} catch (e) {
+ if (e !== 1) {
+ throw new Test262Error('#1: Exception === 1. Actual: Exception ==='+e);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (typeof __in__while !== "undefined") {
+ throw new Test262Error('#1.1: typeof __in__while === "undefined". Actual: typeof __in__while ==='+typeof __in__while);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A3.js b/js/src/tests/test262/language/statements/while/S12.6.2_A3.js
new file mode 100644
index 0000000000..cc40494eeb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A3.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When "while" IterationStatement is evaluated, (normal, V, empty) is
+ returned
+es5id: 12.6.2_A3
+description: Using eval
+---*/
+
+var __evaluated, __in__do;
+
+__evaluated = eval("while (false) __in__do=1;");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#
+if (__in__do !== undefined) {
+ throw new Test262Error('#1: __in__do === undefined. Actual: __in__do ==='+ __in__do );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== undefined) {
+ throw new Test262Error('#2: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A4_T1.js b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T1.js
new file mode 100644
index 0000000000..bc2b1edb38
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T1.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "while" Statement is allowed and performed as described
+ in 12.8
+es5id: 12.6.2_A4_T1
+description: "\"break\" within a \"while\" Statement"
+---*/
+
+var __in__do__before__break, __in__do__after__break;
+
+while(1===1){
+ __in__do__before__break="reached";
+ break;
+ __in__do__after__break="where am i";
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do__before__break !== "reached") {
+ throw new Test262Error('#1: __in__do__before__break === "reached". Actual: __in__do__before__break ==='+ __in__do__before__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __in__do__after__break !== "undefined") {
+ throw new Test262Error('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A4_T2.js b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T2.js
new file mode 100644
index 0000000000..5e0eb1c85b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T2.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "while" Statement is allowed and performed as described
+ in 12.8
+es5id: 12.6.2_A4_T2
+description: "\"break\" and VariableDeclaration within a \"while\" Statement"
+---*/
+
+do_out : while(1===1) {
+ if (__in__do__before__break) break;
+ var __in__do__before__break="black";
+ do_in : while (1) {
+ var __in__do__IN__before__break="hole";
+ break do_in;
+ var __in__do__IN__after__break="sun";
+ } ;
+ var __in__do__after__break="won't you come";
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) {
+ throw new Test262Error('#1: Break inside do-while is allowed as its described at standard');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A4_T3.js b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T3.js
new file mode 100644
index 0000000000..a13cd34073
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T3.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "while" Statement is allowed and performed as described
+ in 12.8
+es5id: 12.6.2_A4_T3
+description: "\"break\" and VariableDeclaration within a \"while\" Statement"
+---*/
+
+do_out : while(1===1) {
+ if (__in__do__before__break) break;
+ var __in__do__before__break="once";
+ do_in : while (1) {
+ var __in__do__IN__before__break="in";
+ break do_out;
+ var __in__do__IN__after__break="the";
+ } ;
+ var __in__do__after__break="lifetime";
+} ;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&!__in__do__after__break)) {
+ throw new Test262Error('#1: Break inside do-while is allowed as its described at standard');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A4_T4.js b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T4.js
new file mode 100644
index 0000000000..d25a3662cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T4.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "while" Statement is allowed and performed as described
+ in 12.8
+es5id: 12.6.2_A4_T4
+description: "\"break\" and VariableDeclaration within a \"while\" Statement"
+---*/
+
+do_out : while(1===1) {
+ if(__in__do__before__break)break;
+ var __in__do__before__break="can't";
+ do_in : while (1) {
+ var __in__do__IN__before__break="get";
+ break;
+ var __in__do__IN__after__break="no";
+ } ;
+ var __in__do__after__break="Satisfaction";
+} ;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(__in__do__before__break&&__in__do__IN__before__break&&!__in__do__IN__after__break&&__in__do__after__break)) {
+ throw new Test262Error('#1: Break inside do-while is allowed as its described at standard');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A4_T5.js b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T5.js
new file mode 100644
index 0000000000..808f602683
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A4_T5.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ "break" within a "while" Statement is allowed and performed as described
+ in 12.8
+es5id: 12.6.2_A4_T5
+description: Using labeled "break" in order to continue a "while" loop
+---*/
+
+//CHECK#1
+var i = 0;
+woohoo:{
+ while(true){
+ i++;
+ if ( i == 10 ) {
+ break woohoo;
+ throw new Test262Error('#1.1: "break woohoo" must break loop');
+ }
+ }
+ throw new Test262Error('This code should be unreacheable');
+}
+assert.sameValue(i, 10);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A5.js b/js/src/tests/test262/language/statements/while/S12.6.2_A5.js
new file mode 100644
index 0000000000..ad9486e290
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A5.js
@@ -0,0 +1,40 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ While using "while" within an eval statement, source "break" is allowed
+ and (normal, V, empty) is returned
+es5id: 12.6.2_A5
+description: Using eval
+---*/
+
+var __evaluated, __in__do__before__break, __in__do__after__break;
+
+__evaluated = eval("while(1) {__in__do__before__break=1; break; __in__do__after__break=2;}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__in__do__before__break !== 1) {
+ throw new Test262Error('#1: __in__do__before__break === 1. Actual: __in__do__before__break ==='+ __in__do__before__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (typeof __in__do__after__break !== "undefined") {
+ throw new Test262Error('#2: typeof __in__do__after__break === "undefined". Actual: typeof __in__do__after__break ==='+ typeof __in__do__after__break );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (__evaluated !== 1) {
+ throw new Test262Error('#3: __evaluated === 1. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A6_T1.js b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T1.js
new file mode 100644
index 0000000000..a60298bed1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T1.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "while" IterationStatement is bracketed with braces
+es5id: 12.6.2_A6_T1
+description: Checking if execution of "while 1 break" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+while 1 break;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A6_T2.js b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T2.js
new file mode 100644
index 0000000000..15db49c2c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T2.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "while" IterationStatement is bracketed with braces
+es5id: 12.6.2_A6_T2
+description: Checking if execution of "while 0 break" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+while 0 break;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A6_T3.js b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T3.js
new file mode 100644
index 0000000000..458c8921fa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T3.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "while" IterationStatement is bracketed with braces
+es5id: 12.6.2_A6_T3
+description: Checking if execution of "while true break" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+while true break;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A6_T4.js b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T4.js
new file mode 100644
index 0000000000..a4f37f8066
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T4.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "while" IterationStatement is bracketed with braces
+es5id: 12.6.2_A6_T4
+description: Checking if execution of "while false break" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+while false break;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A6_T5.js b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T5.js
new file mode 100644
index 0000000000..c923aa1f89
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T5.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "while" IterationStatement is bracketed with braces
+es5id: 12.6.2_A6_T5
+description: Checking if execution of "while '' break" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+while '' break;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A6_T6.js b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T6.js
new file mode 100644
index 0000000000..0ce691ecd8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A6_T6.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Expression in "while" IterationStatement is bracketed with braces
+es5id: 12.6.2_A6_T6
+description: Checking if execution of "while 'hood' break" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+while 'hood' break;
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A7.js b/js/src/tests/test262/language/statements/while/S12.6.2_A7.js
new file mode 100644
index 0000000000..b8ebf62d0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A7.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The "while" Statement is evaluted according to 12.6.2 and returns
+ (normal, V, empty)
+es5id: 12.6.2_A7
+description: using eval
+---*/
+
+var __evaluated;
+var __condition=0
+
+__evaluated = eval("while (__condition<5) eval(\"__condition++\");");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__condition !== 5) {
+ throw new Test262Error('#1: The "while" statement is evaluated as described in the Standard');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== 4) {
+ throw new Test262Error('#2: The "while" statement returns (normal, V, empty)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A8.js b/js/src/tests/test262/language/statements/while/S12.6.2_A8.js
new file mode 100644
index 0000000000..f9eae898d4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A8.js
@@ -0,0 +1,31 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"continue\" statement within a \"while\" Statement is allowed"
+es5id: 12.6.2_A8
+description: using eval
+---*/
+
+var __evaluated;
+var __condition = 0, __odds=0;
+
+__evaluated = eval("while(__condition < 10) { __condition++; if (((''+__condition/2).split('.')).length>1) continue; __odds++;}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__odds !== 5) {
+ throw new Test262Error('#1: __odds === 5. Actual: __odds ==='+ __odds );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__evaluated !== 4) {
+ throw new Test262Error('#2: __evaluated === 4. Actual: __evaluated ==='+ __evaluated );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/S12.6.2_A9.js b/js/src/tests/test262/language/statements/while/S12.6.2_A9.js
new file mode 100644
index 0000000000..c1739db70d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/S12.6.2_A9.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: "\"while\" Statement is evaluated without syntax checks"
+es5id: 12.6.2_A9
+description: Throwing system exception inside "while" loop
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ while(x!=1) {
+ var x = 1;
+ abaracadabara;
+ };
+ throw new Test262Error('#1: "abbracadabra" lead to throwing exception');
+
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+}
+
+if (x !== 1) {
+ throw new Test262Error('#1.1: while statement evaluates as is, without syntax checks');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/browser.js b/js/src/tests/test262/language/statements/while/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/browser.js
diff --git a/js/src/tests/test262/language/statements/while/cptn-abrupt-empty.js b/js/src/tests/test262/language/statements/while/cptn-abrupt-empty.js
new file mode 100644
index 0000000000..3ac8963068
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/cptn-abrupt-empty.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.3.6
+description: >
+ Completion value when iteration completes due to an empty abrupt completion
+info: |
+ IterationStatement : while ( Expression ) Statement
+
+ 1. Let V = undefined.
+ 2. Repeat
+ a. Let exprRef be the result of evaluating Expression.
+ b. Let exprValue be GetValue(exprRef).
+ c. ReturnIfAbrupt(exprValue).
+ d. If ToBoolean(exprValue) is false, return NormalCompletion(V).
+ e. Let stmt be the result of evaluating Statement.
+ f. If LoopContinues (stmt, labelSet) is false, return
+ Completion(UpdateEmpty(stmt, V)).
+---*/
+
+assert.sameValue(eval('1; while (true) { break; }'), undefined);
+assert.sameValue(eval('2; while (true) { 3; break; }'), 3);
+
+assert.sameValue(
+ eval('4; outer: do { while (true) { continue outer; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; outer: do { while (true) { 6; continue outer; } } while (false)'), 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/cptn-iter.js b/js/src/tests/test262/language/statements/while/cptn-iter.js
new file mode 100644
index 0000000000..37ad74646b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/cptn-iter.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.3.6
+description: >
+ Completion value when iteration completes due to expression value
+info: |
+ IterationStatement : while ( Expression ) Statement
+
+ 1. Let V = undefined.
+ 2. Repeat
+ a. Let exprRef be the result of evaluating Expression.
+ b. Let exprValue be GetValue(exprRef).
+ c. ReturnIfAbrupt(exprValue).
+ d. If ToBoolean(exprValue) is false, return NormalCompletion(V).
+ e. Let stmt be the result of evaluating Statement.
+ f. If LoopContinues (stmt, labelSet) is false, return
+ Completion(UpdateEmpty(stmt, V)).
+ g. If stmt.[[value]] is not empty, let V = stmt.[[value]].
+---*/
+
+assert.sameValue(eval('var count1 = 2; 1; while (count1 -= 1) { }'), undefined);
+assert.sameValue(eval('var count2 = 2; 2; while (count2 -= 1) { 3; }'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/cptn-no-iter.js b/js/src/tests/test262/language/statements/while/cptn-no-iter.js
new file mode 100644
index 0000000000..79ca3de7c8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/cptn-no-iter.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.7.3.6
+description: >
+ Completion value when no iteration occurs
+info: |
+ IterationStatement : while ( Expression ) Statement
+
+ 1. Let V = undefined.
+ 2. Repeat
+ a. Let exprRef be the result of evaluating Expression.
+ b. Let exprValue be GetValue(exprRef).
+ c. ReturnIfAbrupt(exprValue).
+ d. If ToBoolean(exprValue) is false, return NormalCompletion(V).
+---*/
+
+assert.sameValue(eval('1; while (false) { }'), undefined);
+assert.sameValue(eval('2; while (false) { 3; }'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/decl-async-fun.js b/js/src/tests/test262/language/statements/while/decl-async-fun.js
new file mode 100644
index 0000000000..3fe7a471cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/decl-async-fun.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-while-statement
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+while (false) async function f() {}
diff --git a/js/src/tests/test262/language/statements/while/decl-async-gen.js b/js/src/tests/test262/language/statements/while/decl-async-gen.js
new file mode 100644
index 0000000000..4bed807262
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/decl-async-gen.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-while-statement
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+---*/
+
+$DONOTEVALUATE();
+
+while (false) async function* g() {}
diff --git a/js/src/tests/test262/language/statements/while/decl-cls.js b/js/src/tests/test262/language/statements/while/decl-cls.js
new file mode 100644
index 0000000000..46ebe8e0aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/decl-cls.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-while-statement
+es6id: 13.7.3
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+while (false) class C {}
diff --git a/js/src/tests/test262/language/statements/while/decl-const.js b/js/src/tests/test262/language/statements/while/decl-const.js
new file mode 100644
index 0000000000..745a7d8e49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/decl-const.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-while-statement
+es6id: 13.7.3
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+while (false) const x = null;
diff --git a/js/src/tests/test262/language/statements/while/decl-fun.js b/js/src/tests/test262/language/statements/while/decl-fun.js
new file mode 100644
index 0000000000..8b286ca3d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/decl-fun.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Function declaration not allowed in statement position
+esid: sec-while-statement
+es6id: 13.7.3
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+while (false) function f() {}
diff --git a/js/src/tests/test262/language/statements/while/decl-gen.js b/js/src/tests/test262/language/statements/while/decl-gen.js
new file mode 100644
index 0000000000..5df6b6ec54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/decl-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-while-statement
+es6id: 13.7.3
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+while (false) function* g() {}
diff --git a/js/src/tests/test262/language/statements/while/decl-let.js b/js/src/tests/test262/language/statements/while/decl-let.js
new file mode 100644
index 0000000000..4dedea5212
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/decl-let.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-while-statement
+es6id: 13.7.3
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+while (false) let x;
diff --git a/js/src/tests/test262/language/statements/while/labelled-fn-stmt.js b/js/src/tests/test262/language/statements/while/labelled-fn-stmt.js
new file mode 100644
index 0000000000..4260ee2fe1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/labelled-fn-stmt.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: It is a Syntax Error if IsLabelledFunction(Statement) is true.
+negative:
+ phase: parse
+ type: SyntaxError
+esid: sec-semantics-static-semantics-early-errors
+es6id: 13.7.1.1
+info: |
+ Although Annex B describes an extension which permits labelled function
+ declarations outside of strict mode, this early error is applied regardless
+ of the language mode.
+---*/
+
+$DONOTEVALUATE();
+
+while (false) label1: label2: function f() {}
diff --git a/js/src/tests/test262/language/statements/while/let-array-with-newline.js b/js/src/tests/test262/language/statements/while/let-array-with-newline.js
new file mode 100644
index 0000000000..27c86cbb29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/let-array-with-newline.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-while-statement
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+while (false) let
+[a] = 0;
diff --git a/js/src/tests/test262/language/statements/while/let-block-with-newline.js b/js/src/tests/test262/language/statements/while/let-block-with-newline.js
new file mode 100644
index 0000000000..3ee10d92ba
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/let-block-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-while-statement
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let {`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+while (false) let // ASI
+{}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/let-identifier-with-newline.js b/js/src/tests/test262/language/statements/while/let-identifier-with-newline.js
new file mode 100644
index 0000000000..a1658c15d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/let-identifier-with-newline.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-while-statement
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+while (false) let // ASI
+x = 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/while/shell.js b/js/src/tests/test262/language/statements/while/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/while/tco-body-strict.js b/js/src/tests/test262/language/statements/while/tco-body-strict.js
new file mode 100644
index 0000000000..89d01601de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/while/tco-body-strict.js
@@ -0,0 +1,25 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ while (true) {
+ return f(n - 1);
+ }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-0-1.js b/js/src/tests/test262/language/statements/with/12.10-0-1.js
new file mode 100644
index 0000000000..0274f09000
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-0-1.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-0-1
+description: >
+ with does not change declaration scope - vars in with are visible
+ outside
+flags: [noStrict]
+---*/
+
+ var o = {};
+ var f = function () {
+ /* capture foo binding before executing with */
+ return foo;
+ }
+
+ with (o) {
+ var foo = "12.10-0-1";
+ }
+
+assert.sameValue(f(), "12.10-0-1", 'f()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-0-10.js b/js/src/tests/test262/language/statements/with/12.10-0-10.js
new file mode 100644
index 0000000000..308ca4c44d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-0-10.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-0-10
+description: with introduces scope - name lookup finds function parameter
+flags: [noStrict]
+---*/
+
+ function f(o) {
+
+ function innerf(o, x) {
+ with (o) {
+ return x;
+ }
+ }
+
+ return innerf(o, 42);
+ }
+
+assert.sameValue(f({}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-0-11.js b/js/src/tests/test262/language/statements/with/12.10-0-11.js
new file mode 100644
index 0000000000..4881f88bce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-0-11.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-0-11
+description: with introduces scope - name lookup finds inner variable
+flags: [noStrict]
+---*/
+
+ function f(o) {
+
+ function innerf(o) {
+ var x = 42;
+
+ with (o) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+assert.sameValue(f({}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-0-12.js b/js/src/tests/test262/language/statements/with/12.10-0-12.js
new file mode 100644
index 0000000000..647ab0cc2e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-0-12.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-0-12
+description: with introduces scope - name lookup finds property
+flags: [noStrict]
+---*/
+
+ function f(o) {
+
+ function innerf(o) {
+ with (o) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+assert.sameValue(f({x:42}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-0-3.js b/js/src/tests/test262/language/statements/with/12.10-0-3.js
new file mode 100644
index 0000000000..5684a9364e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-0-3.js
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-0-3
+description: with introduces scope - that is captured by function expression
+flags: [noStrict]
+---*/
+
+ var o = {prop: "12.10-0-3 before"};
+ var f;
+
+ with (o) {
+ f = function () { return prop; }
+ }
+ o.prop = "12.10-0-3 after";
+
+assert.sameValue(f(), "12.10-0-3 after", 'f()');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-0-7.js b/js/src/tests/test262/language/statements/with/12.10-0-7.js
new file mode 100644
index 0000000000..3be6a9b151
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-0-7.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-0-7
+description: with introduces scope - scope removed when exiting with statement
+flags: [noStrict]
+---*/
+
+ var o = {foo: 1};
+
+ with (o) {
+ foo = 42;
+ }
+
+ try {
+ foo;
+ throw new Error();
+ }
+ catch (e) {
+ assert(e instanceof ReferenceError);
+ }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-0-8.js b/js/src/tests/test262/language/statements/with/12.10-0-8.js
new file mode 100644
index 0000000000..a97e1be0c1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-0-8.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-0-8
+description: with introduces scope - var initializer sets like named property
+flags: [noStrict]
+---*/
+
+ var o = {foo: 42};
+
+ with (o) {
+ var foo = "set in with";
+ }
+
+assert.sameValue(o.foo, "set in with", 'o.foo');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-0-9.js b/js/src/tests/test262/language/statements/with/12.10-0-9.js
new file mode 100644
index 0000000000..cadd074ba3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-0-9.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-0-9
+description: with introduces scope - name lookup finds outer variable
+flags: [noStrict]
+---*/
+
+ function f(o) {
+ var x = 42;
+
+ function innerf(o) {
+ with (o) {
+ return x;
+ }
+ }
+
+ return innerf(o);
+ }
+
+assert.sameValue(f({}), 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-2-1.js b/js/src/tests/test262/language/statements/with/12.10-2-1.js
new file mode 100644
index 0000000000..7a8142abad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-2-1.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-2-1
+description: with - expression being Number
+flags: [noStrict]
+---*/
+
+ var o = 2;
+ var foo = 1;
+ with (o) {
+ foo = 42;
+ }
+
+assert.sameValue(foo, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-2-2.js b/js/src/tests/test262/language/statements/with/12.10-2-2.js
new file mode 100644
index 0000000000..d1344d0e23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-2-2.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-2-2
+description: with - expression being Boolean
+flags: [noStrict]
+---*/
+
+ var o = true;
+ var foo = 1;
+ with (o) {
+ foo = 42;
+ }
+
+assert.sameValue(foo, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-2-3.js b/js/src/tests/test262/language/statements/with/12.10-2-3.js
new file mode 100644
index 0000000000..bbd6ebea6b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-2-3.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-2-3
+description: with - expression being string
+flags: [noStrict]
+---*/
+
+ var o = "str";
+ var foo = 1;
+ with (o) {
+ foo = 42;
+ }
+
+assert.sameValue(foo, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-2-4.js b/js/src/tests/test262/language/statements/with/12.10-2-4.js
new file mode 100644
index 0000000000..7834c1588b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-2-4.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: ToObject conversion from undefined value must throw TypeError
+es5id: 12.10-2-4
+description: Trying to convert undefined to Object
+flags: [noStrict]
+---*/
+
+try{
+ with(undefined) x = 2;
+ throw new Test262Error('#2.1: with(undefined) x = 2 must throw TypeError. Actual: x === ' + (x));
+}
+catch(e){
+ if((e instanceof TypeError) !== true){
+ throw new Test262Error('#2.2: with(undefined) x = 2 must throw TypeError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-2-5.js b/js/src/tests/test262/language/statements/with/12.10-2-5.js
new file mode 100644
index 0000000000..893723f979
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-2-5.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: ToObject conversion from null value must throw TypeError
+es5id: 12.10-2-5
+description: Trying to convert null to Object
+flags: [noStrict]
+---*/
+
+try{
+ with(null) x = 2;
+ throw new Test262Error('#2.1: with(null) x = 2 must throw TypeError. Actual: x === . Actual: ' + (x));
+}
+catch(e){
+ if((e instanceof TypeError) !== true){
+ throw new Test262Error('#2.2: with(null) x = 2 must throw TypeError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10-7-1.js b/js/src/tests/test262/language/statements/with/12.10-7-1.js
new file mode 100644
index 0000000000..d667ddf21c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10-7-1.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10-7-1
+description: with introduces scope - restores the earlier environment on exit
+flags: [noStrict]
+---*/
+
+ var a = 1;
+
+ var o = {a : 2};
+ try {
+ with (o) {
+ a = 3;
+ throw 1;
+ a = 4;
+ }
+ } catch (e) {
+ // intentionally ignored
+ }
+
+assert.sameValue(a, 1, 'a');
+assert.sameValue(o.a, 3, 'o.a');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10.1-10-s-strict.js b/js/src/tests/test262/language/statements/with/12.10.1-10-s-strict.js
new file mode 100644
index 0000000000..d6eb11e8b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10.1-10-s-strict.js
@@ -0,0 +1,23 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-10-s
+description: >
+ with statement in strict mode throws SyntaxError (eval, where the
+ container function is strict)
+flags: [onlyStrict]
+---*/
+
+ // wrapping it in eval since this needs to be a syntax error. The
+ // exception thrown must be a SyntaxError exception. Note that eval
+ // inherits the strictness of its calling context.
+assert.throws(SyntaxError, function() {
+ eval("\
+ var o = {};\
+ with (o) {}\
+ ");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10.1-11gs-strict.js b/js/src/tests/test262/language/statements/with/12.10.1-11gs-strict.js
new file mode 100644
index 0000000000..2488b5b6df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10.1-11gs-strict.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-11gs
+description: Strict Mode - SyntaxError is thrown when using with statement
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) { }
diff --git a/js/src/tests/test262/language/statements/with/12.10.1-12-s.js b/js/src/tests/test262/language/statements/with/12.10.1-12-s.js
new file mode 100644
index 0000000000..5517c97d92
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10.1-12-s.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-12-s
+description: with statement in strict mode throws SyntaxError (strict eval)
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ eval("\
+ 'use strict'; \
+ var o = {}; \
+ with (o) {}\
+ ");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10.1-13-s.js b/js/src/tests/test262/language/statements/with/12.10.1-13-s.js
new file mode 100644
index 0000000000..787a52bfc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10.1-13-s.js
@@ -0,0 +1,16 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-13-s
+description: >
+ Strict Mode - SyntaxError isn't thrown when WithStatement body is
+ in strict mode code
+flags: [noStrict]
+---*/
+
+ with ({}) {
+ "use strict";
+ }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10.1-4-s.js b/js/src/tests/test262/language/statements/with/12.10.1-4-s.js
new file mode 100644
index 0000000000..9f77e77e6c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10.1-4-s.js
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-4-s
+description: with statement in strict mode throws SyntaxError (strict Function)
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ var f = Function("\
+ \'use strict\'; \
+ var o = {}; \
+ with (o) {};\
+ ");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10.1-5-s-strict.js b/js/src/tests/test262/language/statements/with/12.10.1-5-s-strict.js
new file mode 100644
index 0000000000..48883f9dc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10.1-5-s-strict.js
@@ -0,0 +1,15 @@
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-5-s
+description: >
+ with statement allowed in nested Function even if its container
+ Function is strict)
+flags: [onlyStrict]
+---*/
+
+ Function("\'use strict\'; var f1 = Function( \"var o = {}; with (o) {};\")");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/12.10.1-8-s.js b/js/src/tests/test262/language/statements/with/12.10.1-8-s.js
new file mode 100644
index 0000000000..46c2ab992d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/12.10.1-8-s.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-8-s
+description: >
+ with statement in strict mode throws SyntaxError (function
+ expression, where the container Function is strict)
+flags: [noStrict]
+---*/
+
+
+assert.throws(SyntaxError, function() {
+ Function("\
+ \'use strict\'; \
+ var f1 = function () {\
+ var o = {}; \
+ with (o) {}; \
+ }\
+ ");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T1.js
new file mode 100644
index 0000000000..f88e79d5ce
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T1.js
@@ -0,0 +1,142 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.10_T1
+description: >
+ Using interation statement within "with" statement leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ do{
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ while(false);
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T2.js
new file mode 100644
index 0000000000..53666b8450
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T2.js
@@ -0,0 +1,151 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.10_T2
+description: >
+ Using iteration statement within "with" statement leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ do{
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ while(false);
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T3.js
new file mode 100644
index 0000000000..1575181700
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T3.js
@@ -0,0 +1,154 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.10_T3
+description: >
+ Using iteration statment withing "with" statement leading to
+ completion by exception iteration statement inside with statement
+ - exception completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ do{
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ while(false);
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === undefined)){
+ throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 );
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T4.js
new file mode 100644
index 0000000000..7ad7a462b6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T4.js
@@ -0,0 +1,144 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.10_T4
+description: >
+ Using iteration statement witthin "with" staement leading to
+ completion by break iteration statement inside with statement -
+ break completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ do{
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ break;
+ }
+ while(false);
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.10_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T5.js
new file mode 100644
index 0000000000..bc2fc1841e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.10_T5.js
@@ -0,0 +1,145 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.10_T5
+description: >
+ Using iteration statement within "with" statement leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ do{
+ break;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ while(false);
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === undefined)){
+ throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 );
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T1.js
new file mode 100644
index 0000000000..da12e61a72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T1.js
@@ -0,0 +1,148 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.11_T1
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+}
+
+with(myObj){
+ f();
+}
+
+if(!(p1 === "x1")){
+ throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+try{
+ p3;
+ throw new Test262Error('#3: p3 is nod defined');
+}
+catch(e){
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === parseInt)){
+ throw new Test262Error('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt );
+}
+
+assert.sameValue(st_NaN, NaN, "st_NaN is NaN");
+
+if(!(st_Infinity === Infinity)){
+ throw new Test262Error('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === eval)){
+ throw new Test262Error('#14: st_eval === eval. Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === parseFloat)){
+ throw new Test262Error('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === isNaN)){
+ throw new Test262Error('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === isFinite)){
+ throw new Test262Error('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try {
+ value;
+ throw new Test262Error('#18: value is not defined');
+} catch(e) {
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T2.js
new file mode 100644
index 0000000000..8f53e950de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T2.js
@@ -0,0 +1,153 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.11_T2
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ return value;
+}
+
+with(myObj){
+ result = f();
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === "x1")){
+ throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+try{
+ p3;
+ throw new Test262Error('#3: p3 is nod defined');
+}
+catch(e){
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === parseInt)){
+ throw new Test262Error('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt );
+}
+
+assert.sameValue(st_NaN, NaN, "st_NaN is NaN");
+
+if(!(st_Infinity === Infinity)){
+ throw new Test262Error('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === eval)){
+ throw new Test262Error('#14: st_eval === eval. Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === parseFloat)){
+ throw new Test262Error('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === isNaN)){
+ throw new Test262Error('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === isFinite)){
+ throw new Test262Error('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try {
+ value;
+ throw new Test262Error('#18: value is not defined');
+} catch(e) {
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T3.js
new file mode 100644
index 0000000000..d9cc6eb1d7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T3.js
@@ -0,0 +1,155 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.11_T3
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+var f = function(){
+ return value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+}
+
+with(myObj){
+ result = f();
+}
+
+if(!(result === undefined)){
+ throw new Test262Error('#0: result === undefined. Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try{
+ p4;
+ throw new Test262Error('#4: p4 doesn\'t exists');
+}
+catch(e){
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try {
+ value;
+ throw new Test262Error('#18: value is not defined');
+} catch(e) {
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T4.js
new file mode 100644
index 0000000000..b20e0c8857
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T4.js
@@ -0,0 +1,156 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.11_T4
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ with(myObj){
+ f();
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === "x1")){
+ throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+try{
+ p3;
+ throw new Test262Error('#3: p3 is nod defined');
+}
+catch(e){
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === parseInt)){
+ throw new Test262Error('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt );
+}
+
+assert.sameValue(st_NaN, NaN, 'st_NaN is NaN');
+
+if(!(st_Infinity === Infinity)){
+ throw new Test262Error('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === eval)){
+ throw new Test262Error('#14: st_eval === eval. Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === parseFloat)){
+ throw new Test262Error('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === isNaN)){
+ throw new Test262Error('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === isFinite)){
+ throw new Test262Error('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try {
+ value;
+ throw new Test262Error('#18: value is not defined');
+} catch(e) {
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.11_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T5.js
new file mode 100644
index 0000000000..6eb69e35ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.11_T5.js
@@ -0,0 +1,158 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.11_T5
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ var f = function(){
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ with(myObj){
+ f();
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === undefined)){
+ throw new Test262Error('#0: result === undefined. Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try{
+ p4;
+ throw new Test262Error('#4: p4 doesn\'t exists');
+}
+catch(e){
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try {
+ value;
+ throw new Test262Error('#18: value is not defined');
+} catch(e) {
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T1.js
new file mode 100644
index 0000000000..8e62e38471
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T1.js
@@ -0,0 +1,147 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.12_T1
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+f();
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try{
+ p4;
+ throw new Test262Error('#4: p4 doesn\'t exists');
+}
+catch(e){
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try {
+ value;
+ throw new Test262Error('#18: value is not defined');
+} catch(e) {
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T2.js
new file mode 100644
index 0000000000..27942f5995
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T2.js
@@ -0,0 +1,153 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.12_T2
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ return value;
+ }
+}
+result = f();
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try{
+ p4;
+ throw new Test262Error('#4: p4 doesn\'t exists');
+}
+catch(e){
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T3.js
new file mode 100644
index 0000000000..3ed26a5e71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T3.js
@@ -0,0 +1,154 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.12_T3
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ var f = function(){
+ return value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+result = f();
+
+if(!(result === undefined)){
+ throw new Test262Error('#0: result === undefined. Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T4.js
new file mode 100644
index 0000000000..7cbbb781dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T4.js
@@ -0,0 +1,155 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.12_T4
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ }
+ f();
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try {
+ value;
+ throw new Test262Error('#18: value is not defined');
+} catch(e) {
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.12_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T5.js
new file mode 100644
index 0000000000..a09bb48a8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.12_T5.js
@@ -0,0 +1,158 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.12_T5
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ var f = function(){
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ }
+ f();
+} catch(e){
+ result = e;
+}
+
+if(!(result === undefined)){
+ throw new Test262Error('#0: result === undefined. Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.1_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T1.js
new file mode 100644
index 0000000000..e168158186
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T1.js
@@ -0,0 +1,137 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.1_T1
+description: Using "with" inside of global context leading to normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.1_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T2.js
new file mode 100644
index 0000000000..cc098e2d0b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T2.js
@@ -0,0 +1,148 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.1_T2
+description: >
+ Using "with" inside of global context leading to completion by
+ exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.1_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T3.js
new file mode 100644
index 0000000000..3d732d15a2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.1_T3.js
@@ -0,0 +1,150 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.1_T3
+description: >
+ Using "with" inside of global context leading to completion by
+ exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === undefined)){
+ throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 );
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T1.js
new file mode 100644
index 0000000000..6bcb233d38
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T1.js
@@ -0,0 +1,148 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.2_T1
+description: >
+ Calling a function without "with" statement when the statement
+ itself is declared within the function declaration, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+var f = function(){
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+f();
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T2.js
new file mode 100644
index 0000000000..a2a37cd30d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T2.js
@@ -0,0 +1,153 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.2_T2
+description: >
+ Calling a function without "with" statement when the statement
+ itself is declared within the function declaration, leading to
+ normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+var f = function(){
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ return value;
+ }
+}
+result = f();
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T3.js
new file mode 100644
index 0000000000..f42c5ea3e9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T3.js
@@ -0,0 +1,155 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.2_T3
+description: >
+ Calling a function without "with" statement when the statement
+ itself is declared within the function declaration, leading to
+ normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+var f = function(){
+ with(myObj){
+ return value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+result = f();
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T4.js
new file mode 100644
index 0000000000..e4ceec0102
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T4.js
@@ -0,0 +1,157 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.2_T4
+description: >
+ Calling a function without "with" statement when the statement
+ itself is declared within the function declaration, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ var f = function(){
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ }
+ f();
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.2_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T5.js
new file mode 100644
index 0000000000..ac10e9fd1f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.2_T5.js
@@ -0,0 +1,155 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.2_T5
+description: >
+ Calling a function without "with" statement when the statement
+ itself is declared within the function declaration, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ var f = function(){
+ with(myObj){
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ }
+ f();
+} catch(e){
+ result = e;
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T1.js
new file mode 100644
index 0000000000..6c018ae4bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T1.js
@@ -0,0 +1,147 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.3_T1
+description: >
+ Using "with" statement within function constructor, leading to
+ normal completition
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+var f = function(){
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+var obj = new f();
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T2.js
new file mode 100644
index 0000000000..b8ebe659cd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T2.js
@@ -0,0 +1,148 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.3_T2
+description: >
+ Using "with" statement within function constructor, leading to
+ normal completition by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+var f = function(){
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ return value;
+ }
+}
+var obj = new f();
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T3.js
new file mode 100644
index 0000000000..86c7f9712f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T3.js
@@ -0,0 +1,150 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.3_T3
+description: >
+ Using "with" statement within function constructor, leading to
+ normal completition by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+var f = function(){
+ with(myObj){
+ return value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+var obj = new f();
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T4.js
new file mode 100644
index 0000000000..4baa45391b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T4.js
@@ -0,0 +1,152 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.3_T4
+description: >
+ Using "with" statement within function constructor, leading to
+ completition by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ var f = function(){
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ }
+ var obj = new f();
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.3_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T5.js
new file mode 100644
index 0000000000..cac40c5bfe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.3_T5.js
@@ -0,0 +1,158 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.3_T5
+description: >
+ Using "with" statement within function constructor, leading to
+ completition by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ var f = function(){
+ with(myObj){
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ }
+ var obj = new f();
+} catch(e){
+ result = e;
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T1.js
new file mode 100644
index 0000000000..c2abf2a947
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T1.js
@@ -0,0 +1,142 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.4_T1
+description: >
+ Using "with" statement within iteration statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+do{
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+while(false);
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T2.js
new file mode 100644
index 0000000000..d128b0c764
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T2.js
@@ -0,0 +1,151 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.4_T2
+description: >
+ Using "with" statement within iteration statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ do{
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ }
+ while(false);
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T3.js
new file mode 100644
index 0000000000..b87b9829f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T3.js
@@ -0,0 +1,153 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.4_T3
+description: >
+ Using "with" statement within iteration statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ do{
+ with(myObj){
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ }
+ while(false);
+} catch(e){
+ result = e;
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === undefined)){
+ throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 );
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T4.js
new file mode 100644
index 0000000000..d0b63138f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T4.js
@@ -0,0 +1,143 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.4_T4
+description: >
+ Using "with" statement within iteration statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+do{
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ break;
+ }
+}
+while(false);
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.4_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T5.js
new file mode 100644
index 0000000000..39c7c2d31b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.4_T5.js
@@ -0,0 +1,145 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.4_T5
+description: >
+ Using "with" statement within iteration statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+do{
+ with(myObj){
+ break;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+while(false);
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === undefined)){
+ throw new Test262Error('#4: p4 ===undefined. Actual: p4 ==='+ p4 );
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T1.js
new file mode 100644
index 0000000000..6c34245333
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T1.js
@@ -0,0 +1,147 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.5_T1
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+for(var prop in myObj){
+ with(myObj){
+ if(prop === 'p1') {
+ st_p1 = p1;
+ p1 = 'x1';
+ }
+ if(prop === 'p2') {
+ st_p2 = p2;
+ this.p2 = 'x2';
+ }
+ if(prop === 'p3') {
+ st_p3 = p3;
+ del = delete p3;
+ }
+ if(prop === 'parseInt') st_parseInt = parseInt;
+ if(prop === 'NaN') st_NaN = NaN;
+ if(prop === 'Infinity') st_Infinity = Infinity;
+ if(prop === 'eval') st_eval = eval;
+ if(prop === 'parseFloat') st_parseFloat = parseFloat;
+ if(prop === 'isNaN') st_isNaN = isNaN;
+ if(prop === 'isFinite') st_isFinite = isFinite;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T2.js
new file mode 100644
index 0000000000..808706bfaa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T2.js
@@ -0,0 +1,150 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.5_T2
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ for(var prop in myObj){
+ with(myObj){
+ st_p1 = p1;
+ p1 = 'x1';
+ st_p2 = p2;
+ this.p2 = 'x2';
+ st_p3 = p3;
+ del = delete p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T3.js
new file mode 100644
index 0000000000..3878a38f58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T3.js
@@ -0,0 +1,158 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.5_T3
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ for(var prop in myObj){
+ with(myObj){
+ throw value;
+ if(prop === 'p1') {
+ st_p1 = p1;
+ p1 = 'x1';
+ }
+ if(prop === 'p2') {
+ st_p2 = p2;
+ this.p2 = 'x2';
+ }
+ if(prop === 'p3') {
+ st_p3 = p3;
+ del = delete p3;
+ }
+ if(prop === 'parseInt') st_parseInt = parseInt;
+ if(prop === 'NaN') st_NaN = NaN;
+ if(prop === 'Infinity') st_Infinity = Infinity;
+ if(prop === 'eval') st_eval = eval;
+ if(prop === 'parseFloat') st_parseFloat = parseFloat;
+ if(prop === 'isNaN') st_isNaN = isNaN;
+ if(prop === 'isFinite') st_isFinite = isFinite;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === undefined)){
+ throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 );
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T4.js
new file mode 100644
index 0000000000..43a98385dc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T4.js
@@ -0,0 +1,142 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.5_T4
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+for(var prop in myObj){
+ with(myObj){
+ st_p1 = p1;
+ p1 = 'x1';
+ st_p2 = p2;
+ this.p2 = 'x2';
+ st_p3 = p3;
+ del = delete p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ break;
+ }
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.5_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T5.js
new file mode 100644
index 0000000000..db784e9783
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.5_T5.js
@@ -0,0 +1,150 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.5_T5
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+for(var prop in myObj){
+ with(myObj){
+ break;
+ if(prop === 'p1') {
+ st_p1 = p1;
+ p1 = 'x1';
+ }
+ if(prop === 'p2') {
+ st_p2 = p2;
+ this.p2 = 'x2';
+ }
+ if(prop === 'p3') {
+ st_p3 = p3;
+ del = delete p3;
+ }
+ if(prop === 'parseInt') st_parseInt = parseInt;
+ if(prop === 'NaN') st_NaN = NaN;
+ if(prop === 'Infinity') st_Infinity = Infinity;
+ if(prop === 'eval') st_eval = eval;
+ if(prop === 'parseFloat') st_parseFloat = parseFloat;
+ if(prop === 'isNaN') st_isNaN = isNaN;
+ if(prop === 'isFinite') st_isFinite = isFinite;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === undefined)){
+ throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 );
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.6_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T1.js
new file mode 100644
index 0000000000..6d0a4ffada
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T1.js
@@ -0,0 +1,141 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.6_T1
+description: >
+ Using "with" statement within another "with" statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.6_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T2.js
new file mode 100644
index 0000000000..536303002d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T2.js
@@ -0,0 +1,150 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.6_T2
+description: >
+ Using "with" statement within another "with" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ with(myObj){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.6_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T3.js
new file mode 100644
index 0000000000..dea5bda8ad
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.6_T3.js
@@ -0,0 +1,152 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.6_T3
+description: >
+ Using "with" statement within another "with" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ with(myObj){
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === undefined)){
+ throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 );
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T1.js
new file mode 100644
index 0000000000..cc8808db2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T1.js
@@ -0,0 +1,147 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.7_T1
+description: >
+ Calling a function within "with" statement declared within the
+ statement, leading to normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ f();
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T2.js
new file mode 100644
index 0000000000..373696da99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T2.js
@@ -0,0 +1,152 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.7_T2
+description: >
+ Calling a function within "with" statement declared within the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ return value;
+ }
+ result = f();
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T3.js
new file mode 100644
index 0000000000..bf4566c9ac
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T3.js
@@ -0,0 +1,154 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.7_T3
+description: >
+ Calling a function within "with" statement declared within the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ var f = function(){
+ return value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ result = f();
+}
+
+if(!(result === undefined)){
+ throw new Test262Error('#0: result === undefined. Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T4.js
new file mode 100644
index 0000000000..4cc55a667d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T4.js
@@ -0,0 +1,156 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.7_T4
+description: >
+ Calling a function within "with" statement declared within the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ f();
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.7_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T5.js
new file mode 100644
index 0000000000..ddc6080b3f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.7_T5.js
@@ -0,0 +1,158 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.7_T5
+description: >
+ Calling a function within "with" statement declared within the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ var f = function(){
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ f();
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === undefined)){
+ throw new Test262Error('#0: result === undefined. Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T1.js
new file mode 100644
index 0000000000..1705f4ba90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T1.js
@@ -0,0 +1,147 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.8_T1
+description: >
+ Declaring function constructor within "with" statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ var obj = new f();
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T2.js
new file mode 100644
index 0000000000..6595eb969b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T2.js
@@ -0,0 +1,147 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.8_T2
+description: >
+ Declaring function constructor within "with" statement, leading to
+ normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ return value;
+ }
+ var obj = new f();
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T3.js
new file mode 100644
index 0000000000..2d7febb9b9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T3.js
@@ -0,0 +1,150 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.8_T3
+description: >
+ Declaring function constructor within "with" statement, leading to
+ normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ var f = function(){
+ return value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ var obj = new f();
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T4.js
new file mode 100644
index 0000000000..2d15ca3a0f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T4.js
@@ -0,0 +1,155 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.8_T4
+description: >
+ Declaring function constructor within "with" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ var f = function(){
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ throw value;
+ }
+ var obj = new f();
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#0: result === "value". Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.8_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T5.js
new file mode 100644
index 0000000000..de5f1b6b3b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.8_T5.js
@@ -0,0 +1,158 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.8_T5
+description: >
+ Declaring function constructor within "with" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+try {
+ with(myObj){
+ var f = function(){
+ throw value;
+ st_p1 = p1;
+ st_p2 = p2;
+ st_p3 = p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ p1 = 'x1';
+ this.p2 = 'x2';
+ del = delete p3;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+ var obj = new f();
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(result === undefined)){
+ throw new Test262Error('#0: result === undefined. Actual: result ==='+ result );
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+try {
+ p4;
+ throw new Test262Error('#4: p4 is not defined');
+} catch(e) {
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+try{
+ value;
+ throw new Test262Error('#18: value is not defined');
+}
+catch(e){
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.9_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T1.js
new file mode 100644
index 0000000000..4b87e1bc71
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T1.js
@@ -0,0 +1,147 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.9_T1
+description: >
+ Using "for-in" statement within "with" statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ for(var prop in myObj){
+ if(prop === 'p1') {
+ st_p1 = p1;
+ p1 = 'x1';
+ }
+ if(prop === 'p2') {
+ st_p2 = p2;
+ this.p2 = 'x2';
+ }
+ if(prop === 'p3') {
+ st_p3 = p3;
+ del = delete p3;
+ }
+ if(prop === 'parseInt') st_parseInt = parseInt;
+ if(prop === 'NaN') st_NaN = NaN;
+ if(prop === 'Infinity') st_Infinity = Infinity;
+ if(prop === 'eval') st_eval = eval;
+ if(prop === 'parseFloat') st_parseFloat = parseFloat;
+ if(prop === 'isNaN') st_isNaN = isNaN;
+ if(prop === 'isFinite') st_isFinite = isFinite;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.9_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T2.js
new file mode 100644
index 0000000000..0d3d5d98c5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T2.js
@@ -0,0 +1,142 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.9_T2
+description: >
+ Using "for-in" statement within "with" statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ for(var prop in myObj){
+ st_p1 = p1;
+ p1 = 'x1';
+ st_p2 = p2;
+ this.p2 = 'x2';
+ st_p3 = p3;
+ del = delete p3;
+ st_parseInt = parseInt;
+ st_NaN = NaN;
+ st_Infinity = Infinity;
+ st_eval = eval;
+ st_parseFloat = parseFloat;
+ st_isNaN = isNaN;
+ st_isFinite = isFinite;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ break;
+ }
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === "x2")){
+ throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === "x4")){
+ throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 );
+}
+
+if(!(p5 === "x5")){
+ throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === undefined)){
+ throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt !== parseInt)){
+ throw new Test262Error('#11: myObj.parseInt !== parseInt');
+}
+
+if(!(st_NaN === "obj_NaN")){
+ throw new Test262Error('#12: myObj.NaN !== NaN');
+}
+
+if(!(st_Infinity !== Infinity)){
+ throw new Test262Error('#13: myObj.Infinity !== Infinity');
+}
+
+if(!(st_eval !== eval)){
+ throw new Test262Error('#14: myObj.eval !== eval');
+}
+
+if(!(st_parseFloat !== parseFloat)){
+ throw new Test262Error('#15: myObj.parseFloat !== parseFloat');
+}
+
+if(!(st_isNaN !== isNaN)){
+ throw new Test262Error('#16: myObj.isNaN !== isNaN');
+}
+
+if(!(st_isFinite !== isFinite)){
+ throw new Test262Error('#17: myObj.isFinite !== isFinite');
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "value")){
+ throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A1.9_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T3.js
new file mode 100644
index 0000000000..741b16bd4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A1.9_T3.js
@@ -0,0 +1,150 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The with statement adds a computed object to the front of the
+ scope chain of the current execution context
+es5id: 12.10_A1.9_T3
+description: >
+ Using "for-in" statement within "with" statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+this.p2 = 2;
+this.p3 = 3;
+var result = "result";
+var myObj = {p1: 'a',
+ p2: 'b',
+ p3: 'c',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';},
+ parseInt : function(){return 'obj_parseInt';},
+ NaN : 'obj_NaN',
+ Infinity : 'obj_Infinity',
+ eval : function(){return 'obj_eval';},
+ parseFloat : function(){return 'obj_parseFloat';},
+ isNaN : function(){return 'obj_isNaN';},
+ isFinite : function(){return 'obj_isFinite';}
+}
+var del;
+var st_p1 = "p1";
+var st_p2 = "p2";
+var st_p3 = "p3";
+var st_parseInt = "parseInt";
+var st_NaN = "NaN";
+var st_Infinity = "Infinity";
+var st_eval = "eval";
+var st_parseFloat = "parseFloat";
+var st_isNaN = "isNaN";
+var st_isFinite = "isFinite";
+
+with(myObj){
+ for(var prop in myObj){
+ break;
+ if(prop === 'p1') {
+ st_p1 = p1;
+ p1 = 'x1';
+ }
+ if(prop === 'p2') {
+ st_p2 = p2;
+ this.p2 = 'x2';
+ }
+ if(prop === 'p3') {
+ st_p3 = p3;
+ del = delete p3;
+ }
+ if(prop === 'parseInt') st_parseInt = parseInt;
+ if(prop === 'NaN') st_NaN = NaN;
+ if(prop === 'Infinity') st_Infinity = Infinity;
+ if(prop === 'eval') st_eval = eval;
+ if(prop === 'parseFloat') st_parseFloat = parseFloat;
+ if(prop === 'isNaN') st_isNaN = isNaN;
+ if(prop === 'isFinite') st_isFinite = isFinite;
+ var p4 = 'x4';
+ p5 = 'x5';
+ var value = 'value';
+ }
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(p2 === 2)){
+ throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 );
+}
+
+if(!(p3 === 3)){
+ throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 );
+}
+
+if(!(p4 === undefined)){
+ throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 );
+}
+
+try {
+ p5;
+ throw new Test262Error('#5: p5 is not defined');
+} catch(e) {
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(myObj.p2 === "b")){
+ throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
+}
+
+if(!(myObj.p3 === "c")){
+ throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
+}
+
+if(!(myObj.p4 === undefined)){
+ throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
+}
+
+if(!(myObj.p5 === undefined)){
+ throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
+}
+
+if(!(st_parseInt === "parseInt")){
+ throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
+}
+
+if(!(st_NaN === "NaN")){
+ throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
+}
+
+if(!(st_Infinity === "Infinity")){
+ throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
+}
+
+if(!(st_eval === "eval")){
+ throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
+}
+
+if(!(st_parseFloat === "parseFloat")){
+ throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
+}
+
+if(!(st_isNaN === "isNaN")){
+ throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
+}
+
+if(!(st_isFinite === "isFinite")){
+ throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
+}
+
+if(!(value === undefined)){
+ throw new Test262Error('#18: value === undefined. Actual: value ==='+ value );
+}
+
+if(!(myObj.value === "myObj_value")){
+ throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T1.js
new file mode 100644
index 0000000000..4520887214
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T1.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.10_T1
+description: >
+ Using iteration statement within "with" statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ do{
+ p1 = 'x1';
+ } while(false);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T2.js
new file mode 100644
index 0000000000..a5cbbd6dea
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T2.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.10_T2
+description: >
+ Using iteration statement within "with" statement, leading
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ with(myObj){
+ do{
+ p1 = 'x1';
+ throw value;
+ } while(false);
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T3.js
new file mode 100644
index 0000000000..3c81eb1846
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T3.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.10_T3
+description: >
+ Using iteration statement within "with" statement, leading
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ with(myObj){
+ do{
+ throw value;
+ p1 = 'x1';
+ } while(false);
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T4.js
new file mode 100644
index 0000000000..b75e671465
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T4.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.10_T4
+description: >
+ Using iteration statement within "with" statement, leading
+ completion be break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ do{
+ p1 = 'x1';
+ break;
+ } while(false);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.10_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T5.js
new file mode 100644
index 0000000000..03961d1c80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.10_T5.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.10_T5
+description: >
+ Using iteration statement within "with" statement, leading
+ completion be break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ do{
+ break;
+ p1 = 'x1';
+ } while(false);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T1.js
new file mode 100644
index 0000000000..3cde073da5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T1.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.11_T1
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+var f = function(){
+ p1 = 'x1';
+}
+
+with(myObj){
+ f();
+}
+
+if(!(p1 === "x1")){
+ throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T2.js
new file mode 100644
index 0000000000..2a8f92ef6f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T2.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.11_T2
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var value = "value";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+var f = function(){
+ p1 = 'x1';
+ return value;
+}
+
+with(myObj){
+ result = f();
+}
+
+if(!(p1 === "x1")){
+ throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#3: result === "value". Actual: result ==='+ result );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T3.js
new file mode 100644
index 0000000000..b6be9fec2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T3.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.11_T3
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var value = "value";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+var f = function(){
+ return value;
+ p1 = 'x1';
+}
+
+with(myObj){
+ result = f();
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#3: result === "value". Actual: result ==='+ result );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T4.js
new file mode 100644
index 0000000000..f15d886ad0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T4.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.11_T4
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var value = "value";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ var f = function(){
+ p1 = 'x1';
+ throw value;
+ }
+
+ with(myObj){
+ f();
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(p1 === "x1")){
+ throw new Test262Error('#1: p1 === "x1". Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#3: result === "value". Actual: result ==='+ result );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.11_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T5.js
new file mode 100644
index 0000000000..c8c3f9a0e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.11_T5.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.11_T5
+description: >
+ Calling a function within "with" statement declared without the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var value = "value";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ var f = function(){
+ throw value;
+ p1 = 'x1';
+ }
+ with(myObj){
+ f();
+ }
+} catch(e){
+ result = e;
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(result === "value")){
+ throw new Test262Error('#3: result === "value". Actual: result ==='+ result );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T1.js
new file mode 100644
index 0000000000..cc854e0845
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T1.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.12_T1
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ var f = function(){
+ p1 = 'x1';
+ }
+}
+
+f();
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T2.js
new file mode 100644
index 0000000000..da6cdbcf74
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T2.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.12_T2
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var value = "value";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ var f = function(){
+ p1 = 'x1'
+ return value;
+ }
+}
+
+result = f();
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#3: result === "myObj_value". Actual: result ==='+ result );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T3.js
new file mode 100644
index 0000000000..555e4b7c29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T3.js
@@ -0,0 +1,43 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.12_T3
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var value = "value";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ var f = function(){
+ return value;
+ p1 = 'x1';
+ }
+}
+result = f();
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#3: result === "myObj_value". Actual: result ==='+ result );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T4.js
new file mode 100644
index 0000000000..4f85b51f7a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T4.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.12_T4
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var value = "value";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ with(myObj){
+ var f = function(){
+ p1 = 'x1';
+ throw value;
+ }
+ }
+ f();
+} catch(e){
+ result = e;
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "x1")){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#3: result === "myObj_value". Actual: result ==='+ result );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.12_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T5.js
new file mode 100644
index 0000000000..1783877ae3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.12_T5.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.12_T5
+description: >
+ Calling a function without "with" statement declared within the
+ statement, leading to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var value = "value";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ with(myObj){
+ var f = function(){
+ throw value;
+ p1 = 'x1';
+ }
+ }
+ f();
+} catch(e){
+ result = e;
+}
+
+if(!(p1 === 1)){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+
+if(!(result === "myObj_value")){
+ throw new Test262Error('#3: result === "myObj_value". Actual: result ==='+ result );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.1_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T1.js
new file mode 100644
index 0000000000..d21fbfa222
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T1.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.1_T1
+description: Using "with" statement within global context - normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+
+with(myObj){
+ p1 = 'x1';
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.1_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T2.js
new file mode 100644
index 0000000000..7b9dfce0d9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T2.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.1_T2
+description: >
+ Using "with" statement within global context, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+
+ with(myObj){
+
+ p1 = 'x1'
+ throw value;
+
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (myObj.p1 !== "x1") {
+ throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.1_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T3.js
new file mode 100644
index 0000000000..270dc995a3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.1_T3.js
@@ -0,0 +1,57 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.1_T3
+description: >
+ Using "with" statement within global context, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var result = "result";
+var myObj = {p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+
+ with(myObj){
+
+ throw value;
+ p1 = 'x1'
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(!(result === 1)){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(!(p1 === 1)){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(!(myObj.p1 === "a")){
+ throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T1.js
new file mode 100644
index 0000000000..439f581876
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T1.js
@@ -0,0 +1,49 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.2_T1
+description: >
+ Declaring "with" statement within a function body, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+var f = function(){
+ with(myObj){
+ p1 = 'x1';
+ }
+}
+
+f();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T2.js
new file mode 100644
index 0000000000..63dd3686a0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T2.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.2_T2
+description: >
+ Declaring "with" statement within a function body, leading to
+ normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+var f = function(){
+ with(myObj){
+ p1 = 'x1';
+ return value;
+ }
+};
+
+f();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#1: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T3.js
new file mode 100644
index 0000000000..aa72121a9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T3.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.2_T3
+description: >
+ Declaring "with" statement within a function body, leading to
+ normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+var f = function(){
+ with(myObj){
+ return value;
+ p1 = 'x1';
+ }
+};
+
+f();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T4.js
new file mode 100644
index 0000000000..fc84f24371
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T4.js
@@ -0,0 +1,63 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.2_T4
+description: >
+ Declaring "with" statement within a function body, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ var f = function(){
+ with(myObj){
+ p1 = 'x1';
+ throw value;
+ }
+ };
+
+ f();
+} catch(e){
+ result = p1;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.2_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T5.js
new file mode 100644
index 0000000000..429f985657
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.2_T5.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.2_T5
+description: >
+ Declaring "with" statement within a function body, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+};
+
+try {
+ var f = function(){
+ with(myObj){
+ throw value;
+ p1 = 'x1';
+ }
+ };
+ f();
+} catch(e){
+ result = p1;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.3_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T1.js
new file mode 100644
index 0000000000..a7506c4195
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T1.js
@@ -0,0 +1,49 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.3_T1
+description: >
+ Declaring "with" statement within a function constructor, leading
+ to normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+function __FACTORY(){
+ with(myObj){
+ p1 = 'x1';
+ }
+}
+
+var obj = new __FACTORY();
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.3_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T2.js
new file mode 100644
index 0000000000..6abefff4bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T2.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.3_T2
+description: >
+ Declaring "with" statement within a function constructor, leading
+ to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+function __FACTORY(){
+ with(myObj){
+ p1 = 'x1';
+ return value;
+ }
+}
+
+var obj = new __FACTORY;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.3_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T3.js
new file mode 100644
index 0000000000..77e5b9027a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T3.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.3_T3
+description: >
+ Declaring "with" statement within a function constructor, leading
+ to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+function __FACTORY(){
+ with(myObj){
+ return value;
+ p1 = 'x1';
+ }
+}
+
+var obj = new __FACTORY;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.3_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T4.js
new file mode 100644
index 0000000000..b3f03221b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.3_T4.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement', the scope chain is
+ always restored to its former state
+es5id: 12.10_A3.3_T4
+description: >
+ Declaring "with" statement within a function constructor, leading
+ to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+};
+
+function __FACTORY(){
+ with(myObj){
+ var p1 = 'x1';
+ throw value;
+ }
+}
+
+try {
+ var obj = new __FACTORY();
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (result !== 1) {
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (p1 !== 1) {
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if (myObj.p1 !== "x1") {
+ throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T1.js
new file mode 100644
index 0000000000..e4cd8edcd1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T1.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.4_T1
+description: >
+ Using "with" statement within iteration statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+do {
+ with(myObj){
+ p1 = 'x1';
+ }
+} while(false);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T2.js
new file mode 100644
index 0000000000..242d1e5e0e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T2.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.4_T2
+description: >
+ Using "with" statement within iteration statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ do{
+ with(myObj){
+ p1 = 'x1';
+ throw value;
+ }
+ } while(false);
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T3.js
new file mode 100644
index 0000000000..83a3c3c153
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T3.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.4_T3
+description: >
+ Using "with" statement within iteration statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ do{
+ with(myObj){
+ throw value;
+ p1 = 'x1';
+ }
+ } while(false);
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T4.js
new file mode 100644
index 0000000000..a0bf5cb675
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T4.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.4_T4
+description: >
+ Using "with" statement within iteration statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+do {
+ with(myObj){
+ p1 = 'x1';
+ break;
+ }
+} while(false);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.4_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T5.js
new file mode 100644
index 0000000000..e4b1f0e74e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.4_T5.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.4_T5
+description: >
+ Using "with" statement within iteration statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+do {
+ with(myObj){
+ break;
+ p1 = 'x1';
+ }
+} while(false);
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T1.js
new file mode 100644
index 0000000000..8f4cdb0b8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T1.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.5_T1
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+for(var prop in myObj){
+ with(myObj){
+ p1 = 'x1';
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T2.js
new file mode 100644
index 0000000000..f3ef18ca9f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T2.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.5_T2
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ for(var prop in myObj){
+ with(myObj){
+ p1 = 'x1';
+ throw value;
+ }
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T3.js
new file mode 100644
index 0000000000..8f9487d867
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T3.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.5_T3
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ for(var prop in myObj){
+ with(myObj){
+ throw value;
+ p1 = 'x1';
+ }
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T4.js
new file mode 100644
index 0000000000..eb450e0044
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T4.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.5_T4
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+for(var prop in myObj){
+ with(myObj){
+ p1 = 'x1';
+ break;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.5_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T5.js
new file mode 100644
index 0000000000..8bcde0f3b3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.5_T5.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.5_T5
+description: >
+ Using "with" statement within "for-in" statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+for(var prop in myObj){
+ with(myObj){
+ break;
+ p1 = 'x1';
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#1: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.6_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T1.js
new file mode 100644
index 0000000000..b1d8c0516f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T1.js
@@ -0,0 +1,61 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.6_T1
+description: >
+ Using "with" statement within another "with" statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+var theirObj = {
+ p1: true,
+ value: 'theirObj_value',
+ valueOf : function(){return 'thr_valueOf';}
+}
+
+with(myObj){
+ with(theirObj){
+ p1 = 'x1';
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(theirObj.p1 !== "x1"){
+ throw new Test262Error('#3: theirObj.p1 === "x1". Actual: theirObj.p1 ==='+ theirObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.6_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T2.js
new file mode 100644
index 0000000000..556b5c5bc6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T2.js
@@ -0,0 +1,67 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.6_T2
+description: >
+ Using "with" statement within another "with" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+var theirObj = {
+ p1: true,
+ value: 'theirObj_value',
+ valueOf : function(){return 'thr_valueOf';}
+}
+
+
+try {
+ with(myObj){
+ with(theirObj){
+ p1 = 'x1';
+ throw value;
+ }
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(theirObj.p1 !== "x1"){
+ throw new Test262Error('#3: theirObj.p1 === "x1". Actual: theirObj.p1 ==='+ theirObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.6_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T3.js
new file mode 100644
index 0000000000..22c1e16087
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.6_T3.js
@@ -0,0 +1,68 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.6_T3
+description: >
+ Using "with" statement within another "with" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+var theirObj = {
+ p1: true,
+ value: 'theirObj_value',
+ valueOf : function(){return 'thr_valueOf';}
+}
+
+
+try {
+ with(myObj){
+ with(theirObj){
+ throw value;
+ p1 = 'x1';
+
+ }
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(theirObj.p1 !== true){
+ throw new Test262Error('#3: theirObj.p1 === true. Actual: theirObj.p1 ==='+ theirObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T1.js
new file mode 100644
index 0000000000..20590f314e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T1.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.7_T1
+description: >
+ Declaring and calling a function within "with" statement, leading
+ to normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ (function(){
+ p1 = 'x1';
+ })();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T2.js
new file mode 100644
index 0000000000..568959440c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T2.js
@@ -0,0 +1,56 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.7_T2
+description: >
+ Declaring and calling a function within "with" statement, leading
+ to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ result=(function(){
+ p1 = 'x1';
+ return value;
+ })();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(result !== "myObj_value"){
+ throw new Test262Error('#2: result === "myObj_value". Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T3.js
new file mode 100644
index 0000000000..cb1c49ce61
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T3.js
@@ -0,0 +1,56 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.7_T3
+description: >
+ Declaring and calling a function within "with" statement, leading
+ to normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ result=(function(){
+ return value;
+ p1 = 'x1';
+ })();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(result !== 'myObj_value'){
+ throw new Test262Error('#2: result === \'myObj_value\'. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T4.js
new file mode 100644
index 0000000000..72669eb862
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T4.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.7_T4
+description: >
+ Declaring and calling a function within "with" statement, leading
+ to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ with(myObj){
+ (function (){
+ p1 = 'x1';
+ throw value;
+ })();
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.7_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T5.js
new file mode 100644
index 0000000000..3eca9b370b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.7_T5.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.7_T5
+description: >
+ Declaring and calling a function within "with" statement, leading
+ to completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ with(myObj){
+ (function f(){
+ throw value;
+ p1 = 'x1';
+ })();
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T1.js
new file mode 100644
index 0000000000..f41869553a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T1.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.8_T1
+description: >
+ Declaring function constructor within "with" statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ var __FACTORY = function(){
+ p1 = 'x1';
+ }
+ var obj = new __FACTORY;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T2.js
new file mode 100644
index 0000000000..2a3b93f451
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T2.js
@@ -0,0 +1,49 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.8_T2
+description: >
+ Declaring function constructor within "with" statement, leading to
+ normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ var __FACTORY = function(){
+ p1 = 'x1';
+ return value;
+ }
+ var obj = new __FACTORY;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T3.js
new file mode 100644
index 0000000000..98d03278aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T3.js
@@ -0,0 +1,49 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.8_T3
+description: >
+ Declaring function constructor within "with" statement, leading to
+ normal completion by "return"
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ var __FACTORY = function(){
+ return value;
+ p1 = 'x1';
+ }
+ var obj = new __FACTORY;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T4.js
new file mode 100644
index 0000000000..0ecae4bbbe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T4.js
@@ -0,0 +1,61 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.8_T4
+description: >
+ Declaring function constructor within "with" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ with(myObj){
+ var __FACTORY = function(){
+ p1 = 'x1';
+ throw value;
+ }
+ var obj = new __FACTORY;
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.8_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T5.js
new file mode 100644
index 0000000000..3d100ca54a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.8_T5.js
@@ -0,0 +1,61 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.8_T5
+description: >
+ Declaring function constructor within "with" statement, leading to
+ completion by exception
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+try {
+ with(myObj){
+ var __FACTORY = function(){
+ throw value;
+ p1 = 'x1';
+ }
+ var obj = new __FACTORY;
+ }
+} catch(e){
+ result = p1;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(result !== 1){
+ throw new Test262Error('#1: result === 1. Actual: result ==='+ result );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(p1 !== 1){
+ throw new Test262Error('#2: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.9_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T1.js
new file mode 100644
index 0000000000..d37f5f6c70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T1.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.9_T1
+description: >
+ Using "for-in" statement within "with" statement, leading to
+ normal completion
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ for(var prop in myObj){
+ p1 = 'x1';
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.9_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T2.js
new file mode 100644
index 0000000000..c8e60954e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T2.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.9_T2
+description: >
+ Using "for-in" statement within "with" statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ for(var prop in myObj){
+ p1 = 'x1';
+ break;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "x1"){
+ throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A3.9_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T3.js
new file mode 100644
index 0000000000..e29b70053a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A3.9_T3.js
@@ -0,0 +1,48 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ No matter how control leaves the embedded 'Statement',
+ the scope chain is always restored to its former state
+es5id: 12.10_A3.9_T3
+description: >
+ Using "for-in" statement within "with" statement, leading to
+ completion by break
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+
+var result = "result";
+
+var myObj = {
+ p1: 'a',
+ value: 'myObj_value',
+ valueOf : function(){return 'obj_valueOf';}
+}
+
+with(myObj){
+ for(var prop in myObj){
+ break;
+ p1 = 'x1';
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(p1 !== 1){
+ throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== "a"){
+ throw new Test262Error('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T1.js
new file mode 100644
index 0000000000..883e51b89e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A4_T1.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Changing property using "eval" statement containing "with" statement
+es5id: 12.10_A4_T1
+description: Changing string property
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var myObj = {
+ p1: 'a',
+}
+eval("with(myObj){p1='b'}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1 !== 'b'){
+ throw new Test262Error('#1: myObj.p1 === "b". Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 === 1){
+ throw new Test262Error('#2: myObj.p1 !== 1');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T2.js
new file mode 100644
index 0000000000..42947c36b5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A4_T2.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Changing property using "eval" statement containing "with" statement
+es5id: 12.10_A4_T2
+description: Changing number property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: 1,
+}
+eval("with(myObj){p1=2}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1 !== 2){
+ throw new Test262Error('#1: myObj.p1 === 2. Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#2: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T3.js
new file mode 100644
index 0000000000..5daa1446b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A4_T3.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Changing property using "eval" statement containing "with" statement
+es5id: 12.10_A4_T3
+description: Changing boolean property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: true,
+}
+eval("with(myObj){p1=false}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1 !== false){
+ throw new Test262Error('#1: myObj.p1 === false. Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#2: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T4.js
new file mode 100644
index 0000000000..64fc1b8284
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A4_T4.js
@@ -0,0 +1,42 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Changing property using "eval" statement containing "with" statement
+es5id: 12.10_A4_T4
+description: Changing object property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: {a:"hello"},
+}
+eval("with(myObj){p1={b:'hi'}}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1.a === "hello"){
+ throw new Test262Error('#1: myObj.p1.a !== "hello"');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1.b !== "hi"){
+ throw new Test262Error('#2: myObj.p1.b === "hi". Actual: myObj.p1.b ==='+ myObj.p1.b );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#3: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T5.js
new file mode 100644
index 0000000000..8d845ab3d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A4_T5.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Changing property using "eval" statement containing "with" statement
+es5id: 12.10_A4_T5
+description: Changing array property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: [1,2,3],
+}
+eval("with(myObj){p1=[3,2,1]}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1[2] !== 1){
+ throw new Test262Error('#1: myObj.p1[2] === 1. Actual: myObj.p1[2] ==='+ myObj.p1[2] );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#2: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A4_T6.js b/js/src/tests/test262/language/statements/with/S12.10_A4_T6.js
new file mode 100644
index 0000000000..bf3480e112
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A4_T6.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Changing property using "eval" statement containing "with" statement
+es5id: 12.10_A4_T6
+description: Changing function property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: function(){return 0;},
+}
+eval("with(myObj){p1=function(){return 1;}}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1() !== 1){
+ throw new Test262Error('#1: myObj.p1 === 1. Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#2: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T1.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T1.js
new file mode 100644
index 0000000000..c1dff2df68
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A5_T1.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Deleting property using "eval" statement containing "with" statement
+es5id: 12.10_A5_T1
+description: Deleting string property
+flags: [noStrict]
+---*/
+
+this.p1 = 1;
+var myObj = {
+ p1: 'a',
+ del:false
+}
+eval("with(myObj){del = delete p1}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#1: myObj.p1 !== "a"');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== undefined){
+ throw new Test262Error('#2: myObj.p1 === undefined. Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.del !== true){
+ throw new Test262Error('#3: myObj.del === true. Actual: myObj.del ==='+ myObj.del );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(myObj.p1 === 1){
+ throw new Test262Error('#4: myObj.p1 !== 1');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T2.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T2.js
new file mode 100644
index 0000000000..e724989231
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A5_T2.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Deleting property using "eval" statement containing "with" statement
+es5id: 12.10_A5_T2
+description: Deleting number property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: 1,
+ del:false
+}
+eval("with(myObj){del = delete p1}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1 === 1){
+ throw new Test262Error('#1: myObj.p1 !== 1');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== undefined){
+ throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.del !== true){
+ throw new Test262Error('#3: myObj.del === true. Actual: myObj.del ===. Actual: myObj.del ==='+ myObj.del +myObj.del);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#4: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T3.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T3.js
new file mode 100644
index 0000000000..6c5e76a1db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A5_T3.js
@@ -0,0 +1,51 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Deleting property using "eval" statement containing "with" statement
+es5id: 12.10_A5_T3
+description: Deleting boolean property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: true,
+ del:false
+}
+
+eval("with(myObj){del = delete p1}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if(myObj.p1 === true){
+ throw new Test262Error('#1: myObj.p1 !== true ');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== undefined){
+ throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.del !== true){
+ throw new Test262Error('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#4: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T4.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T4.js
new file mode 100644
index 0000000000..24087deea5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A5_T4.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Deleting property using "eval" statement containing "with" statement
+es5id: 12.10_A5_T4
+description: Deleting object property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: {a:"hello"},
+ del:false
+}
+eval("with(myObj){del = delete p1}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+if(myObj.p1.a === "hello"){
+ throw new Test262Error('#1: myObj.p1.a !== "hello" ');
+}
+}catch(e){var x=1};
+if(x !== 1){
+ throw new Test262Error('#1: x === 1. Actual: x ==='+ x );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== undefined){
+ throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.del !== true){
+ throw new Test262Error('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#4: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T5.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T5.js
new file mode 100644
index 0000000000..e15e97febe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A5_T5.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Deleting property using "eval" statement containing "with" statement
+es5id: 12.10_A5_T5
+description: Deleting array property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: [1,2,3],
+ del:false
+}
+eval("with(myObj){del = delete p1}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+if(myObj.p1[2] === 3){
+ throw new Test262Error('#1: myObj.p1[2] !== 3 ');
+}
+}catch(e){var x=1};
+if(x !== 1){
+ throw new Test262Error('#1: x === 1. Actual: x ==='+ x );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== undefined){
+ throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.del !== true){
+ throw new Test262Error('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#4: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/S12.10_A5_T6.js b/js/src/tests/test262/language/statements/with/S12.10_A5_T6.js
new file mode 100644
index 0000000000..eed35e5fb8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/S12.10_A5_T6.js
@@ -0,0 +1,55 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Deleting property using "eval" statement containing "with" statement
+es5id: 12.10_A5_T6
+description: Deleting function property
+flags: [noStrict]
+---*/
+
+this.p1 = 'a';
+var myObj = {
+ p1: function(){return 0;},
+ del:false
+}
+eval("with(myObj){del = delete p1}");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try{
+if(myObj.p1() === 0){
+ throw new Test262Error('#1: myObj.p1() !== 0 ');
+}
+}catch(e){var x=1};
+if(x !== 1){
+ throw new Test262Error('#1: x === 1. Actual: x ==='+ x );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if(myObj.p1 !== undefined){
+ throw new Test262Error('#2: myObj.p1 === undefined . Actual: myObj.p1 ==='+ myObj.p1 );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#3
+if(myObj.del !== true){
+ throw new Test262Error('#3: myObj.del === true . Actual: myObj.del ==='+ myObj.del );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#4
+if(myObj.p1 === 'a'){
+ throw new Test262Error('#4: myObj.p1 !== \'a\'');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/binding-blocked-by-unscopables.js b/js/src/tests/test262/language/statements/with/binding-blocked-by-unscopables.js
new file mode 100644
index 0000000000..977a98912d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/binding-blocked-by-unscopables.js
@@ -0,0 +1,54 @@
+// Copyright 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 8.1.1.2.1
+description: >
+ True-coercing `Symbol.unscopables` properties block access to object environment record
+info: |
+ [...]
+ 6. If the withEnvironment flag of envRec is false, return true.
+ 7. Let unscopables be Get(bindings, @@unscopables).
+ 8. ReturnIfAbrupt(unscopables).
+ 9. If Type(unscopables) is Object, then
+ a. Let blocked be ToBoolean(Get(unscopables, N)).
+ b. ReturnIfAbrupt(blocked).
+ c. If blocked is true, return false.
+
+ ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
+ [...]
+ 6. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ [...]
+flags: [noStrict]
+features: [Symbol.unscopables]
+---*/
+
+var x = 0;
+var env = { x: 1 };
+env[Symbol.unscopables] = { x: true };
+
+with (env) {
+ assert.sameValue(x, 0, 'literal `true` value');
+}
+
+env[Symbol.unscopables].x = 'string';
+with (env) {
+ assert.sameValue(x, 0, 'non-empty string values');
+}
+
+env[Symbol.unscopables].x = 86;
+with (env) {
+ assert.sameValue(x, 0, 'non-zero number values');
+}
+
+env[Symbol.unscopables].x = {};
+with (env) {
+ assert.sameValue(x, 0, 'object values');
+}
+
+env[Symbol.unscopables].x = Symbol.unscopables;
+with (env) {
+ assert.sameValue(x, 0, 'Symbol values');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-falsey-prop.js b/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-falsey-prop.js
new file mode 100644
index 0000000000..b50112e5e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-falsey-prop.js
@@ -0,0 +1,60 @@
+// Copyright 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 8.1.1.2.1
+description: >
+ False-coercing `Symbol.unscopables` properties do not block access to object environment record
+info: |
+ [...]
+ 6. If the withEnvironment flag of envRec is false, return true.
+ 7. Let unscopables be Get(bindings, @@unscopables).
+ 8. ReturnIfAbrupt(unscopables).
+ 9. If Type(unscopables) is Object, then
+ a. Let blocked be ToBoolean(Get(unscopables, N)).
+ b. ReturnIfAbrupt(blocked).
+ c. If blocked is true, return false.
+ 10. Return true.
+
+ ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
+ [...]
+ 6. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ [...]
+flags: [noStrict]
+features: [Symbol.unscopables]
+---*/
+
+var x = 0;
+var env = { x: 1 };
+env[Symbol.unscopables] = {};
+
+with (env) {
+ assert.sameValue(x, 1, 'undefined (no property defined)');
+}
+
+env[Symbol.unscopables].x = false;
+with (env) {
+ assert.sameValue(x, 1, 'literal `false` value');
+}
+
+env[Symbol.unscopables].x = undefined;
+with (env) {
+ assert.sameValue(x, 1, 'literal `undefined` value');
+}
+
+env[Symbol.unscopables].x = null;
+with (env) {
+ assert.sameValue(x, 1, 'null value');
+}
+
+env[Symbol.unscopables].x = 0;
+with (env) {
+ assert.sameValue(x, 1, 'literal `0` number value');
+}
+
+env[Symbol.unscopables].x = '';
+with (env) {
+ assert.sameValue(x, 1, 'empty string value');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-non-obj.js b/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-non-obj.js
new file mode 100644
index 0000000000..28082178cc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/binding-not-blocked-by-unscopables-non-obj.js
@@ -0,0 +1,34 @@
+// Copyright 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 8.1.1.2.1
+description: Non-object values of `Symbol.unscopables` property are ignored
+info: |
+ [...]
+ 6. If the withEnvironment flag of envRec is false, return true.
+ 7. Let unscopables be Get(bindings, @@unscopables).
+ 8. ReturnIfAbrupt(unscopables).
+ 9. If Type(unscopables) is Object, then
+ a. Let blocked be ToBoolean(Get(unscopables, N)).
+ b. ReturnIfAbrupt(blocked).
+ c. If blocked is true, return false.
+ 10. Return true.
+
+ ES6: 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
+ [...]
+ 6. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ [...]
+flags: [noStrict]
+features: [Symbol.unscopables]
+---*/
+
+var test262ToString = {};
+var env = { toString: test262ToString };
+env[Symbol.unscopables] = '';
+
+with (env) {
+ assert.sameValue(toString, test262ToString);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/browser.js b/js/src/tests/test262/language/statements/with/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/browser.js
diff --git a/js/src/tests/test262/language/statements/with/cptn-abrupt-empty.js b/js/src/tests/test262/language/statements/with/cptn-abrupt-empty.js
new file mode 100644
index 0000000000..c57e3dfbdb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/cptn-abrupt-empty.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-with-statement-runtime-semantics-evaluation
+description: >
+ Statement completion value when body returns an empty abrupt completion
+info: |
+ WithStatement : with ( Expression ) Statement
+
+ [...]
+ 7. Let C be the result of evaluating Statement.
+ 8. Set the running execution context's LexicalEnvironment to oldEnv.
+ 9. Return Completion(UpdateEmpty(C, undefined)).
+flags: [noStrict]
+---*/
+
+assert.sameValue(
+ eval('1; do { 2; with({}) { 3; break; } 4; } while (false);'), 3
+);
+assert.sameValue(
+ eval('5; do { 6; with({}) { break; } 7; } while (false);'), undefined
+);
+
+assert.sameValue(
+ eval('8; do { 9; with({}) { 10; continue; } 11; } while (false)'), 10
+);
+assert.sameValue(
+ eval('12; do { 13; with({}) { continue; } 14; } while (false)'), undefined
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/cptn-nrml.js b/js/src/tests/test262/language/statements/with/cptn-nrml.js
new file mode 100644
index 0000000000..f75d9beb34
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/cptn-nrml.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.11.7
+description: Statement completion value when body returns a normal completion
+info: |
+ WithStatement : with ( Expression ) Statement
+
+ [...]
+ 8. Let C be the result of evaluating Statement.
+ 9. Set the running execution context’s Lexical Environment to oldEnv.
+ 10. If C.[[type]] is normal and C.[[value]] is empty, return
+ NormalCompletion(undefined).
+ 11. Return Completion(C).
+flags: [noStrict]
+---*/
+
+assert.sameValue(eval('1; with({}) { }'), undefined);
+assert.sameValue(eval('2; with({}) { 3; }'), 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/decl-async-fun.js b/js/src/tests/test262/language/statements/with/decl-async-fun.js
new file mode 100644
index 0000000000..94a7d6571b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/decl-async-fun.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-with-statement
+description: >
+ AsyncFunctionDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) async function f() {}
diff --git a/js/src/tests/test262/language/statements/with/decl-async-gen.js b/js/src/tests/test262/language/statements/with/decl-async-gen.js
new file mode 100644
index 0000000000..f9aa632bc7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/decl-async-gen.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-with-statement
+description: >
+ AsyncGeneratorDeclaration is not allowed in statement position
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-iteration]
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) async function* g() {}
diff --git a/js/src/tests/test262/language/statements/with/decl-cls.js b/js/src/tests/test262/language/statements/with/decl-cls.js
new file mode 100644
index 0000000000..2d6c8ced91
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/decl-cls.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Class declaration not allowed in statement position
+esid: sec-with-statement
+es6id: 13.11
+flags: [noStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) class C {}
diff --git a/js/src/tests/test262/language/statements/with/decl-const.js b/js/src/tests/test262/language/statements/with/decl-const.js
new file mode 100644
index 0000000000..4e6c99a8b7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/decl-const.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (const) not allowed in statement position
+esid: sec-with-statement
+es6id: 13.11
+flags: [noStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) const x = null;
diff --git a/js/src/tests/test262/language/statements/with/decl-fun.js b/js/src/tests/test262/language/statements/with/decl-fun.js
new file mode 100644
index 0000000000..e6b8ec9c8b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/decl-fun.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Function declaration not allowed in statement position
+esid: sec-with-statement
+es6id: 13.11
+flags: [noStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) function f() {}
diff --git a/js/src/tests/test262/language/statements/with/decl-gen.js b/js/src/tests/test262/language/statements/with/decl-gen.js
new file mode 100644
index 0000000000..b5c51aaf67
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/decl-gen.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Generator declaration not allowed in statement position
+esid: sec-with-statement
+es6id: 13.11
+flags: [noStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) function* g() {}
diff --git a/js/src/tests/test262/language/statements/with/decl-let.js b/js/src/tests/test262/language/statements/with/decl-let.js
new file mode 100644
index 0000000000..6e22af9ed7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/decl-let.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Lexical declaration (let) not allowed in statement position
+esid: sec-with-statement
+es6id: 13.11
+flags: [noStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) let x;
diff --git a/js/src/tests/test262/language/statements/with/has-property-err.js b/js/src/tests/test262/language/statements/with/has-property-err.js
new file mode 100644
index 0000000000..330ebee1a8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/has-property-err.js
@@ -0,0 +1,38 @@
+// Copyright (c) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-getidentifierreference
+es6id: 8.1.2.1
+description: >
+ Behavior when binding query produces an abrupt completion
+info: |
+ [...]
+ 2. Let envRec be lex's EnvironmentRecord.
+ 3. Let exists be ? envRec.HasBinding(name).
+
+ 8.1.1.2.1 HasBinding
+
+ 1. Let envRec be the object Environment Record for which the method was
+ invoked.
+ 2. Let bindings be the binding object for envRec.
+ 3. Let foundBinding be ? HasProperty(bindings, N).
+flags: [noStrict]
+features: [Proxy]
+---*/
+
+var thrower = new Proxy({}, {
+ has: function(_, name) {
+ if (name === 'test262') {
+ throw new Test262Error();
+ }
+ }
+});
+
+with (thrower) {
+ assert.throws(Test262Error, function() {
+ test262;
+ });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/labelled-fn-stmt.js b/js/src/tests/test262/language/statements/with/labelled-fn-stmt.js
new file mode 100644
index 0000000000..254f44b94f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/labelled-fn-stmt.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-with-statement-static-semantics-early-errors
+es6id: 13.11.1
+description: >
+ A labelled function declaration is never permitted in the Statement position
+info: |
+ WithStatementa: with ( Expression ) Statement
+
+ [...]
+ - It is a Syntax Error if IsLabelledFunction(Statement) is true.
+
+ NOTE It is only necessary to apply the second rule if the extension specified
+ in B.3.2 is implemented.
+
+ In the absence of Annex B.3.2, a SyntaxError should be produced due to the
+ labelled function declaration itself.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) label1: label2: function test262() {}
diff --git a/js/src/tests/test262/language/statements/with/let-array-with-newline.js b/js/src/tests/test262/language/statements/with/let-array-with-newline.js
new file mode 100644
index 0000000000..4711b0d0a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/let-array-with-newline.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-with-statement
+description: >
+ ExpressionStatement has a lookahead restriction for `let [`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+// Wrapped in an if-statement to avoid reference errors at runtime.
+if (false) {
+ with ({}) let
+ [a] = 0;
+}
diff --git a/js/src/tests/test262/language/statements/with/let-block-with-newline.js b/js/src/tests/test262/language/statements/with/let-block-with-newline.js
new file mode 100644
index 0000000000..2a7f5a0693
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/let-block-with-newline.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-with-statement
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let {`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+// Wrapped in an if-statement to avoid reference errors at runtime.
+if (false) {
+ with ({}) let // ASI
+ {}
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/let-identifier-with-newline.js b/js/src/tests/test262/language/statements/with/let-identifier-with-newline.js
new file mode 100644
index 0000000000..c7d1b89b30
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/let-identifier-with-newline.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-with-statement
+description: >
+ ExpressionStatement doesn't have a lookahead restriction for `let <binding-identifier>`.
+info: |
+ ExpressionStatement[Yield, Await] :
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await] ;
+flags: [noStrict]
+---*/
+
+// Wrapped in an if-statement to avoid reference errors at runtime.
+if (false) {
+ with ({}) let // ASI
+ x = 1;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/scope-var-close.js b/js/src/tests/test262/language/statements/with/scope-var-close.js
new file mode 100644
index 0000000000..59fc9175aa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/scope-var-close.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-with-statement-runtime-semantics-evaluation
+es6id: 13.11.7
+description: Removal of variable environment
+info: |
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let newEnv be NewObjectEnvironment(obj, oldEnv).
+ 5. Set the withEnvironment flag of newEnv's EnvironmentRecord to true.
+ 6. Set the running execution context's LexicalEnvironment to newEnv.
+ 7. Let C be the result of evaluating Statement.
+ 8. Set the running execution context's LexicalEnvironment to oldEnv.
+flags: [noStrict]
+---*/
+
+var probeBody;
+
+with ({ x: 0 })
+ var x = 1, _ = probeBody = function() { return x; };
+
+var x = 2;
+
+assert.sameValue(probeBody(), 1, 'reference from statement body');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/scope-var-open.js b/js/src/tests/test262/language/statements/with/scope-var-open.js
new file mode 100644
index 0000000000..3047879f20
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/scope-var-open.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-with-statement-runtime-semantics-evaluation
+es6id: 13.11.7
+description: Creation of new variable environment
+info: |
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let newEnv be NewObjectEnvironment(obj, oldEnv).
+ 5. Set the withEnvironment flag of newEnv's EnvironmentRecord to true.
+ 6. Set the running execution context's LexicalEnvironment to newEnv.
+ 7. Let C be the result of evaluating Statement.
+flags: [noStrict]
+---*/
+
+var x = 0;
+var objectRecord = { x: 2 };
+var probeBefore = function() { return x; };
+var probeExpr, probeBody;
+
+with (eval('var x = 1;'), probeExpr = function() { return x; }, objectRecord)
+ var x = 3, _ = probeBody = function() { return x; };
+
+assert.sameValue(probeBefore(), 1, 'reference preceding statement');
+assert.sameValue(probeExpr(), 1, 'reference from expression');
+assert.sameValue(probeBody(), 3, 'reference from statement body');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/shell.js b/js/src/tests/test262/language/statements/with/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/shell.js
diff --git a/js/src/tests/test262/language/statements/with/stict-script-strict.js b/js/src/tests/test262/language/statements/with/stict-script-strict.js
new file mode 100644
index 0000000000..e70dbf93e8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/stict-script-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-11-s
+description: >
+ Strict Mode - SyntaxError is thrown when using WithStatement in strict mode
+ code
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+with ({}) {}
diff --git a/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-1.js b/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-1.js
new file mode 100644
index 0000000000..9b0e601618
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-1.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-2-s
+description: >
+ with statement in strict mode throws SyntaxError (nested function where
+ container is strict)
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function foo() {
+ 'use strict';
+ function f() {
+ var o = {};
+ with (o) {};
+ }
+}
diff --git a/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-2.js b/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-2.js
new file mode 100644
index 0000000000..3240dd9d28
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/strict-fn-decl-nested-2.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-3-s
+description: >
+ with statement in strict mode throws SyntaxError (nested strict function)
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [noStrict]
+---*/
+
+$DONOTEVALUATE();
+
+function foo() {
+ function f() {
+ 'use strict';
+ var o = {};
+ with (o) {};
+ }
+}
diff --git a/js/src/tests/test262/language/statements/with/strict-fn-decl.js b/js/src/tests/test262/language/statements/with/strict-fn-decl.js
new file mode 100644
index 0000000000..0d6d71b538
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/strict-fn-decl.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-1-s
+description: with statement in strict mode throws SyntaxError (strict function)
+flags: [noStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ 'use strict';
+ var o = {};
+ with (o) {};
+}
diff --git a/js/src/tests/test262/language/statements/with/strict-fn-expr-strict.js b/js/src/tests/test262/language/statements/with/strict-fn-expr-strict.js
new file mode 100644
index 0000000000..8d6036d741
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/strict-fn-expr-strict.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-7-s
+description: >
+ with statement in strict mode throws SyntaxError (function expression)
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+var f = function () {
+ var o = {};
+ with (o) {};
+};
diff --git a/js/src/tests/test262/language/statements/with/strict-fn-method-strict.js b/js/src/tests/test262/language/statements/with/strict-fn-method-strict.js
new file mode 100644
index 0000000000..2dc0dda35d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/strict-fn-method-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.10.1-14-s
+description: >
+ Strict Mode - SyntaxError is thrown when the getter of a literal object
+ utilizes WithStatement
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+var obj = { get(a) { with(a){} } };
diff --git a/js/src/tests/test262/language/statements/with/unscopables-get-err.js b/js/src/tests/test262/language/statements/with/unscopables-get-err.js
new file mode 100644
index 0000000000..8a00e4ed2b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/unscopables-get-err.js
@@ -0,0 +1,42 @@
+// Copyright 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-getidentifierreference
+es6id: 8.1.2.1
+description: >
+ Behavior when accessing `Symbol.unscopables` property value throws an error
+info: |
+ [...]
+ 2. Let envRec be lex's EnvironmentRecord.
+ 3. Let exists be ? envRec.HasBinding(name).
+
+ 8.1.1.2.1 HasBinding
+
+ [...]
+ 5. If the withEnvironment flag of envRec is false, return true.
+ 6. Let unscopables be ? Get(bindings, @@unscopables).
+
+ 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
+
+ [...]
+ 5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ [...]
+flags: [noStrict]
+features: [Symbol.unscopables]
+---*/
+
+var env = { x: 86 };
+Object.defineProperty(env, Symbol.unscopables, {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+with (env) {
+ assert.throws(Test262Error, function() {
+ x;
+ });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/unscopables-inc-dec.js b/js/src/tests/test262/language/statements/with/unscopables-inc-dec.js
new file mode 100644
index 0000000000..bad2ecd079
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/unscopables-inc-dec.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object-environment-records-hasbinding-n
+description: >
+ @@unscopables should be looked up exactly once for inc/dec.
+info: |
+ UpdateExpression : LeftHandSideExpression ++
+ 1. Let lhs be the result of evaluating LeftHandSideExpression.
+
+ GetIdentifierReference ( lex, name, strict )
+ [...]
+ 3. Let exists be ? envRec.HasBinding(name).
+
+ HasBinding ( N )
+ [...]
+ 6. Let unscopables be ? Get(bindings, @@unscopables).
+flags: [noStrict]
+features: [Symbol.unscopables]
+---*/
+
+var unscopablesGetterCalled = 0;
+var a, b, flag = true;
+with (a = { x: 7 }) {
+ with (b = { x: 4, get [Symbol.unscopables]() {
+ unscopablesGetterCalled++;
+ return { x: flag=!flag };
+ } }) {
+ x++;
+ }
+}
+
+assert.sameValue(unscopablesGetterCalled, 1);
+assert.sameValue(a.x, 7);
+assert.sameValue(b.x, 5);
+
+unscopablesGetterCalled = 0;
+flag = true;
+with (a = { x: 7 }) {
+ with (b = { x: 4, get [Symbol.unscopables]() {
+ unscopablesGetterCalled++;
+ return { x: flag=!flag };
+ } }) {
+ x--;
+ }
+}
+
+assert.sameValue(unscopablesGetterCalled, 1);
+assert.sameValue(a.x, 7);
+assert.sameValue(b.x, 3);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/unscopables-not-referenced-for-undef.js b/js/src/tests/test262/language/statements/with/unscopables-not-referenced-for-undef.js
new file mode 100644
index 0000000000..961593f60d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/unscopables-not-referenced-for-undef.js
@@ -0,0 +1,47 @@
+// Copyright 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-getidentifierreference
+es6id: 8.1.2.1
+description: >
+ `Symbol.unscopables` is not referenced when environment record does not have
+ requested property
+info: |
+ [...]
+ 2. Let envRec be lex's EnvironmentRecord.
+ 3. Let exists be ? envRec.HasBinding(name).
+
+ 8.1.1.2.1 HasBinding
+
+ 1. Let envRec be the object Environment Record for which the method was
+ invoked.
+ 2. Let bindings be the binding object for envRec.
+ 3. Let foundBinding be ? HasProperty(bindings, N).
+ 4. If foundBinding is false, return false.
+
+ 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
+
+ [...]
+ 5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ [...]
+flags: [noStrict]
+features: [Symbol.unscopables]
+---*/
+
+var x = 0;
+var env = {};
+var callCount = 0;
+Object.defineProperty(env, Symbol.unscopables, {
+ get: function() {
+ callCount += 1;
+ }
+});
+
+with (env) {
+ x;
+}
+
+assert.sameValue(callCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/with/unscopables-prop-get-err.js b/js/src/tests/test262/language/statements/with/unscopables-prop-get-err.js
new file mode 100644
index 0000000000..a097be2e5d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/with/unscopables-prop-get-err.js
@@ -0,0 +1,48 @@
+// Copyright 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-getidentifierreference
+es6id: 8.1.2.1
+description: >
+ Behavior when accessing property of `Symbol.unscopables` property throws an
+ error
+info: |
+ [...]
+ 2. Let envRec be lex's EnvironmentRecord.
+ 3. Let exists be ? envRec.HasBinding(name).
+
+ 8.1.1.2.1 HasBinding
+
+ [...]
+ 5. If the withEnvironment flag of envRec is false, return true.
+ 6. Let unscopables be ? Get(bindings, @@unscopables).
+ 7. If Type(unscopables) is Object, then
+ a. Let blocked be ToBoolean(? Get(unscopables, N)).
+ b. If blocked is true, return false.
+
+ 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation
+
+ [...]
+ 5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ [...]
+flags: [noStrict]
+features: [Symbol.unscopables]
+---*/
+
+var env = { x: 86 };
+env[Symbol.unscopables] = {};
+
+Object.defineProperty(env[Symbol.unscopables], 'x', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+with (env) {
+ assert.throws(Test262Error, function() {
+ x;
+ });
+}
+
+reportCompare(0, 0);